Class for writing geometry files for Gmsh from voro++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Abaqus
Examples
LICENCE
README.md
vorogmsh.cpp
vorogmsh.h

README.md

voroGmsh

Class for writing geometry files for Gmsh from voro++

https://zenodo.org/badge/89606446.svg

Purpose

This class is intended to export the geometry of Voronoï cells computed using the Voro++ library as a Gmsh-readable file.

Requirements

Voro++

See here for how to install the Voro++ library.

AdjacencyMatrix

The present class needs the AdjacencyMatrix I have developped.

Gmsh

Since the class is intended to generate files for Gmsh, you may install it on your computer.

Installation

Import the required library into your project

Depending on the path to the voroGmsh files, you may need something like this:

#include "voroGmsh.git/trunk/vorogmsh.h"

Check the path to AdjacencyMatrix

In both vorogmsh.cpp and vorogmsh.h, check the path for the AdjacencyMatrix library (see above). E.g.:

#include "adjacencyMatrix.git/trunk/adjacencyMatrix.h"

How to use it?

Create an instance of vorogmsh

Once you have defined the Voro++ container and filled it with particles, you can create an object of class vorogmsh:

vorogmsh gmsh(con);

where con is the name of the container. The object gmsh contains all the data needed to create a 3D geometry in Gmsh.

Dump the geometry into a text file

Then, you can write an ASCII file defining the whole geometry:

gmsh.saveasgeo("Geometry.geo");

The saveasgeo method automatically computes the maximum element size at each vertex (based on the edge lengths). You can override this value by passing the nominal size as an optional parameter. E.g.:

gmsh.saveasgeo("Geometry.geo",0.5);

Note that if the nominal size is smaller than the computed one, the latter will be used instead.

Example

As an example, the pack_six_cube_poly dataset (provided in Voro++ examples) has been used. Figure below illustrates the meshes with default mesh size (left) and nominal size of 0.1 (right).

Note

I am not a programmer. Thus, this class is probably not optimized in terms of performances or flexibility. Do not hesitate to fork this project in order to improve it.