45 namespace NekMeshUtils
50 "Generates a 2D mesh");
55 ConfigOption(
false,
"",
"Generate parallelograms on these curves");
57 ConfigOption(
false,
"0.0",
"Parallelogram layer thickness");
68 ASSERTL0(fabs(bndBox[5] - bndBox[4]) < 1.0e-7,
"CAD isn't 2D");
72 cout << endl <<
"2D meshing" << endl;
73 cout << endl <<
"\tCurve meshing:" << endl << endl;
85 for (
int i = 1; i <=
m_mesh->m_cad->GetNumCurve(); i++)
117 for (
int i = 1; i <=
m_mesh->m_cad->GetNumSurf(); i++)
125 cout << endl <<
"\tFace meshing:" << endl << endl;
129 for (
int i = 1; i <=
m_mesh->m_cad->GetNumSurf(); i++)
146 for (it =
m_mesh->m_edgeSet.begin(); it !=
m_mesh->m_edgeSet.end(); it++)
148 vector<NodeSharedPtr> ns;
149 ns.push_back((*it)->m_n1);
150 ns.push_back((*it)->m_n2);
159 tags.push_back((*it)->m_parentCAD->GetId());
164 m_mesh->m_element[1].push_back(E2);
180 cout << endl <<
"\tBoundary layer meshing:" << endl << endl;
188 vector<EdgeSharedPtr> localedges =
m_curvemeshes[*it]->GetMeshEdges();
189 for (
int i = 0; i < localedges.size(); i++)
199 map<int, Array<OneD, NekDouble> > edgeNormals;
207 m_mesh->m_cad->GetCurve(*it)->GetOrienationWRT(faceid);
209 vector<EdgeSharedPtr> es =
m_curvemeshes[*it]->GetMeshEdges();
215 for (
int j = 0; j < es.size(); j++)
219 p1 = es[j]->m_n1->GetCADSurfInfo(faceid);
220 p2 = es[j]->m_n2->GetCADSurfInfo(faceid);
226 n[0] = p1[1] - p2[1];
227 n[1] = p2[0] - p1[0];
228 NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
239 n[0] = locp[0] - loc[0];
240 n[1] = locp[1] - loc[1];
241 mag = sqrt(n[0] * n[0] + n[1] * n[1]);
245 edgeNormals[es[j]->m_id] = n;
249 map<NodeSharedPtr, NodeSharedPtr> nodeNormals;
250 map<NodeSharedPtr, vector<EdgeSharedPtr> >
::iterator it;
255 "wierdness, most likely bl_surfs are incorrect");
259 n[0] = (n1[0] + n2[0]) / 2.0;
260 n[1] = (n1[1] + n2[1]) / 2.0;
261 NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
266 it->first->m_y, 0.0, 0.0);
268 n[0] = n[0] * t + it->first->m_x;
269 n[1] = n[1] * t + it->first->m_y;
273 new Node(
m_mesh->m_numNodes++, n[0], n[1], 0.0));
276 nn->SetCADSurf(faceid, s, uv);
277 nodeNormals[it->first] = nn;
284 m_mesh->m_cad->GetCurve(*it)->GetOrienationWRT(faceid);
286 vector<NodeSharedPtr> ns =
m_curvemeshes[*it]->GetMeshPoints();
287 vector<NodeSharedPtr> newNs;
288 for (
int i = 0; i < ns.size(); i++)
290 newNs.push_back(nodeNormals[ns[i]]);
297 reverse(ns.begin(), ns.end());
299 for (
int i = 0; i < ns.size() - 1; ++i)
301 vector<NodeSharedPtr> qns;
303 qns.push_back(ns[i]);
304 qns.push_back(ns[i + 1]);
305 qns.push_back(nodeNormals[ns[i + 1]]);
306 qns.push_back(nodeNormals[ns[i]]);
316 E->m_parentCAD =
m_mesh->m_cad->GetSurf(faceid);
318 for (
int j = 0; j < E->GetEdgeCount(); ++j)
320 pair<EdgeSet::iterator, bool> testIns;
324 if (!(s ==
m_mesh->m_edgeSet.end()))
330 m_mesh->m_element[2].push_back(E);
339 int ns =
m_mesh->m_vertexSet.size();
340 int es =
m_mesh->m_edgeSet.size();
341 int ts =
m_mesh->m_element[2].size();
342 int ep = ns - es + ts;
343 cout << endl <<
"\tSurface mesh statistics" << endl;
344 cout <<
"\t\tNodes: " << ns << endl;
345 cout <<
"\t\tEdges: " << es << endl;
346 cout <<
"\t\tTriangles " << ts << endl;
347 cout <<
"\t\tEuler-Poincaré characteristic: " << ep << endl;
#define ASSERTL0(condition, msg)
Basic information about an element.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
int PrintProgressbar(const int position, const int goal, const string message, int lastprogress=-1)
Prints a progressbar.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::vector< unsigned int > m_blCurves
std::map< int, FaceMeshSharedPtr > m_facemeshes
map of individual surface meshes from parametric surfaces
NekDouble Evaluate(const int AnalyticExpression_id)
Evaluation method for expressions depending on parameters only.
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
ElementFactory & GetElementFactory()
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
LibUtilities::AnalyticExpressionEvaluator m_thickness
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
Represents a command-line configuration option.
boost::shared_ptr< Node > NodeSharedPtr
std::map< std::string, ConfigOption > m_config
List of configuration values.
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
boost::shared_ptr< CADSurf > CADSurfSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
int DefineFunction(const std::string &vlist, const std::string &function)
This function allows one to define a function to evaluate. The first argument (vlist) is a list of va...
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Abstract base class for processing modules.
virtual NEKMESHUTILS_EXPORT void ProcessVertices()
Extract element vertices.
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
boost::shared_ptr< Element > ElementSharedPtr
std::map< NodeSharedPtr, std::vector< EdgeSharedPtr > > m_nodesToEdge
std::pair< ModuleType, std::string > ModuleKey
std::map< int, CurveMeshSharedPtr > m_curvemeshes
map of individual curve meshes of the curves in the domain
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.