Write mesh to output file.
120 "ProcessDisplacement needs bnd parameter with a single id.");
122 string toFile =
m_config[
"to"].as<
string>();
126 cout <<
"ProcessDisplacement: you must provide a file" << endl;
130 bool useVertexIds =
m_config[
"usevertexids"].as<
bool>();
132 vector<string> files;
133 files.push_back(toFile);
140 int bndCondId =
m_config[
"bnd"].as<
int>();
144 if (bndGraph->GetMeshDimension() == 1)
146 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"v"));
147 m_f->m_variables.push_back(
"v");
150 m_f->m_exp[0]->GetBndCondExpansions()[bndCondId];
152 m_f->m_exp[1]->GetBndCondExpansions()[bndCondId];
154 map<int, int> bndCondIds;
155 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
157 bndCondIds[bndCondExpU->GetExp(i)->GetGeom()->GetGlobalID()] = i;
162 for (
auto &sIt : tmp)
164 auto mIt = bndCondIds.find(sIt.first);
166 if (mIt == bndCondIds.end())
168 cout <<
"Warning: couldn't find element " << sIt.first << endl;
175 std::dynamic_pointer_cast<SpatialDomains::SegGeom>(
176 bndCondExpU->GetExp(e)->GetGeom());
183 bndCondExpU->GetExp(e)->GetBasis(0)->GetBasisKey(), to);
185 const int offset = bndCondExpU->GetPhys_Offset(e);
186 const int nq = toSeg->GetTotPoints();
188 Array<OneD, NekDouble> xL(nq), xC(nq), yL(nq), yC(nq), tmp;
190 bndCondExpU->GetExp(e)->GetCoords(xC, yC);
191 toSeg->GetCoords(xL, yL);
194 tmp = bndCondExpU->UpdatePhys() + offset, 1);
196 tmp = bndCondExpV->UpdatePhys() + offset, 1);
200 bndCondExpU->FwdTransBndConstrained(bndCondExpU->GetPhys(),
201 bndCondExpU->UpdateCoeffs());
202 bndCondExpV->FwdTransBndConstrained(bndCondExpV->GetPhys(),
203 bndCondExpV->UpdateCoeffs());
205 else if (bndGraph->GetMeshDimension() == 2)
207 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"v"));
208 m_f->m_exp.push_back(
m_f->AppendExpList(0,
"w"));
209 m_f->m_variables.push_back(
"v");
210 m_f->m_variables.push_back(
"w");
213 m_f->m_exp[0]->GetBndCondExpansions()[bndCondId];
215 m_f->m_exp[1]->GetBndCondExpansions()[bndCondId];
217 m_f->m_exp[2]->GetBndCondExpansions()[bndCondId];
219 map<int, int> bndCondIds;
220 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
222 bndCondIds[bndCondExpU->GetExp(i)->GetGeom()->GetGlobalID()] = i;
229 for (
int i = 0; i < bndCondExpU->GetExpSize(); ++i)
232 std::dynamic_pointer_cast<SpatialDomains::TriGeom>(
233 bndCondExpU->GetExp(i)->GetGeom());
235 TriFaceIDs t(from->GetVid(0), from->GetVid(1), from->GetVid(2));
236 vertexFaceMap[t] = i;
242 for (
auto &sIt : tmp)
248 TriFaceIDs t(sIt.second->GetVid(0), sIt.second->GetVid(1),
249 sIt.second->GetVid(2));
251 auto tIt = vertexFaceMap.find(t);
252 e = tIt == vertexFaceMap.end() ? -1 : tIt->second;
256 auto mIt = bndCondIds.find(sIt.first);
257 e = mIt == bndCondIds.end() ? -1 : mIt->second;
262 cout <<
"Warning: couldn't find element " << sIt.first << endl;
267 std::dynamic_pointer_cast<SpatialDomains::TriGeom>(
268 bndCondExpU->GetExp(e)->GetGeom());
275 bndCondExpU->GetExp(e)->GetBasis(0)->GetBasisKey(),
276 bndCondExpV->GetExp(e)->GetBasis(1)->GetBasisKey(), to);
278 const int offset = bndCondExpU->GetPhys_Offset(e);
279 const int nq = toSeg->GetTotPoints();
281 Array<OneD, NekDouble> xL(nq), xC(nq), yL(nq), yC(nq), tmp;
282 Array<OneD, NekDouble> zL(nq), zC(nq);
284 bndCondExpU->GetExp(e)->GetCoords(xC, yC, zC);
285 toSeg->GetCoords(xL, yL, zL);
288 tmp = bndCondExpU->UpdatePhys() + offset, 1);
290 tmp = bndCondExpV->UpdatePhys() + offset, 1);
292 tmp = bndCondExpW->UpdatePhys() + offset, 1);
296 bndCondExpU->FwdTransBndConstrained(bndCondExpU->GetPhys(),
297 bndCondExpU->UpdateCoeffs());
298 bndCondExpV->FwdTransBndConstrained(bndCondExpV->GetPhys(),
299 bndCondExpV->UpdateCoeffs());
300 bndCondExpW->FwdTransBndConstrained(bndCondExpW->GetPhys(),
301 bndCondExpW->UpdateCoeffs());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true)
std::unordered_map< TriFaceIDs, int, TriFaceHash > TriFaceMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< SegExp > SegExpSharedPtr
std::shared_ptr< TriExp > TriExpSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< int, TriGeomSharedPtr > TriGeomMap
std::map< int, SegGeomSharedPtr > SegGeomMap
std::shared_ptr< SegGeom > SegGeomSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< TriGeom > TriGeomSharedPtr
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.