40 #include <boost/format.hpp>
56 ParamMap::const_iterator it;
59 it = pParams.find(
"OutputFile");
60 if (it == pParams.end())
66 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
76 it = pParams.find(
"OutputFrequency");
77 if (it == pParams.end())
91 it = pParams.find(
"OutputPlane");
92 if (it == pParams.end())
104 it = pParams.find(
"Points");
105 ASSERTL0(it != pParams.end(),
"Missing parameter 'Points'.");
128 "No history points in stream.");
135 int dim = pFields[0]->GetGraph()->GetSpaceDimension();
144 NekDouble Z = (pFields[0]->GetHomogeneousBasis()
148 cout <<
"Reseting History point from " << gloCoord[2]
149 <<
" to " << Z << endl;
159 gloCoord[1], gloCoord[2]);
170 int vRank = vComm->GetRank();
176 std::vector<Array<OneD, NekDouble> > LocCoords;
181 for (i = 0; i < vHP; ++i)
189 idList[i] = pFields[0]->GetExpIndex(gloCoord,locCoords,
193 LocCoords.push_back(locCoords);
201 pFields[0]->GetExp(idList[i])->GetGeom();
205 for (
int j = 0; j < g->GetCoordim(); ++j)
207 e->BwdTrans(g->GetCoeffs(j), coordVals);
208 NekDouble x = e->PhysEvaluate(locCoords, coordVals)
223 for (i = 0; i < vHP; ++i)
225 if (dist_loc[i] == dist[i])
244 = pFields[0]->GetZIDs();
245 for(j = 0; j < IDs.num_elements(); ++j)
253 if(j != IDs.num_elements())
273 for (i = 0; i < vHP; ++i)
277 if (procList[i] != vRank)
297 if (vComm->GetRank() == 0)
299 for (i = 0; i < vHP; ++i)
308 + boost::lexical_cast<std::string>(gloCoord[0])
310 + boost::lexical_cast<std::string>(gloCoord[1])
312 + boost::lexical_cast<std::string>(gloCoord[2])
313 +
" cannot be found in the mesh.");
319 cout <<
"Warning: History point " << i <<
" at ("
320 << gloCoord[0] <<
"," << gloCoord[1] <<
","
321 << gloCoord[2] <<
") lies a distance of "
322 << sqrt(dist[i]) <<
" from the manifold." << endl;
330 for (i = 0; i < pFields.num_elements(); ++i)
344 for (i = 0; i < vHP; ++i)
380 int numFields = pFields.num_elements();
384 std::list<std::pair<SpatialDomains::PointGeomSharedPtr, Array<OneD, NekDouble> > >
::iterator x;
391 for (j = 0; j < numFields; ++j)
398 locCoord = (*x).second;
399 expId = (*x).first->GetVid();
401 physvals = pFields[j]->GetPlane(
m_outputPlane)->UpdatePhys() + pFields[j]->GetPhys_Offset(expId);
404 if(pFields[j]->GetPhysState() ==
false)
406 pFields[j]->GetPlane(
m_outputPlane)->GetExp(expId)->BwdTrans(pFields[j]->GetPlane(
m_outputPlane)->GetCoeffs() + pFields[j]->GetCoeff_Offset(expId),physvals);
410 data[
m_historyLocalPointMap[k]*numFields+j] = pFields[j]->GetExp(expId)->StdPhysEvaluate(locCoord,physvals);
418 locCoord = (*x).second;
419 expId = (*x).first->GetVid();
421 physvals = pFields[j]->UpdatePhys() + pFields[j]->GetPhys_Offset(expId);
424 if(pFields[j]->GetPhysState() ==
false)
426 pFields[j]->GetExp(expId)->BwdTrans(pFields[j]->GetCoeffs() + pFields[j]->GetCoeff_Offset(expId),physvals);
430 data[
m_historyLocalPointMap[k]*numFields+j] = pFields[j]->GetExp(expId)->StdPhysEvaluate(locCoord,physvals);
440 if (vComm->GetRank() == 0)
447 for (
int j = 0; j < numFields; ++j)
449 m_outputStream <<
" " << boost::format(
"%25e") % data[k*numFields+j];
462 if (pFields[0]->GetComm()->GetRank() == 0)
std::ofstream m_outputStream
#define ASSERTL0(condition, msg)
std::map< int, int > m_historyLocalPointMap
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
static const NekDouble kVertexTheSameDouble
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
std::stringstream m_historyPointStream
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
unsigned int m_outputPlane
plane to take history point from if using a homogeneous1D expansion
NekDouble Evaluate() const
SpatialDomains::PointGeomVector m_historyPoints
static std::string className
Name of the class.
unsigned int m_outputFrequency
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
SOLVER_UTILS_EXPORT ~FilterHistoryPoints()
virtual SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent()
static const NekDouble kGeomFactorsTol
SOLVER_UTILS_EXPORT FilterHistoryPoints(const LibUtilities::SessionReaderSharedPtr &pSession, const ParamMap &pParams)
FilterFactory & GetFilterFactory()
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
virtual SOLVER_UTILS_EXPORT void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
boost::shared_ptr< Geometry > GeometrySharedPtr
std::list< std::pair< SpatialDomains::PointGeomSharedPtr, Array< OneD, NekDouble > > > m_historyList
boost::shared_ptr< PointGeom > PointGeomSharedPtr
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.