49 ProcessLinear::create,
55 ConfigOption(
true,
"0",
"remove curve nodes for all elements.");
57 ConfigOption(
false,
"0",
"remove curve nodes if element is invalid.");
61 ConfigOption(
false,
"",
"dump a mesh of the extracted elements");
72 cout <<
"ProcessLinear: Linearising mesh... " << endl;
75 bool all =
m_config[
"all"].as<
bool>();
76 bool invalid =
m_config[
"invalid"].beenSet;
80 "Must specify an option: all (to remove all curvature) or invalid " 81 "(to remove curvature that makes elements invalid)");
85 for (
auto &edge :
m_mesh->m_edgeSet)
87 edge->m_edgeNodes.clear();
90 for (
auto &face :
m_mesh->m_faceSet)
92 face->m_faceNodes.clear();
95 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); i++)
97 vector<NodeSharedPtr> empty;
98 m_mesh->m_element[
m_mesh->m_expDim][i]->SetVolumeNodes(empty);
103 cerr <<
"Removed all element curvature" << endl;
108 map<int,vector<FaceSharedPtr> > eidToFace;
109 map<int,vector<ElementSharedPtr> > eidToElm;
111 vector<ElementSharedPtr> els =
m_mesh->m_element[
m_mesh->m_expDim];
112 vector<ElementSharedPtr> el = els;
114 for(
int i = 0; i < el.size(); i++)
116 vector<EdgeSharedPtr> e = el[i]->GetEdgeList();
117 for(
int j = 0; j < e.size(); j++)
119 eidToElm[e[j]->m_id].push_back(el[i]);
125 for(
auto &face :
m_mesh->m_faceSet)
127 vector<EdgeSharedPtr> es = face->m_edgeList;
128 for(
int i = 0; i < es.size(); i++)
130 eidToFace[es[i]->m_id].push_back(face);
136 vector<NodeSharedPtr> zeroNodes;
137 std::unordered_set<int> clearedEdges, clearedFaces, clearedElmts;
139 vector<ElementSharedPtr> dumpEls;
144 for (
int i = 0; i < el.size(); ++i)
156 dumpEls.push_back(el[i]);
157 clearedElmts.insert(el[i]->GetId());;
158 el[i]->SetVolumeNodes(zeroNodes);
160 vector<FaceSharedPtr> f = el[i]->GetFaceList();
161 for (
int j = 0; j < f.size(); j++)
163 f[j]->m_faceNodes.clear();
164 clearedFaces.insert(f[j]->m_id);
166 vector<EdgeSharedPtr> e = el[i]->GetEdgeList();
167 for(
int j = 0; j < e.size(); j++)
169 e[j]->m_edgeNodes.clear();
170 clearedEdges.insert(e[j]->m_id);
175 for(
int j = 0; j < e.size(); j++)
177 auto it = eidToFace.find(e[j]->m_id);
178 for(
int k = 0; k < it->second.size(); k++)
180 clearedEdges.insert(it->second[k]->m_id);
181 it->second[k]->m_faceNodes.clear();
186 for(
int j = 0; j < e.size(); j++)
188 auto it = eidToElm.find(e[j]->m_id);
189 for(
int k = 0; k < it->second.size(); k++)
191 neigh.insert(it->second[k]->GetId());
198 for(
int i = 0; i < els.size(); i++)
200 auto it1 = neigh.find(els[i]->GetId());
201 auto it2 = clearedElmts.find(els[i]->GetId());
202 if(it1 != neigh.end() && it2 == clearedElmts.end())
204 el.push_back(els[i]);
212 cerr <<
"Removed curvature from " << clearedElmts.size()
213 <<
" elements (" << clearedEdges.size() <<
" edges, " 214 << clearedFaces.size() <<
" faces)" << endl;
224 dmp->m_element[3] = dumpEls;
228 mod->RegisterConfig(
"outfile",
m_config[
"extract"].as<string>().c_str());
229 mod->ProcessVertices();
232 mod->ProcessElements();
233 mod->ProcessComposites();
243 el->GetGeom(
m_mesh->m_spaceDim);
247 geom->GetGeomFactors();
254 vector<NodeSharedPtr> ns = el->GetVertexList();
262 c.
m_e, c, ns, el->GetTagList());
269 const int pts = deriv[0][0].num_elements();
272 for (
int k = 0; k < pts; ++k)
277 for (
int l = 0; l <
m_mesh->m_expDim; ++l)
279 for (
int j = 0; j <
m_mesh->m_expDim; ++j)
281 jac(j,l) = deriv[l][j][k];
282 jacL(j,l) = derivL[l][j][k];
288 jc[k] = jac(0,0) * jac(1,1) - jac(0,1)*jac(1,0);
289 jcL[k] = jacL(0,0) * jacL(1,1) - jacL(0,1)*jacL(1,0);
291 else if(
m_mesh->m_expDim == 3)
293 jc[k] = jac(0,0) * (jac(1,1)*jac(2,2) - jac(2,1)*jac(1,2)) -
294 jac(0,1) * (jac(1,0)*jac(2,2) - jac(2,0)*jac(1,2)) +
295 jac(0,2) * (jac(1,0)*jac(2,1) - jac(2,0)*jac(1,1));
296 jcL[k] = jacL(0,0) * (jacL(1,1)*jacL(2,2) - jacL(2,1)*jacL(1,2)) -
297 jacL(0,1) * (jacL(1,0)*jacL(2,2) - jacL(2,0)*jacL(1,2)) +
298 jacL(0,2) * (jacL(1,0)*jacL(2,1) - jacL(2,0)*jacL(1,1));
bool m_faceNodes
Denotes whether the element contains face nodes. For 2D elements, if this is true then the element co...
#define ASSERTL0(condition, msg)
Basic information about an element.
std::vector< PointsKey > PointsKeyVector
virtual void Process()
Write mesh to output file.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
std::shared_ptr< Module > ModuleSharedPtr
MeshSharedPtr m_mesh
Mesh object.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
ElementFactory & GetElementFactory()
unsigned int m_order
Order of the element.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::pair< ModuleType, std::string > ModuleKey
bool Invalid(NekMeshUtils::ElementSharedPtr el, NekDouble thr)
bool m_volumeNodes
Denotes whether the element contains volume (i.e. interior) nodes. These are not supported by either ...
std::shared_ptr< Element > ElementSharedPtr
Represents a command-line configuration option.
std::shared_ptr< Geometry > GeometrySharedPtr
std::map< std::string, ConfigOption > m_config
List of configuration values.
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
bool m_reorient
Denotes whether the element needs to be re-orientated for a spectral element framework.
std::pair< ModuleType, std::string > ModuleKey
LibUtilities::ShapeType m_e
Element type (e.g. triangle, quad, etc).
ModuleFactory & GetModuleFactory()