This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Meshing parameters in msh (C++)

0 votes

Dear all,

I've read the documentation of msh, but maybe I overlooked, since I cannot find a clear statement where I can see how I can set mesh parameters, for instance, the desired cell size or similar properties. I've tried the following, stolen from the mshr::CSGCGALMeshGenerator2D::default_parameters() code, but it won't do anything:

Can anyone help me in the (really simple) problem?

Thanks!

// Create a simple mesh
Mesh simple;

// Vector of points
std::vector<Point> pts;
pts.push_back(Point(  0.0,   0.0));
pts.push_back(Point(  1.0,   0.0));
pts.push_back(Point(  1.0,   3.0));
pts.push_back(Point(  0.0,   3.0));

parameters.add("mesh_resolution", 10);
parameters.add("cell_size",        1);

// Polyline
mshr::Polygon polyline(pts);

// Generator
mshr::CSGCGALMeshGenerator2D generator;

// Mesh it!
generator.generate(polyline, simple);

// Spit the mesh
File meshfile("simple.pvd");
meshfile << simple;
asked May 13, 2015 by senseiwa FEniCS User (2,620 points)
edited May 27, 2015 by senseiwa

So, update: I can use parameters from the generator as follows:

mshr::CSGCGALMeshGenerator2D generator;

generator.parameters["mesh_resolution"] = 1.0;
generator.parameters["cell_size"] = 1.0;

generator.generate(polyline, simple);

I am finding difficulties in finding the meaning and specs of those parameters. Anybody knows where I can find the documentation?

1 Answer

+1 vote
 
Best answer

So, I had to resort to the mshr code to see actually how I can influence that.

As far as I understand, mesh_resolution is used only if positive, and if negative the cell_size will be used.

Not really satisfied, but that's an answer...

answered May 13, 2015 by senseiwa FEniCS User (2,620 points)
selected May 27, 2015 by senseiwa
...