Nektar++
|
#include <FieldIOXml.h>
Public Member Functions | |
FieldIOXml (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) | |
Default constructor. More... | |
virtual | ~FieldIOXml () |
void | ImportFieldDefs (DataSourceSharedPtr dataSource, std::vector< FieldDefinitionsSharedPtr > &fielddefs, bool expChild) |
Import field definitions from the target file. More... | |
void | ImportFieldData (DataSourceSharedPtr dataSource, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata) |
Import field data from a target file. More... | |
void | WriteMultiFldFileIDs (const std::string &outfile, const std::vector< std::string > fileNames, std::vector< std::vector< unsigned int > > &elementList, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap) |
Write out a file containing element ID to partition mapping. More... | |
void | SetUpFieldMetaData (const std::string &outname, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, const FieldMetaDataMap &fieldmetadatamap) |
Set up field meta data map. More... | |
void | ImportMultiFldFileIDs (const std::string &inFile, std::vector< std::string > &fileNames, std::vector< std::vector< unsigned int > > &elementList, FieldMetaDataMap &fieldmetadatamap) |
Read file containing element ID to partition mapping. More... | |
void | v_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) |
Import an XML format file. More... | |
virtual const std::string & | GetClassName () const |
Returns the class name. More... | |
Public Member Functions inherited from Nektar::LibUtilities::FieldIO | |
FieldIO (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) | |
Constructor for FieldIO base class. More... | |
virtual | ~FieldIO () |
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 . More... | |
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 . More... | |
DataSourceSharedPtr | ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) |
Import the metadata from a field file. More... | |
Static Public Member Functions | |
static FieldIOSharedPtr | create (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) |
Creates an instance of this class. More... | |
Static Public Member Functions inherited from Nektar::LibUtilities::FieldIO | |
static const std::string | GetFileType (const std::string &filename, CommSharedPtr comm) |
Determine file type of given input file. More... | |
static boost::shared_ptr< FieldIO > | CreateDefault (const LibUtilities::SessionReaderSharedPtr session) |
Returns an object for the default FieldIO method. More... | |
static boost::shared_ptr< FieldIO > | CreateForFile (const LibUtilities::SessionReaderSharedPtr session, const std::string &filename) |
Construct a FieldIO object for a given input filename. More... | |
Static Public Attributes | |
static std::string | className |
Name of class. More... | |
Private Member Functions | |
virtual void | v_Write (const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const bool backup=false) |
Write an XML file to outFile given the field definitions fielddefs , field data fielddata and metadata fieldmetadatamap . More... | |
virtual DataSourceSharedPtr | v_ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) |
Import field metadata from filename and return the data source which wraps filename . More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Nektar::LibUtilities::FieldIO | |
void | AddInfoTag (TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap) |
Add provenance information to the field metadata map. More... | |
int | CheckFieldDefinition (const FieldDefinitionsSharedPtr &fielddefs) |
Check field definitions for correctness and return storage size. More... | |
virtual std::string | GetFileEnding () const |
Helper function that determines default file extension. More... | |
std::string | SetUpOutput (const std::string outname, bool perRank, bool backup=false) |
Set up the filesystem ready for output. More... | |
Protected Attributes inherited from Nektar::LibUtilities::FieldIO | |
LibUtilities::CommSharedPtr | m_comm |
Communicator to use when writing parallel format. More... | |
bool | m_sharedFilesystem |
Boolean dictating whether we are on a shared filesystem. More... | |
Definition at line 177 of file FieldIOXml.h.
Nektar::LibUtilities::FieldIOXml::FieldIOXml | ( | LibUtilities::CommSharedPtr | pComm, |
bool | sharedFilesystem | ||
) |
Default constructor.
pComm | Communicator. |
sharedFilesystem | True if the underlying filesystem is shared by the compute nodes. |
Definition at line 62 of file FieldIOXml.cpp.
|
inlinevirtual |
Definition at line 195 of file FieldIOXml.h.
|
inlinestatic |
Creates an instance of this class.
Definition at line 181 of file FieldIOXml.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
|
inlinevirtual |
Returns the class name.
Implements Nektar::LibUtilities::FieldIO.
Definition at line 235 of file FieldIOXml.h.
References className.
void Nektar::LibUtilities::FieldIOXml::ImportFieldData | ( | DataSourceSharedPtr | dataSource, |
const std::vector< FieldDefinitionsSharedPtr > & | fielddefs, | ||
std::vector< std::vector< NekDouble > > & | fielddata | ||
) |
Import field data from a target file.
dataSource | Target XML file |
fielddefs | Field definitions for file |
fielddata | On return, contains field data for each field. |
Definition at line 1101 of file FieldIOXml.cpp.
References ASSERTL0, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), Nektar::LibUtilities::XmlDataSource::Get(), Nektar::LibUtilities::CompressData::GetCompressString(), WARNINGL0, and Nektar::LibUtilities::CompressData::ZlibDecodeFromBase64Str().
Referenced by v_Import().
void Nektar::LibUtilities::FieldIOXml::ImportFieldDefs | ( | DataSourceSharedPtr | dataSource, |
std::vector< FieldDefinitionsSharedPtr > & | fielddefs, | ||
bool | expChild | ||
) |
Import field definitions from the target file.
dataSource | Target XML file |
fielddefs | Output vector that will contain read field definitions. |
expChild | Determines if the field definitions are defined by <EXPANSIONS> or in <NEKTAR> . |
Definition at line 762 of file FieldIOXml.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL1, Nektar::LibUtilities::BasisTypeMap, Nektar::ParseUtils::GenerateOrderedStringVector(), Nektar::ParseUtils::GenerateOrderedVector(), Nektar::ParseUtils::GenerateSeqVector(), Nektar::ParseUtils::GenerateUnOrderedVector(), Nektar::LibUtilities::XmlDataSource::Get(), Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::LibUtilities::kPointsTypeStr, Nektar::LibUtilities::ShapeTypeMap, Nektar::LibUtilities::SIZE_BasisType, Nektar::LibUtilities::SIZE_PointsType, Nektar::LibUtilities::SIZE_ShapeType, and WARNINGL0.
Referenced by v_Import().
void Nektar::LibUtilities::FieldIOXml::ImportMultiFldFileIDs | ( | const std::string & | inFile, |
std::vector< std::string > & | fileNames, | ||
std::vector< std::vector< unsigned int > > & | elementList, | ||
FieldMetaDataMap & | fieldmetadatamap | ||
) |
Read file containing element ID to partition mapping.
This function reads an XML file (usually called Info.xml
) that contains the element IDs that are contained within each partition, as well as the field metadata map.
inFile | Input multi-field file name. |
fileNames | List of partition filenames. |
elementList | Vector of element IDs that lie on each process. |
fieldmetadatamap | Field metadata map that is read from inFile . |
Definition at line 428 of file FieldIOXml.cpp.
References ASSERTL0, and Nektar::ParseUtils::GenerateSeqVector().
Referenced by Nektar::LibUtilities::PtsIO::Import(), and v_Import().
void Nektar::LibUtilities::FieldIOXml::SetUpFieldMetaData | ( | const std::string & | outname, |
const std::vector< FieldDefinitionsSharedPtr > & | fielddefs, | ||
const FieldMetaDataMap & | fieldmetadatamap | ||
) |
Set up field meta data map.
This routine sets up the necessary information for the field metadata map before calling FieldIOXml::WriteMultiFldFileIDs, which involves each process sending its element ID list to the root processor. The root processor writes the Info.xml
file.
outname | Output directory. |
fielddefs | Field definitions, needed to grab element IDs. |
fieldmetadatamap | Field metadata map that is also written to the Info.xml file. |
Definition at line 690 of file FieldIOXml.cpp.
References ASSERTL0, CellMLToNektar.pycml::format, Nektar::LibUtilities::FieldIO::GetFileEnding(), Nektar::LibUtilities::FieldIO::m_comm, Nektar::LibUtilities::PortablePath(), Nektar::LibUtilities::ReduceMax, and WriteMultiFldFileIDs().
Referenced by v_Write().
|
virtual |
Import an XML format file.
finfilename | Input filename |
fielddefs | Field definitions of resulting field |
fielddata | Field data of resulting field |
fieldinfomap | Field metadata of resulting field |
ElementIDs | If specified, contains the list of element IDs on this rank. The resulting field definitions will only contain data for the element IDs specified in this array. |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 502 of file FieldIOXml.cpp.
References Nektar::LibUtilities::XmlDataSource::create(), ImportFieldData(), ImportFieldDefs(), Nektar::LibUtilities::FieldIO::ImportFieldMetaData(), ImportMultiFldFileIDs(), Nektar::iterator, Nektar::NullInt1DArray, Nektar::LibUtilities::NullVectorNekDoubleVector, and Nektar::LibUtilities::PortablePath().
|
privatevirtual |
Import field metadata from filename
and return the data source which wraps filename
.
filename | Input filename. |
fieldmetadatamap | Resulting field metadata from dataSource . |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 605 of file FieldIOXml.cpp.
References ASSERTL0, Nektar::LibUtilities::XmlDataSource::create(), and Nektar::LibUtilities::XmlDataSource::Get().
|
privatevirtual |
Write an XML file to outFile
given the field definitions fielddefs
, field data fielddata
and metadata fieldmetadatamap
.
The writing strategy is as follows:
Info.xml
file containing the field metadata and an index that describes which elements lie in which XML file.outFile | Output filename. |
fielddefs | Input field definitions. |
fielddata | Input field data. |
fieldmetadatamap | Field metadata. |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 87 of file FieldIOXml.cpp.
References Nektar::LibUtilities::FieldIO::AddInfoTag(), ASSERTL0, ASSERTL1, Nektar::LibUtilities::BasisTypeMap, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), Nektar::ParseUtils::GenerateSeqString(), Nektar::LibUtilities::CompressData::GetBitSizeStr(), Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::LibUtilities::FieldIO::m_comm, SetUpFieldMetaData(), Nektar::LibUtilities::FieldIO::SetUpOutput(), Nektar::LibUtilities::ShapeTypeMap, and Nektar::LibUtilities::CompressData::ZlibEncodeToBase64Str().
void Nektar::LibUtilities::FieldIOXml::WriteMultiFldFileIDs | ( | const std::string & | outFile, |
const std::vector< std::string > | fileNames, | ||
std::vector< std::vector< unsigned int > > & | elementList, | ||
const FieldMetaDataMap & | fieldmetadatamap = NullFieldMetaDataMap |
||
) |
Write out a file containing element ID to partition mapping.
This function writes out an XML file (usually called Info.xml
) that contains the element IDs that are contained within each partition, as well as the field metadata map.
outFile | Output multi-field file name. |
fileNames | List of partition filenames. |
elementList | Vector of element IDs that lie on each process. |
fieldmetadatamap | Field metadata map that is written into outFile . |
Definition at line 380 of file FieldIOXml.cpp.
References Nektar::LibUtilities::FieldIO::AddInfoTag(), ASSERTL0, and Nektar::ParseUtils::GenerateSeqString().
Referenced by Nektar::FieldUtils::OutputInfo::Process(), Nektar::LibUtilities::PtsIO::SetUpFieldMetaData(), and SetUpFieldMetaData().
|
static |
Name of class.
Definition at line 189 of file FieldIOXml.h.
Referenced by GetClassName().