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 cout << endl <<
"2D meshing" << endl;
69 cout << endl <<
"\tCurve meshing:" << endl << endl;
81 for (
int i = 1; i <=
m_mesh->m_cad->GetNumCurve(); i++)
113 for (
int i = 1; i <=
m_mesh->m_cad->GetNumSurf(); i++)
121 cout << endl <<
"\tFace meshing:" << endl << endl;
125 for (
int i = 1; i <=
m_mesh->m_cad->GetNumSurf(); i++)
142 for (it =
m_mesh->m_edgeSet.begin(); it !=
m_mesh->m_edgeSet.end(); it++)
144 vector<NodeSharedPtr> ns;
145 ns.push_back((*it)->m_n1);
146 ns.push_back((*it)->m_n2);
155 tags.push_back((*it)->m_parentCAD->GetId());
160 m_mesh->m_element[1].push_back(E2);
176 cout << endl <<
"\tBoundary layer meshing:" << endl << endl;
184 vector<EdgeSharedPtr> localedges =
m_curvemeshes[*it]->GetMeshEdges();
185 for (
int i = 0; i < localedges.size(); i++)
195 map<int, Array<OneD, NekDouble> > edgeNormals;
203 m_mesh->m_cad->GetCurve(*it)->GetOrienationWRT(faceid);
205 vector<EdgeSharedPtr> es =
m_curvemeshes[*it]->GetMeshEdges();
211 for (
int j = 0; j < es.size(); j++)
215 p1 = es[j]->m_n1->GetCADSurfInfo(faceid);
216 p2 = es[j]->m_n2->GetCADSurfInfo(faceid);
222 n[0] = p1[1] - p2[1];
223 n[1] = p2[0] - p1[0];
224 NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
235 n[0] = locp[0] - loc[0];
236 n[1] = locp[1] - loc[1];
237 mag = sqrt(n[0] * n[0] + n[1] * n[1]);
241 edgeNormals[es[j]->m_id] = n;
245 map<NodeSharedPtr, NodeSharedPtr> nodeNormals;
246 map<NodeSharedPtr, vector<EdgeSharedPtr> >
::iterator it;
251 "wierdness, most likely bl_surfs are incorrect");
255 n[0] = (n1[0] + n2[0]) / 2.0;
256 n[1] = (n1[1] + n2[1]) / 2.0;
257 NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
262 it->first->m_y, 0.0, 0.0);
264 n[0] = n[0] * t + it->first->m_x;
265 n[1] = n[1] * t + it->first->m_y;
269 new Node(
m_mesh->m_numNodes++, n[0], n[1], 0.0));
272 nn->SetCADSurf(faceid, s, uv);
273 nodeNormals[it->first] = nn;
280 m_mesh->m_cad->GetCurve(*it)->GetOrienationWRT(faceid);
282 vector<NodeSharedPtr> ns =
m_curvemeshes[*it]->GetMeshPoints();
283 vector<NodeSharedPtr> newNs;
284 for (
int i = 0; i < ns.size(); i++)
286 newNs.push_back(nodeNormals[ns[i]]);
293 reverse(ns.begin(), ns.end());
295 for (
int i = 0; i < ns.size() - 1; ++i)
297 vector<NodeSharedPtr> qns;
299 qns.push_back(ns[i]);
300 qns.push_back(ns[i + 1]);
301 qns.push_back(nodeNormals[ns[i + 1]]);
302 qns.push_back(nodeNormals[ns[i]]);
312 E->m_parentCAD =
m_mesh->m_cad->GetSurf(faceid);
314 for (
int j = 0; j < E->GetEdgeCount(); ++j)
316 pair<EdgeSet::iterator, bool> testIns;
320 if (!(s ==
m_mesh->m_edgeSet.end()))
326 m_mesh->m_element[2].push_back(E);
335 int ns =
m_mesh->m_vertexSet.size();
336 int es =
m_mesh->m_edgeSet.size();
337 int ts =
m_mesh->m_element[2].size();
338 int ep = ns - es + ts;
339 cout << endl <<
"\tSurface mesh statistics" << endl;
340 cout <<
"\t\tNodes: " << ns << endl;
341 cout <<
"\t\tEdges: " << es << endl;
342 cout <<
"\t\tTriangles " << ts << endl;
343 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.