Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessInsertSurface Class Reference

This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...

#include <ProcessInsertSurface.h>

Inheritance diagram for Nektar::Utilities::ProcessInsertSurface:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::ProcessInsertSurface:
Collaboration graph
[legend]

Public Member Functions

 ProcessInsertSurface (NekMeshUtils::MeshSharedPtr m)
 
virtual ~ProcessInsertSurface ()
 
virtual void Process ()
 Write mesh to output file. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::ProcessModule
NEKMESHUTILS_EXPORT ProcessModule (MeshSharedPtr p_m)
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT Module (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void RegisterConfig (std::string key, std::string value)
 Register a configuration option with a module. More...
 
NEKMESHUTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
NEKMESHUTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
NEKMESHUTILS_EXPORT MeshSharedPtr GetMesh ()
 
virtual NEKMESHUTILS_EXPORT void ProcessVertices ()
 Extract element vertices. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessElements ()
 Generate element IDs. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessComposites ()
 Generate composites. More...
 
virtual NEKMESHUTILS_EXPORT void ClearElementLinks ()
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (NekMeshUtils::MeshSharedPtr m)
 Creates an instance of this class. More...
 

Static Public Attributes

static NekMeshUtils::ModuleKey className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
NEKMESHUTILS_EXPORT void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::NekMeshUtils::Module
MeshSharedPtr m_mesh
 Mesh object. More...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

Detailed Description

This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian.

Definition at line 52 of file ProcessInsertSurface.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessInsertSurface::ProcessInsertSurface ( NekMeshUtils::MeshSharedPtr  m)

Definition at line 60 of file ProcessInsertSurface.cpp.

References Nektar::NekMeshUtils::Module::m_config.

60  : ProcessModule(m)
61 {
62  m_config["mesh"] =
63  ConfigOption(false, "", "Mesh to be inserted.");
64  m_config["nonconforming"] =
65  ConfigOption(false,"", "Relax tests for nonconforming boundries");
66 }
Represents a command-line configuration option.
NEKMESHUTILS_EXPORT ProcessModule(MeshSharedPtr p_m)
std::map< std::string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessInsertSurface::~ProcessInsertSurface ( )
virtual

Definition at line 68 of file ProcessInsertSurface.cpp.

69 {
70 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessInsertSurface::create ( NekMeshUtils::MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 56 of file ProcessInsertSurface.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

57  {
59  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessInsertSurface::Process ( )
virtual

Write mesh to output file.

Implements Nektar::NekMeshUtils::Module.

Definition at line 72 of file ProcessInsertSurface.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::FieldUtils::eInputModule, Nektar::FieldUtils::GetModuleFactory(), Nektar::iterator, Nektar::NekMeshUtils::Module::m_config, Nektar::NekMeshUtils::Module::m_mesh, and CG_Iterations::Mesh.

73 {
74  typedef bg::model::point<NekDouble, 3, bg::cs::cartesian> Point;
75  typedef pair<Point, unsigned int> PointI;
76 
77  if (m_mesh->m_verbose)
78  {
79  cout << "ProcessInsertSurface: Inserting mesh... " << endl;
80  }
81 
82  string file = m_config["mesh"].as<string>();
83  bool nonconform = m_config["nonconforming"].beenSet;
84 
85  if (m_mesh->m_verbose)
86  {
87  cout << "inserting surface from " << file << endl;
88  }
89  MeshSharedPtr inMsh = boost::shared_ptr<Mesh>(new Mesh());
90  inMsh->m_verbose = m_mesh->m_verbose;
92  ModuleKey(eInputModule, "xml"), inMsh);
93  mod->RegisterConfig("infile", file);
94  mod->Process();
95 
96  //build ann tree of surface verticies from inMsh
97  //match surface vertices in ccm mesh to inMsh and copy information
98 
99  //tolerance of matching vertices
100  NekDouble tol = 1e-5;
101 
102  NodeSet surfaceNodes;
103  for(int i = 0; i < inMsh->m_element[2].size(); i++)
104  {
105  vector<NodeSharedPtr> ns = inMsh->m_element[2][i]->GetVertexList();
106  for(int j = 0; j < ns.size(); j++)
107  {
108  surfaceNodes.insert(ns[j]);
109  }
110  }
111 
112  vector<NodeSharedPtr> inMshnodeList(surfaceNodes.begin(), surfaceNodes.end());
113 
114  vector<PointI> dataPts;
115  for(int i = 0; i < inMshnodeList.size(); i++)
116  {
117  dataPts.push_back(make_pair(Point( inMshnodeList[i]->m_x,
118  inMshnodeList[i]->m_y,
119  inMshnodeList[i]->m_z), i));
120  }
121 
122  //Build tree
123  bgi::rtree<PointI, bgi::rstar<16> > rtree;
124  rtree.insert(dataPts.begin(), dataPts.end());
125 
126  surfaceNodes.clear();
127  for(int i = 0; i < m_mesh->m_element[2].size(); i++)
128  {
129  vector<NodeSharedPtr> ns = m_mesh->m_element[2][i]->GetVertexList();
130  for(int j = 0; j < ns.size(); j++)
131  {
132  surfaceNodes.insert(ns[j]);
133  }
134  }
135 
136  if(!nonconform)
137  {
138  ASSERTL0(surfaceNodes.size() == inMshnodeList.size(),
139  "surface mesh node count mismatch, will not work");
140  }
141 
142  EdgeSet surfEdges;
143  for(int i = 0; i < m_mesh->m_element[2].size(); i++)
144  {
145  FaceSharedPtr f = m_mesh->m_element[2][i]->GetFaceLink();
146  vector<EdgeSharedPtr> es = f->m_edgeList;
147  for(int j = 0; j < es.size(); j++)
148  {
149  surfEdges.insert(es[j]);
150  }
151  }
152 
154  for(it = surfEdges.begin(); it != surfEdges.end(); it++)
155  {
156  Point queryPt1((*it)->m_n1->m_x, (*it)->m_n1->m_y, (*it)->m_n1->m_z);
157  vector<PointI> result;
158  rtree.query(bgi::nearest(queryPt1, 1), std::back_inserter(result));
159 
160  NekDouble dist1 = bg::distance(result[0].first, queryPt1);
161  if(nonconform)
162  {
163  if(dist1 > tol)
164  {
165  continue;
166  }
167  }
168  else
169  {
170  ASSERTL0(dist1 < tol, "cannot locate point accurately enough");
171  }
172 
173  NodeSharedPtr inN1 = inMshnodeList[result[0].second];
174 
175  Point queryPt2((*it)->m_n2->m_x, (*it)->m_n2->m_y, (*it)->m_n2->m_z);
176  result.clear();
177  rtree.query(bgi::nearest(queryPt2, 1), std::back_inserter(result));
178 
179  NekDouble dist2 = bg::distance(result[0].first, queryPt2);
180  if(nonconform)
181  {
182  if(dist2 > tol)
183  {
184  continue;
185  }
186  }
187  else
188  {
189  ASSERTL0(dist2 < tol, "cannot locate point accurately enough");
190  }
191  NodeSharedPtr inN2 = inMshnodeList[result[0].second];
192 
193  EdgeSharedPtr tst = boost::shared_ptr<Edge>(new Edge(inN1,inN2));
194 
195  EdgeSet::iterator f = inMsh->m_edgeSet.find(tst);
196 
197  ASSERTL0(f != inMsh->m_edgeSet.end(),"could not find edge in input");
198 
199  (*it)->m_edgeNodes = (*f)->m_edgeNodes;
200  (*it)->m_curveType = (*f)->m_curveType;
201 
202  if((*f)->m_n1->Distance((*it)->m_n1) > tol)
203  {
204  reverse((*it)->m_edgeNodes.begin(),(*it)->m_edgeNodes.end());
205  }
206  }
207 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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.
Definition: NekFactory.hpp:162
Represents an edge which joins two points.
Definition: Edge.h:58
pair< ModuleType, string > ModuleKey
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:441
A 0-dimensional vertex.
Definition: Point.h:49
boost::shared_ptr< Module > ModuleSharedPtr
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
double NekDouble
std::map< std::string, ConfigOption > m_config
List of configuration values.
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:136
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:147
boost::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:162
boost::shared_ptr< Face > FaceSharedPtr
Definition: Face.h:153
ModuleFactory & GetModuleFactory()

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessInsertSurface::className
static
Initial value:
ModuleKey(eProcessModule, "insertsurface"),
"Insert high-order surface mesh into current working mesh.")

Definition at line 60 of file ProcessInsertSurface.h.