36 #include <loki/Singleton.h>
44 namespace NekMeshUtils
49 typedef Loki::SingletonHolder<
ElementFactory, Loki::CreateUsingNew,
50 Loki::NoDestroy> Type;
51 return Type::Instance();
54 Element::Element(
ElmtConfig pConf,
unsigned int pNumNodes,
55 unsigned int pGotNodes)
58 if (pNumNodes != pGotNodes)
60 cerr <<
"Number of modes mismatch for type " << pConf.
m_e
61 <<
"! Should be " << pNumNodes <<
" but got " << pGotNodes
77 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
79 if (
m_edge[i]->m_n1 == vOld)
83 else if (
m_edge[i]->m_n2 == vOld)
88 for (
unsigned int i = 0; i <
m_face.size(); ++i)
91 for (
unsigned int j = 0; j <
m_face[i]->m_vertexList.size(); ++j)
93 if (
m_face[i]->m_vertexList[j] == vOld)
95 m_face[i]->m_vertexList[j] = pNew;
98 for (
unsigned int j = 0; j <
m_face[i]->m_edgeList.size(); ++j)
100 if (
m_face[i]->m_edgeList[j]->m_n1 == vOld)
102 m_face[i]->m_edgeList[j]->m_n1 = pNew;
104 else if (
m_face[i]->m_edgeList[j]->m_n2 == vOld)
106 m_face[i]->m_edgeList[j]->m_n2 = pNew;
122 for (
unsigned int i = 0; i <
m_face.size(); ++i)
124 for (
unsigned int j = 0; j <
m_face[i]->m_edgeList.size(); ++j)
126 if (
m_face[i]->m_edgeList[j] == vOld)
128 m_face[i]->m_edgeList[j] = pNew;
143 for (i = 0; i <
m_edge.size(); ++i)
145 int edgeOrder =
m_edge[i]->GetNodeCount() - 1;
164 for (
int i = 0; i <
m_edge.size(); ++i)
166 n +=
m_edge[i]->GetNodeCount();
172 for (
int i = 0; i <
m_face.size(); ++i)
174 n +=
m_face[i]->GetNodeCount();
176 for (
int i = 0; i <
m_edge.size(); ++i)
178 n -=
m_edge[i]->GetNodeCount();
181 std::cerr <<
"Not supported." << std::endl;
193 for (
int j = 0; j <
m_vertex.size(); ++j)
195 s << std::setw(5) <<
m_vertex[j]->m_id <<
" ";
199 for (
int j = 0; j <
m_edge.size(); ++j)
201 s << std::setw(5) <<
m_edge[j]->m_id <<
" ";
205 for (
int j = 0; j <
m_face.size(); ++j)
207 s << std::setw(5) <<
m_face[j]->m_id <<
" ";
217 std::vector<NodeSharedPtr> nodeList;
225 for (
int k = 0; k < nodeList.size(); ++k)
227 s << std::scientific << std::setprecision(8) <<
" "
228 << nodeList[k]->m_x <<
" " << nodeList[k]->m_y <<
" "
229 << nodeList[k]->m_z <<
" ";
virtual NEKMESHUTILS_EXPORT void GetCurvedNodes(std::vector< NodeSharedPtr > &nodeList) const
get list of volume interior nodes
Basic information about an element.
NEKMESHUTILS_EXPORT std::string GetXmlCurveString()
Generates a string listing the coordinates of all nodes associated with this element.
NEKMESHUTILS_EXPORT int GetMaxOrder()
Obtain the order of an element by looking at edges.
ElementFactory & GetElementFactory()
NEKMESHUTILS_EXPORT void SetFace(unsigned int p, FaceSharedPtr pNew)
Replace a face in the element.
NEKMESHUTILS_EXPORT void SetVertex(unsigned int p, NodeSharedPtr pNew, bool descend=true)
Replace a vertex in the element.
1D Evenly-spaced points using Lagrange polynomial
NEKMESHUTILS_EXPORT unsigned int GetNodeCount()
Returns the total number of nodes (vertices, edge nodes and face nodes and volume nodes)...
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
unsigned int m_dim
Dimension of the element.
std::vector< EdgeSharedPtr > m_edge
List of element edges.
boost::shared_ptr< Node > NodeSharedPtr
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
virtual NEKMESHUTILS_EXPORT std::string GetXmlString()
Generate a list of vertices (1D), edges (2D), or faces (3D).
NEKMESHUTILS_EXPORT void SetEdge(unsigned int p, EdgeSharedPtr pNew, bool descend=true)
Replace an edge in the element.
std::vector< FaceSharedPtr > m_face
List of element faces.
boost::shared_ptr< Face > FaceSharedPtr
Nektar::LibUtilities::NekFactory< LibUtilities::ShapeType, Element, ElmtConfig, std::vector< NodeSharedPtr >, std::vector< int > > ElementFactory
Element factory definition.
LibUtilities::ShapeType m_e
Element type (e.g. triangle, quad, etc).
Provides a generic Factory class.