From: John P. <pet...@cf...> - 2006-06-30 15:36:53
|
Hi, I just checked in some code that will produce 2D triangulations of rectangular domains with n-sided holes cut out. Arbitrary (non-polygonal) holes are also possible, that code will hopefully be coming soon. Here is a sample code that uses the new functionality #include "libmesh.h" #include "mesh_generation.h" #include "mesh.h" // This program creates a Delaunay mesh of a region with arbitrary hole(s). int main (int argc, char** argv) { libMesh::init (argc, argv); { // Libmesh mesh that will eventually be created. Mesh mesh(2); // Add description of holes to the vector typedef MeshTools::Generation::Hole Hole; std::vector<Hole> holes; const Real xmin=-1., xmax=1., ymin=-1., ymax=1.; holes.push_back( Hole(Point( 0.5, 0.5), .25, 3 ) ); // triangular hole holes.push_back( Hole(Point(-0.5, 0.5), .1 , 50 ) ); // circular hole holes.push_back( Hole(Point(-0.5, -0.5), .1 , 4 ) ); // square hole holes.push_back( Hole(Point( 0.5, -0.5), .1 , 6 ) ); // hexagonal hole // Generate the mesh MeshTools::Generation::build_delaunay_square_with_hole(mesh, holes, 20, 20, xmin, xmax, ymin, ymax ); // Print result as GMV mesh.write("circular_hole2.gmv"); } return libMesh::close(); } |