|
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... | |
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... | |
| const std::string & | GetClassName () const |
| std::string | GetFileEnding () const |
| Helper function that determines default file extension. 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 std::shared_ptr< FieldIO > | CreateDefault (const LibUtilities::SessionReaderSharedPtr session) |
| Returns an object for the default FieldIO method. More... | |
| static std::shared_ptr< FieldIO > | CreateForFile (const LibUtilities::SessionReaderSharedPtr session, const std::string &filename) |
| Construct a FieldIO object for a given input filename. More... | |
| static void | AddInfoTag (TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap) |
| Add provenance information to the field metadata map. More... | |
Static Public Attributes | |
| static std::string | className |
| Name of class. More... | |
Protected 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) override |
Write an XML file to outFile given the field definitions fielddefs, field data fielddata and metadata fieldmetadatamap. 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) override |
| Import an XML format file. More... | |
| virtual DataSourceSharedPtr | v_ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) override |
Import field metadata from filename and return the data source which wraps filename. More... | |
| virtual const std::string & | v_GetClassName () const override |
| Returns the class name. More... | |
Protected Member Functions inherited from Nektar::LibUtilities::FieldIO | |
| int | CheckFieldDefinition (const FieldDefinitionsSharedPtr &fielddefs) |
| Check field definitions for correctness and return storage size. More... | |
| std::string | SetUpOutput (const std::string outname, bool perRank, bool backup=false) |
| Set up the filesystem ready for output. More... | |
| virtual std::string | v_GetFileEnding () const |
| bool | ParallelInTime () |
| Check if solver use Parallel-in-Time. More... | |
Additional Inherited Members | |
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 207 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 224 of file FieldIOXml.h.
|
inlinestatic |
Creates an instance of this class.
Definition at line 211 of file FieldIOXml.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
| 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 1086 of file FieldIOXml.cpp.
References ASSERTL0, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), 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 771 of file FieldIOXml.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::BasisTypeMap, Nektar::ErrorUtil::ewarning, Nektar::ParseUtils::GenerateSeqVector(), Nektar::ParseUtils::GenerateVector(), Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::LibUtilities::kPointsTypeStr, CG_Iterations::loc, NEKERROR, 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 423 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 695 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().
|
overrideprotectedvirtual |
Returns the class name.
Implements Nektar::LibUtilities::FieldIO.
Definition at line 677 of file FieldIOXml.cpp.
References className.
|
overrideprotectedvirtual |
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 496 of file FieldIOXml.cpp.
References Nektar::LibUtilities::XmlDataSource::create(), ImportFieldData(), ImportFieldDefs(), Nektar::LibUtilities::FieldIO::ImportFieldMetaData(), ImportMultiFldFileIDs(), Nektar::NullInt1DArray, Nektar::LibUtilities::NullVectorNekDoubleVector, and Nektar::LibUtilities::PortablePath().
|
overrideprotectedvirtual |
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 597 of file FieldIOXml.cpp.
References ASSERTL0, Nektar::LibUtilities::XmlDataSource::create(), Nektar::ErrorUtil::efatal, and NEKERROR.
|
overrideprotectedvirtual |
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 376 of file FieldIOXml.cpp.
References Nektar::LibUtilities::FieldIO::AddInfoTag(), ASSERTL0, and Nektar::ParseUtils::GenerateSeqString().
Referenced by SetUpFieldMetaData(), and Nektar::LibUtilities::PtsIO::SetUpFieldMetaData().
|
static |
Name of class.
Definition at line 219 of file FieldIOXml.h.
Referenced by v_GetClassName().