35 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIO_H 36 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIO_H 49 namespace LibUtilities
62 virtual std::shared_ptr<TagWriter>
AddChild(
const std::string &
name) = 0;
64 virtual void SetAttr(
const std::string &key,
const std::string &val) = 0;
106 m_numHomogeneousDir(0),
110 m_numPointsDef(false)
117 const std::vector<unsigned int> &elementIDs,
118 const std::vector<LibUtilities::BasisType> &basis,
120 const std::vector<unsigned int> &numModes,
121 const std::vector<std::string> &fields,
124 bool homoStrips =
false,
128 const std::vector<LibUtilities::PointsType> &points =
130 bool pointsDef =
false,
132 bool numPointsDef =
false)
133 : m_shapeType(shapeType), m_elementIDs(elementIDs), m_basis(basis),
134 m_numHomogeneousDir(NumHomoDir), m_homogeneousLengths(HomoLengths),
135 m_homoStrips(homoStrips), m_homogeneousSIDs(HomoSIDs),
136 m_homogeneousZIDs(HomoZIDs), m_homogeneousYIDs(HomoYIDs),
137 m_points(points), m_pointsDef(pointsDef), m_uniOrder(uniOrder),
138 m_numModes(numModes), m_numPoints(numPoints),
139 m_numPointsDef(numPointsDef), m_fields(fields)
182 const std::string &outFile,
183 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
184 std::vector<std::vector<NekDouble> > &fielddata,
185 const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
186 const bool backup =
false);
188 const std::string &infilename,
189 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
191 FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
222 class FieldIO :
public std::enable_shared_from_this<FieldIO>
226 LibUtilities::CommSharedPtr pComm,
bool sharedFilesystem);
233 const std::string &outFile,
234 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
235 std::vector<std::vector<NekDouble> > &fielddata,
236 const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
237 const bool backup =
false);
240 const std::string &infilename,
241 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
242 std::vector<std::vector<NekDouble> > &fielddata =
244 FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
248 const std::string &filename,
249 FieldMetaDataMap &fieldmetadatamap);
259 const std::string &filename);
261 TagWriterSharedPtr root,
262 const FieldMetaDataMap &fieldmetadatamap);
271 const FieldDefinitionsSharedPtr &fielddefs);
282 const std::string outname,
bool perRank,
bool backup =
false);
286 const std::string &outFile,
287 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
288 std::vector<std::vector<NekDouble> > &fielddata,
289 const FieldMetaDataMap &fieldinfomap,
290 const bool backup =
false) = 0;
294 const std::string &infilename,
295 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
296 std::vector<std::vector<NekDouble> >
298 FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
303 const std::string &filename, FieldMetaDataMap &fieldmetadatamap) = 0;
318 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
319 std::vector<std::vector<NekDouble> > &fielddata,
320 const FieldMetaDataMap &fieldinfomap,
323 v_Write(outFile, fielddefs, fielddata, fieldinfomap, backup);
340 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
341 std::vector<std::vector<NekDouble> > &fielddata,
342 FieldMetaDataMap &fieldinfo,
345 v_Import(infilename, fielddefs, fielddata, fieldinfo, ElementIDs);
356 const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
358 return v_ImportFieldMetaData(filename, fieldmetadatamap);
std::vector< unsigned int > m_numPoints
Define number of points per direction.
LibUtilities::NekFactory< std::string, FieldIO, LibUtilities::CommSharedPtr, bool > FieldIOFactory
Datatype of the NekFactory used to instantiate classes.
std::vector< unsigned int > m_homogeneousYIDs
IDs corresponding to y-direction homogeneous IDs.
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...
std::vector< NekDouble > m_homogeneousLengths
Spatial lengths of each homogeneous direction.
FieldDefinitions()
Default constructor.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
FieldDefinitions(ShapeType shapeType, const std::vector< unsigned int > &elementIDs, const std::vector< LibUtilities::BasisType > &basis, bool uniOrder, const std::vector< unsigned int > &numModes, const std::vector< std::string > &fields, int NumHomoDir=0, const std::vector< NekDouble > &HomoLengths=NullNekDoubleVector, bool homoStrips=false, const std::vector< unsigned int > &HomoSIDs=NullUnsignedIntVector, const std::vector< unsigned int > &HomoZIDs=NullUnsignedIntVector, const std::vector< unsigned int > &HomoYIDs=NullUnsignedIntVector, const std::vector< LibUtilities::PointsType > &points=NullPointsTypeVector, bool pointsDef=false, const std::vector< unsigned int > &numPoints=NullUnsignedIntVector, bool numPointsDef=false)
Simple constructor to allocate all internal properties.
ShapeType m_shapeType
Shape type of this field data.
virtual void SetAttr(const std::string &key, const std::string &val)=0
Set an attribute on the node.
std::vector< unsigned int > m_homogeneousZIDs
IDs corresponding to z-direction homogeneous IDs.
bool m_uniOrder
Define order of the element group.
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata=NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const Array< OneD, int > &ElementIDs=NullInt1DArray)
Read field information from the file infilename.
std::map< std::string, std::string > FieldMetaDataMap
bool m_numPointsDef
Boolean determining whether number of points has been defined.
std::vector< unsigned int > m_homogeneousSIDs
IDs corresponding to homogeneous strip IDs.
std::vector< LibUtilities::BasisType > m_basis
Vector of basis types for each of the coordinate directions.
static std::vector< NekDouble > NullNekDoubleVector
Base class for writing hierarchical data (XML or HDF5).
std::shared_ptr< TagWriter > TagWriterSharedPtr
bool m_sharedFilesystem
Boolean dictating whether we are on a shared filesystem.
Metadata that describes the storage properties of field output.
std::vector< unsigned int > m_numModes
Define number of modes per direction.
std::shared_ptr< DataSource > DataSourceSharedPtr
#define LIB_UTILITIES_EXPORT
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
static std::vector< unsigned int > NullUnsignedIntVector
DataSourceSharedPtr ImportFieldMetaData(const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
Import the metadata from a field file.
virtual std::shared_ptr< TagWriter > AddChild(const std::string &name)=0
Create a child node.
std::vector< unsigned int > m_elementIDs
Element IDs of the field data.
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 ...
std::vector< std::string > m_fields
Vector of field names that this data encapsulates.
LibUtilities::CommSharedPtr m_comm
Communicator to use when writing parallel format.
virtual std::string GetFileEnding() const
Helper function that determines default file extension.
static std::vector< LibUtilities::PointsType > NullPointsTypeVector
bool m_homoStrips
Boolean determining whether homogeneous strips are used.
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
std::vector< LibUtilities::PointsType > m_points
Define the type of points per direction.
Class for operating on Nektar++ input/output files.
bool m_pointsDef
Boolean determining whether points have been defined in output.
int m_numHomogeneousDir
Number of homogeneous directions, in the range .
static Array< OneD, int > NullInt1DArray
std::shared_ptr< FieldIO > FieldIOSharedPtr
static FieldMetaDataMap NullFieldMetaDataMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const bool backup=false)
Write out the field information to the file outFile.
Provides a generic Factory class.