50 ProcessLinear::create,
56 ConfigOption(
true,
"0",
"remove curve nodes for all elements.");
58 ConfigOption(
false,
"0",
"remove curve nodes if element is invalid.");
62 ConfigOption(
false,
"",
"dump a mesh of the extracted elements");
73 cout <<
"ProcessLinear: Linearising mesh... " << endl;
76 bool all =
m_config[
"all"].as<
bool>();
77 bool invalid =
m_config[
"invalid"].beenSet;
81 "Must specify an option: all (to remove all curvature) or invalid "
82 "(to remove curvature that makes elements invalid)");
87 for (eit =
m_mesh->m_edgeSet.begin(); eit !=
m_mesh->m_edgeSet.end();
90 (*eit)->m_edgeNodes.clear();
94 for (fit =
m_mesh->m_faceSet.begin(); fit !=
m_mesh->m_faceSet.end();
97 (*fit)->m_faceNodes.clear();
100 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); i++)
102 vector<NodeSharedPtr> empty;
103 m_mesh->m_element[
m_mesh->m_expDim][i]->SetVolumeNodes(empty);
108 cerr <<
"Removed all element curvature" << endl;
113 map<int,vector<FaceSharedPtr> > eidToFace;
114 map<int,vector<ElementSharedPtr> > eidToElm;
116 vector<ElementSharedPtr> els =
m_mesh->m_element[
m_mesh->m_expDim];
117 vector<ElementSharedPtr> el = els;
119 for(
int i = 0; i < el.size(); i++)
121 vector<EdgeSharedPtr> e = el[i]->GetEdgeList();
122 for(
int j = 0; j < e.size(); j++)
124 eidToElm[e[j]->m_id].push_back(el[i]);
131 for(it =
m_mesh->m_faceSet.begin();
132 it !=
m_mesh->m_faceSet.end(); it++)
134 vector<EdgeSharedPtr> es = (*it)->m_edgeList;
135 for(
int i = 0; i < es.size(); i++)
137 eidToFace[es[i]->m_id].push_back((*it));
143 vector<NodeSharedPtr> zeroNodes;
144 boost::unordered_set<int> clearedEdges, clearedFaces, clearedElmts;
146 vector<ElementSharedPtr> dumpEls;
151 for (
int i = 0; i < el.size(); ++i)
163 dumpEls.push_back(el[i]);
164 clearedElmts.insert(el[i]->GetId());;
165 el[i]->SetVolumeNodes(zeroNodes);
167 vector<FaceSharedPtr> f = el[i]->GetFaceList();
168 for (
int j = 0; j < f.size(); j++)
170 f[j]->m_faceNodes.clear();
171 clearedFaces.insert(f[j]->m_id);
173 vector<EdgeSharedPtr> e = el[i]->GetEdgeList();
174 for(
int j = 0; j < e.size(); j++)
176 e[j]->m_edgeNodes.clear();
177 clearedEdges.insert(e[j]->m_id);
182 for(
int j = 0; j < e.size(); j++)
184 map<int,vector<FaceSharedPtr> >
::iterator it =
185 eidToFace.find(e[j]->m_id);
186 for(
int k = 0; k < it->second.size(); k++)
188 clearedEdges.insert(it->second[k]->m_id);
189 it->second[k]->m_faceNodes.clear();
194 for(
int j = 0; j < e.size(); j++)
196 map<int,vector<ElementSharedPtr> >
::iterator it =
197 eidToElm.find(e[j]->m_id);
198 for(
int k = 0; k < it->second.size(); k++)
200 neigh.insert(it->second[k]->GetId());
209 for(
int i = 0; i < els.size(); i++)
211 it1 = neigh.find(els[i]->GetId());
212 it2 = clearedElmts.find(els[i]->GetId());
213 if(it1 != neigh.end() && it2 == clearedElmts.end())
215 el.push_back(els[i]);
223 cerr <<
"Removed curvature from " << clearedElmts.size()
224 <<
" elements (" << clearedEdges.size() <<
" edges, "
225 << clearedFaces.size() <<
" faces)" << endl;
235 dmp->m_element[3] = dumpEls;
239 mod->RegisterConfig(
"outfile",
m_config[
"extract"].as<string>().c_str());
240 mod->ProcessVertices();
243 mod->ProcessElements();
244 mod->ProcessComposites();
254 el->GetGeom(
m_mesh->m_spaceDim);
258 geom->GetGeomFactors();
265 vector<NodeSharedPtr> ns = el->GetVertexList();
273 c.
m_e, c, ns, el->GetTagList());
280 const int pts = deriv[0][0].num_elements();
283 for (
int k = 0; k < pts; ++k)
288 for (
int l = 0; l <
m_mesh->m_expDim; ++l)
290 for (
int j = 0; j <
m_mesh->m_expDim; ++j)
292 jac(j,l) = deriv[l][j][k];
293 jacL(j,l) = derivL[l][j][k];
299 jc[k] = jac(0,0) * jac(1,1) - jac(0,1)*jac(1,0);
300 jcL[k] = jacL(0,0) * jacL(1,1) - jacL(0,1)*jacL(1,0);
302 else if(
m_mesh->m_expDim == 3)
304 jc[k] = jac(0,0) * (jac(1,1)*jac(2,2) - jac(2,1)*jac(1,2)) -
305 jac(0,1) * (jac(1,0)*jac(2,2) - jac(2,0)*jac(1,2)) +
306 jac(0,2) * (jac(1,0)*jac(2,1) - jac(2,0)*jac(1,1));
307 jcL[k] = jacL(0,0) * (jacL(1,1)*jacL(2,2) - jacL(2,1)*jacL(1,2)) -
308 jacL(0,1) * (jacL(1,0)*jacL(2,2) - jacL(2,0)*jacL(1,2)) +
309 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
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.
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.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
pair< ModuleType, string > ModuleKey
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.
ElementFactory & GetElementFactory()
unsigned int m_order
Order of the element.
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 ...
boost::shared_ptr< Module > ModuleSharedPtr
Represents a command-line configuration option.
std::map< std::string, ConfigOption > m_config
List of configuration values.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Abstract base class for processing modules.
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
bool m_reorient
Denotes whether the element needs to be re-orientated for a spectral element framework.
boost::shared_ptr< Element > ElementSharedPtr
std::pair< ModuleType, std::string > ModuleKey
boost::shared_ptr< Geometry > GeometrySharedPtr
LibUtilities::ShapeType m_e
Element type (e.g. triangle, quad, etc).
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.