44 #include <boost/math/special_functions/fpclassify.hpp>
53 ModuleKey ProcessEquiSpacedOutput::className =
56 ProcessEquiSpacedOutput::create,
57 "Write data as equi-spaced output using simplices to represent the data for connecting points");
63 f->m_setUpEquiSpacedFields =
true;
66 "Only process tetrahedral elements");
87 cout <<
"Interpolating fields to equispaced" << endl;
90 int coordim =
m_f->m_exp[0]->GetCoordim(0);
91 int shapedim =
m_f->m_exp[0]->GetExp(0)->GetShapeDimension();
92 int npts =
m_f->m_exp[0]->GetTotPoints();
95 int nel =
m_f->m_exp[0]->GetExpSize();
107 map<int,StdRegions::Orientation > face0orient;
108 set<int> prismorient;
112 vector<std::string> fieldNames;
114 vector<Array<OneD, int> > ptsConn;
117 for(
int i = 0; i < nel; ++i)
119 e =
m_f->m_exp[0]->GetExp(i);
123 int fid = e->GetGeom()->GetFid(0);
124 if(face0orient.count(fid))
126 prismorient.insert(i);
146 for(
int i = 0; i < nel; ++i)
148 e =
m_f->m_exp[0]->GetExp(i);
151 int fid = e->GetGeom()->GetFid(2);
153 if(face0orient.count(fid))
168 prismorient.insert(i);
175 prismorient.insert(i);
182 for(
int i = 0; i < nel; ++i)
184 e =
m_f->m_exp[0]->GetExp(i);
187 if(
m_f->m_exp[0]->GetExp(i)->DetShapeType() !=
194 switch(e->DetShapeType())
198 int npoints0 = e->GetBasis(0)->GetNumPoints();
206 int np0 = e->GetBasis(0)->GetNumPoints();
207 int np1 = e->GetBasis(1)->GetNumPoints();
208 int np = max(np0,np1);
215 int np0 = e->GetBasis(0)->GetNumPoints();
216 int np1 = e->GetBasis(1)->GetNumPoints();
217 int np = max(np0,np1);
225 int np0 = e->GetBasis(0)->GetNumPoints();
226 int np1 = e->GetBasis(1)->GetNumPoints();
227 int np2 = e->GetBasis(2)->GetNumPoints();
228 int np = max(np0,max(np1,np2));
236 int np0 = e->GetBasis(0)->GetNumPoints();
237 int np1 = e->GetBasis(1)->GetNumPoints();
238 int np2 = e->GetBasis(2)->GetNumPoints();
239 int np = max(np0,max(np1,np2));
247 int np0 = e->GetBasis(0)->GetNumPoints();
248 int np1 = e->GetBasis(1)->GetNumPoints();
249 int np2 = e->GetBasis(2)->GetNumPoints();
250 int np = max(np0,max(np1,np2));
258 int np0 = e->GetBasis(0)->GetNumPoints();
259 int np1 = e->GetBasis(1)->GetNumPoints();
260 int np2 = e->GetBasis(2)->GetNumPoints();
261 int np = max(np0,max(np1,np2));
273 ppe.push_back(newpoints);
274 newtotpoints += newpoints;
279 bool standard =
true;
281 if(prismorient.count(i))
286 e->GetSimplexEquiSpacedConnectivity(conn,standard);
291 if((prevNcoeffs != e->GetNcoeffs()) ||
292 (prevNpoints != e->GetTotPoints()))
294 prevNcoeffs = e->GetNcoeffs();
295 prevNpoints = e->GetTotPoints();
297 e->GetSimplexEquiSpacedConnectivity(conn);
301 for(
int j = 0; j < conn.num_elements(); ++j)
303 newconn[j] = conn[j] + cnt;
306 ptsConn.push_back(newconn);
310 if(
m_f->m_fielddef.size())
312 nfields =
m_f->m_exp.size();
321 for(
int i = 0; i < nfields + coordim; ++i)
327 for(
int i = 0; i < coordim; ++i)
332 for(
int i = coordim; i < 3; ++i)
337 m_f->m_exp[0]->GetCoords(coords[0],coords[1],coords[2]);
339 int nq1 =
m_f->m_exp[0]->GetTotPoints();
345 m_f->m_exp[0]->GetCoords(x1, y1, z1);
350 for(
int n = 0; n < coordim; ++n)
354 for(
int i = 0; i < nel; ++i)
356 m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
358 tmp = pts[n] + cnt1);
360 cnt +=
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
364 if(
m_f->m_fielddef.size())
366 ASSERTL0(
m_f->m_fielddef[0]->m_fields.size() ==
m_f->m_exp.size(),
367 "More expansion defined than fields");
369 for(
int n = 0; n <
m_f->m_exp.size(); ++n)
374 if(
m_config[
"modalenergy"].m_beenSet)
377 for(
int i = 0; i < nel; ++i)
381 cnt +=
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
387 for(
int i = 0; i < nel; ++i)
389 m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
391 tmp = pts[coordim + n] + cnt1);
393 cnt +=
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
398 fieldNames.push_back(
m_f->m_fielddef[0]->m_fields[n]);
407 else if (shapedim == 3)
411 m_f->m_fieldPts->SetConnectivity(ptsConn);
421 e =
m_f->m_exp[0]->GetExp(n);
423 switch(e->DetShapeType())
427 int np0 = e->GetBasis(0)->GetNumPoints();
428 int np1 = e->GetBasis(1)->GetNumPoints();
429 int np = max(np0,np1);
443 e->GetBasis(1)->GetBasisKey(),
451 int np0 = e->GetBasis(0)->GetNumPoints();
452 int np1 = e->GetBasis(1)->GetNumPoints();
453 int np = max(np0,np1);
465 e->GetBasis(1)->GetBasisKey(),
472 ASSERTL0(
false,
"Shape needs setting up");
#define ASSERTL0(condition, msg)
int getNumberOfCoefficients(int Na, int Nb, int Nc)
pair< ModuleType, string > ModuleKey
static Array< OneD, NekDouble > NullNekDouble1DArray
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void SetupEquiSpacedField(void)
map< string, ConfigOption > m_config
List of configuration values.
void GenOrthoModes(int n, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &coeffs)
int getNumberOfCoefficients(int Na, int Nb, int Nc)
FieldSharedPtr m_f
Field object.
Principle Orthogonal Functions .
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis...
int getNumberOfCoefficients(int Na)
int getNumberOfCoefficients(int Na, int Nb)
Principle Orthogonal Functions .
Defines a specification for a set of points.
boost::shared_ptr< Field > FieldSharedPtr
Represents a command-line configuration option.
int getNumberOfCoefficients(int Na, int Nb, int Nc)
virtual ~ProcessEquiSpacedOutput()
int getNumberOfCoefficients(int Na, int Nb)
boost::shared_ptr< Expansion > ExpansionSharedPtr
Describes the specification for a Basis.
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space...