36 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIO_H
37 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIO_H
48 #include <boost/archive/iterators/base64_from_binary.hpp>
49 #include <boost/archive/iterators/binary_from_base64.hpp>
50 #include <boost/archive/iterators/transform_width.hpp>
51 #include <boost/iostreams/copy.hpp>
52 #include <boost/iostreams/filter/zlib.hpp>
53 #include <boost/iostreams/filtering_stream.hpp>
54 #include <boost/assign/list_of.hpp>
58 namespace LibUtilities
72 const std::vector<unsigned int> &elementIDs,
73 const std::vector<LibUtilities::BasisType> &basis,
77 const std::vector<unsigned int> &numModes,
78 const std::vector<std::string> &fields,
80 const std::vector<NekDouble> &HomoLengths =
82 const std::vector<unsigned int> &HomoZIDs =
83 NullUnsignedIntVector,
84 const std::vector<unsigned int> &HomoYIDs =
85 NullUnsignedIntVector,
86 const std::vector<LibUtilities::PointsType> &points =
88 bool pointsDef =
false,
89 const std::vector<unsigned int> &numPoints =
90 NullUnsignedIntVector,
91 bool numPointsDef =
false):
136 const std::string &outFile,
137 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
138 std::vector<std::vector<NekDouble> > &fielddata,
139 const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
143 const std::string& infilename,
144 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
145 std::vector<std::vector<NekDouble> > &fielddata = NullVectorNekDoubleVector,
146 FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
160 const std::string &outFile,
161 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
162 std::vector<std::vector<NekDouble> > &fielddata,
163 const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
167 const std::string& infilename,
168 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
169 std::vector<std::vector<NekDouble> > &fielddata = NullVectorNekDoubleVector,
170 FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap,
175 std::string filename,
176 FieldMetaDataMap &fieldmetadatamap);
181 FieldMetaDataMap &fieldmetadatamap);
186 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
192 const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
193 std::vector<std::vector<NekDouble> > &fielddata);
196 const std::string &outfile,
197 const std::vector<std::string> fileNames,
198 std::vector<std::vector<unsigned int> > &elementList,
199 const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
208 const FieldMetaDataMap &fieldmetadatamap);
211 const std::vector<unsigned int> &elmtids,
212 std::string &idString);
215 const std::string outname,
216 const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
217 const FieldMetaDataMap &fieldmetadatamap);
220 const std::string &inFile,
221 std::vector<std::string> &fileNames,
222 std::vector<std::vector<unsigned int> > &elementList,
223 FieldMetaDataMap &fieldmetadatamap);
226 const FieldDefinitionsSharedPtr &fielddefs);
229 std::vector<NekDouble>& in,
233 std::vector<NekDouble>& out);
std::vector< unsigned int > m_numPoints
void ImportFieldDefs(TiXmlDocument &doc, std::vector< FieldDefinitionsSharedPtr > &fielddefs, bool expChild)
Imports the definition of the fields.
std::vector< unsigned int > m_homogeneousYIDs
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
void ImportFieldData(TiXmlDocument &doc, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata)
Imports the data fileds.
std::vector< NekDouble > m_homogeneousLengths
std::string SetUpOutput(const std::string outname, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, const FieldMetaDataMap &fieldmetadatamap)
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)
Imports an FLD file.
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
void ImportMultiFldFileIDs(const std::string &inFile, std::vector< std::string > &fileNames, std::vector< std::vector< unsigned int > > &elementList, FieldMetaDataMap &fieldmetadatamap)
FieldIO(LibUtilities::CommSharedPtr pComm)
Constructor.
std::vector< unsigned int > m_homogeneousZIDs
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, 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)
bool m_uniOrder
Define order of the element group.
std::map< std::string, std::string > FieldMetaDataMap
int CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
void GenerateSeqString(const std::vector< unsigned int > &elmtids, std::string &idString)
std::vector< LibUtilities::BasisType > m_basis
static std::vector< NekDouble > NullNekDoubleVector
std::vector< unsigned int > m_numModes
Define number of modes per direction.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
void AddInfoTag(TiXmlElement *root, const FieldMetaDataMap &fieldmetadatamap)
add information about provenance and fieldmetadata
int Inflate(string &in, std::vector< NekDouble > &out)
#define LIB_UTILITIES_EXPORT
static std::vector< unsigned int > NullUnsignedIntVector
boost::shared_ptr< FieldIO > FieldIOSharedPtr
std::vector< unsigned int > m_elementIDs
std::vector< std::string > m_fields
LibUtilities::CommSharedPtr m_comm
Communicator to use when writing parallel format.
static std::vector< LibUtilities::PointsType > NullPointsTypeVector
void WriteMultiFldFileIDs(const std::string &outfile, const std::vector< std::string > fileNames, std::vector< std::vector< unsigned int > > &elementList, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap)
std::vector< LibUtilities::PointsType > m_points
Define the type of points per direction.
Class for operating on FLD files.
int Deflate(std::vector< NekDouble > &in, string &out)
void ImportFieldMetaData(std::string filename, FieldMetaDataMap &fieldmetadatamap)
Imports the definition of the meta data.
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap)
Write data in FLD format.
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap)
Write a field file in serial only.
static Array< OneD, int > NullInt1DArray
static FieldMetaDataMap NullFieldMetaDataMap