Write mesh to output file.
121 "ProcessDisplacement needs bnd parameter with a single id.");
123 string toFile =
m_config[
"to"].as<
string>();
127 cout <<
"ProcessDisplacement: you must provide a file" << endl;
131 bool useVertexIds =
m_config[
"usevertexids"].as<
bool>();
133 vector<string> files;
134 files.push_back(toFile);
141 int bndCondId =
m_config[
"bnd"].as<
int>();
145 if (bndGraph->GetMeshDimension() == 1)
147 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"v"));
148 m_f->m_variables.push_back(
"v");
151 m_f->m_exp[0]->GetBndCondExpansions()[bndCondId];
153 m_f->m_exp[1]->GetBndCondExpansions()[bndCondId];
155 map<int, int> bndCondIds;
156 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
158 bndCondIds[bndCondExpU->GetExp(i)->GetGeom()->GetGlobalID()] = i;
163 for (
auto &sIt : tmp)
165 auto mIt = bndCondIds.find(sIt.first);
167 if (mIt == bndCondIds.end())
169 cout <<
"Warning: couldn't find element " << sIt.first << endl;
176 std::dynamic_pointer_cast<SpatialDomains::SegGeom>(
177 bndCondExpU->GetExp(e)->GetGeom());
184 bndCondExpU->GetExp(e)->GetBasis(0)->GetBasisKey(), to);
186 const int offset = bndCondExpU->GetPhys_Offset(e);
187 const int nq = toSeg->GetTotPoints();
189 Array<OneD, NekDouble> xL(nq), xC(nq), yL(nq), yC(nq), tmp;
191 bndCondExpU->GetExp(e)->GetCoords(xC, yC);
192 toSeg->GetCoords(xL, yL);
195 tmp = bndCondExpU->UpdatePhys() + offset, 1);
197 tmp = bndCondExpV->UpdatePhys() + offset, 1);
201 bndCondExpU->FwdTrans_BndConstrained(bndCondExpU->GetPhys(),
202 bndCondExpU->UpdateCoeffs());
203 bndCondExpV->FwdTrans_BndConstrained(bndCondExpV->GetPhys(),
204 bndCondExpV->UpdateCoeffs());
206 else if (bndGraph->GetMeshDimension() == 2)
208 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"v"));
209 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"w"));
210 m_f->m_variables.push_back(
"v");
211 m_f->m_variables.push_back(
"w");
214 m_f->m_exp[0]->GetBndCondExpansions()[bndCondId];
216 m_f->m_exp[1]->GetBndCondExpansions()[bndCondId];
218 m_f->m_exp[2]->GetBndCondExpansions()[bndCondId];
220 map<int, int> bndCondIds;
221 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
223 bndCondIds[bndCondExpU->GetExp(i)->GetGeom()->GetGlobalID()] = i;
230 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
233 std::dynamic_pointer_cast<SpatialDomains::TriGeom>(
234 bndCondExpU->GetExp(i)->GetGeom());
236 TriFaceIDs t(from->GetVid(0), from->GetVid(1), from->GetVid(2));
237 vertexFaceMap[t] = i;
243 for (
auto &sIt : tmp)
249 TriFaceIDs t(sIt.second->GetVid(0), sIt.second->GetVid(1),
250 sIt.second->GetVid(2));
252 auto tIt = vertexFaceMap.find(t);
253 e = tIt == vertexFaceMap.end() ? -1 : tIt->second;
257 auto mIt = bndCondIds.find(sIt.first);
258 e = mIt == bndCondIds.end() ? -1 : mIt->second;
263 cout <<
"Warning: couldn't find element " << sIt.first << endl;
268 std::dynamic_pointer_cast<SpatialDomains::TriGeom>(
269 bndCondExpU->GetExp(e)->GetGeom());
276 bndCondExpU->GetExp(e)->GetBasis(0)->GetBasisKey(),
277 bndCondExpV->GetExp(e)->GetBasis(1)->GetBasisKey(), to);
279 const int offset = bndCondExpU->GetPhys_Offset(e);
280 const int nq = toSeg->GetTotPoints();
282 Array<OneD, NekDouble> xL(nq), xC(nq), yL(nq), yC(nq), tmp;
283 Array<OneD, NekDouble> zL(nq), zC(nq);
285 bndCondExpU->GetExp(e)->GetCoords(xC, yC, zC);
286 toSeg->GetCoords(xL, yL, zL);
289 tmp = bndCondExpU->UpdatePhys() + offset, 1);
291 tmp = bndCondExpV->UpdatePhys() + offset, 1);
293 tmp = bndCondExpW->UpdatePhys() + offset, 1);
297 bndCondExpU->FwdTrans_BndConstrained(bndCondExpU->GetPhys(),
298 bndCondExpU->UpdateCoeffs());
299 bndCondExpV->FwdTrans_BndConstrained(bndCondExpV->GetPhys(),
300 bndCondExpV->UpdateCoeffs());
301 bndCondExpW->FwdTrans_BndConstrained(bndCondExpW->GetPhys(),
302 bndCondExpW->UpdateCoeffs());
#define ASSERTL0(condition, msg)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::unordered_map< TriFaceIDs, int, TriFaceHash > TriFaceMap
std::map< std::string, ConfigOption > m_config
List of configuration values.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< int, TriGeomSharedPtr > TriGeomMap
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
std::shared_ptr< TriGeom > TriGeomSharedPtr
std::map< int, SegGeomSharedPtr > SegGeomMap
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
std::shared_ptr< SegExp > SegExpSharedPtr
std::shared_ptr< TriExp > TriExpSharedPtr
std::shared_ptr< SegGeom > SegGeomSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, DomainRangeShPtr rng=NullDomainRangeShPtr, bool fillGraph=true)
FieldSharedPtr m_f
Field object.