Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfaceMesh.cpp
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: SurfaceMeshing.cpp
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: surfacemeshing object methods.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 #include <algorithm>
36 
38 
40 #include <LocalRegions/MatrixKey.h>
42 
43 using namespace std;
44 namespace Nektar
45 {
46 namespace NekMeshUtils
47 {
48 
49 void SurfaceMesh::Mesh()
50 {
51  if (m_mesh->m_verbose)
52  cout << endl << "Surface meshing" << endl;
53 
54  if (m_mesh->m_verbose)
55  cout << endl << "\tCurve meshing:" << endl << endl;
56 
57  m_mesh->m_numNodes = m_cad->GetNumVerts();
58 
59  // linear mesh all curves
60  for (int i = 1; i <= m_cad->GetNumCurve(); i++)
61  {
62  if (m_mesh->m_verbose)
63  {
65  i, m_cad->GetNumCurve(), "Curve progress");
66  }
67 
69  i, m_mesh, m_cad->GetCurve(i), m_octree);
70 
71  m_curvemeshes[i]->Mesh();
72  }
73 
74  if (m_mesh->m_verbose)
75  cout << endl << "\tFace meshing:" << endl << endl;
76 
77  // linear mesh all surfaces
78  for (int i = 1; i <= m_cad->GetNumSurf(); i++)
79  {
80  if (m_mesh->m_verbose)
81  {
83  i, m_cad->GetNumSurf(), "Face progress");
84  }
85 
87 
88  it = find(m_symsurfs.begin(), m_symsurfs.end(), i);
89  if (it == m_symsurfs.end())
90  {
92  i, m_mesh, m_cad->GetSurf(i), m_octree, m_curvemeshes);
93  }
94  else
95  {
97  i, m_mesh, m_cad->GetSurf(i), m_octree, m_curvemeshes, m_bl);
98  }
99 
100  m_facemeshes[i]->Mesh();
101  }
102 }
103 
104 // this mesh is valided that each egde is listed twice in the triangles
105 void SurfaceMesh::Validate()
106 {
107  if (m_mesh->m_verbose)
108  cout << endl << "\tVerifying surface mesh" << endl;
109 
111 
112  for (it = m_mesh->m_edgeSet.begin(); it != m_mesh->m_edgeSet.end(); it++)
113  {
114  if ((*it)->m_elLink.size() != 2)
115  {
116  if (m_mesh->m_verbose)
117  cout << "\t\tFailed" << endl;
118  ASSERTL0(false, "edge not listed twice");
119  }
120  }
121 
122  if (m_mesh->m_verbose)
123  cout << "\t\tPassed" << endl;
124 }
125 
126 void SurfaceMesh::Report()
127 {
128  if (m_mesh->m_verbose)
129  {
130  int ns = m_mesh->m_vertexSet.size();
131  int es = m_mesh->m_edgeSet.size();
132  int ts = m_mesh->m_element[2].size();
133  int ep = ns - es + ts;
134  cout << endl << "\tSurface mesh statistics" << endl;
135  cout << "\t\tNodes: " << ns << endl;
136  cout << "\t\tEdges: " << es << endl;
137  cout << "\t\tTriangles " << ts << endl;
138  cout << "\t\tEuler-PoincarĂ© characteristic: " << ep << endl;
139  }
140 }
141 }
142 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
STL namespace.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:315
void PrintProgressbar(const int position, const int goal, const string message)
Prints a progressbar.
Definition: Progressbar.hpp:69