26 fprintf(stderr,
"Usage: SplitFld meshfile fieldfile\n");
31 = LibUtilities::SessionReader::CreateInstance(argc, argv);
37 string meshfile(argv[argc-2]);
50 string fieldfile(argv[argc-1]);
51 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
52 vector<vector<NekDouble> > fielddata;
58 nfields = fielddef[0]->m_fields.size();
62 std::string solvtype = vSession->GetSolverInfo(
"SOLVERTYPE");
63 if(solvtype ==
"CoupledLinearisedNS" && vSession->DefinesSolverInfo(
"HOMOGENEOUS") )
66 SetFields(graphShPt,boundaryConditions,vSession,Exp,nfields-1);
70 int lastfield = nfields-1;
71 cout<<
"Set pressure: "<<lastfield<<endl;
72 int nplanes = fielddef[0]->m_numModes[2];
75 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
78 Exp[lastfield] = Exp3DH1;
84 SetFields(graphShPt,boundaryConditions,vSession,Exp,nfields);
90 for(
int j = 0; j < nfields; ++j)
92 for(
int i = 0; i < fielddef.size(); ++i)
94 Exp[j]->ExtractDataToCoeffs(fielddef [i],
96 fielddef [i]->m_fields[j],
97 Exp[j]->UpdateCoeffs());
99 Exp[j]->BwdTrans_IterPerExp(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
106 string fldfilename(argv[2]);
107 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
108 string endfile(
"split.fld");
120 for(
int i = 0; i < Exp.num_elements(); ++i)
122 fieldcoeffs[i] = Exp[i]->UpdateCoeffs();
134 for(
int j =0; j<nfields; j++)
137 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
138 = Exp[j]->GetFieldDefinitions();
139 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
141 for(
int i = 0; i < FieldDef.size(); ++i)
143 var = fielddef[i]->m_fields[j];
145 FieldDef[i]->m_fields.push_back(var);
146 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i],fieldcoeffs[j]);
149 outfile +=
"_"+var+
"_"+endfile;
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
1D Evenly-spaced points using Lagrange polynomial
void SetFields(SpatialDomains::MeshGraphSharedPtr &mesh, SpatialDomains::BoundaryConditionsSharedPtr &boundaryConditions, LibUtilities::SessionReaderSharedPtr &session, Array< OneD, MultiRegions::ExpListSharedPtr > &Exp, int nvariables)
Defines a specification for a set of points.
Array< OneD, int > GetReflectionIndex(MultiRegions::ExpListSharedPtr Exp, int Ireg)
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap, const bool backup)
This function allows for data to be written to an FLD file when a session and/or communicator is not ...
boost::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.