Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::LibUtilities::FieldIOXml Class Reference

#include <FieldIOXml.h>

Inheritance diagram for Nektar::LibUtilities::FieldIOXml:
[legend]

Public Member Functions

 FieldIOXml (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
 Default constructor.
 
 ~FieldIOXml () override
 
void ImportFieldDefs (DataSourceSharedPtr dataSource, std::vector< FieldDefinitionsSharedPtr > &fielddefs, bool expChild)
 Import field definitions from the target file.
 
void ImportFieldData (DataSourceSharedPtr dataSource, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata)
 Import field data from a target file.
 
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.
 
void SetUpFieldMetaData (const std::string &outname, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, const FieldMetaDataMap &fieldmetadatamap)
 Set up field meta data map.
 
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.
 
- Public Member Functions inherited from Nektar::LibUtilities::FieldIO
 FieldIO (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
 Constructor for FieldIO base class.
 
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.
 
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.
 
DataSourceSharedPtr ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
 Import the metadata from a field file.
 
const std::string & GetClassName () const
 
std::string GetFileEnding () const
 Helper function that determines default file extension.
 

Static Public Member Functions

static FieldIOSharedPtr create (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
 Creates an instance of this class.
 
- 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.
 
static std::shared_ptr< FieldIO > CreateDefault (const LibUtilities::SessionReaderSharedPtr session)
 Returns an object for the default FieldIO method.
 
static std::shared_ptr< FieldIO > CreateForFile (const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
 Construct a FieldIO object for a given input filename.
 
static void AddInfoTag (TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap)
 Add provenance information to the field metadata map.
 

Static Public Attributes

static std::string className
 Name of class.
 

Protected Member Functions

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.
 
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.
 
DataSourceSharedPtr v_ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) override
 Import field metadata from filename and return the data source which wraps filename.
 
const std::string & v_GetClassName () const override
 Returns the class name.
 
- Protected Member Functions inherited from Nektar::LibUtilities::FieldIO
int CheckFieldDefinition (const FieldDefinitionsSharedPtr &fielddefs)
 Check field definitions for correctness and return storage size.
 
std::vector< unsigned int > GetNumberOfCoeffsPerElement (const FieldDefinitionsSharedPtr &fielddefs)
 Compute number of data points needed to store expansion inside each element.
 
std::string SetUpOutput (const std::string outname, bool perRank, bool backup=false)
 Set up the filesystem ready for output.
 
virtual std::string v_GetFileEnding () const
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::LibUtilities::FieldIO
LibUtilities::CommSharedPtr m_comm
 Communicator to use when writing parallel format.
 
bool m_sharedFilesystem
 Boolean dictating whether we are on a shared filesystem.
 

Detailed Description

Definition at line 204 of file FieldIOXml.h.

Constructor & Destructor Documentation

◆ FieldIOXml()

Nektar::LibUtilities::FieldIOXml::FieldIOXml ( LibUtilities::CommSharedPtr  pComm,
bool  sharedFilesystem 
)

Default constructor.

Parameters
pCommCommunicator.
sharedFilesystemTrue if the underlying filesystem is shared by the compute nodes.

Definition at line 59 of file FieldIOXml.cpp.

60 : FieldIO(pComm, sharedFilesystem)
61{
62}
FieldIO(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Constructor for FieldIO base class.
Definition FieldIO.cpp:320

◆ ~FieldIOXml()

Nektar::LibUtilities::FieldIOXml::~FieldIOXml ( )
inlineoverride

Definition at line 221 of file FieldIOXml.h.

222 {
223 }

Member Function Documentation

◆ create()

static FieldIOSharedPtr Nektar::LibUtilities::FieldIOXml::create ( LibUtilities::CommSharedPtr  pComm,
bool  sharedFilesystem 
)
inlinestatic

Creates an instance of this class.

Definition at line 208 of file FieldIOXml.h.

210 {
212 sharedFilesystem);
213 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ ImportFieldData()

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.

Parameters
dataSourceTarget XML file
fielddefsField definitions for file
fielddataOn return, contains field data for each field.

Definition at line 1045 of file FieldIOXml.cpp.

1049{
1050 int cntdumps = 0;
1052 std::static_pointer_cast<XmlDataSource>(dataSource);
1053
1054 TiXmlElement *master =
1055 nullptr; // Master tag within which all data is contained.
1056
1057 master = xml->Get().FirstChildElement("NEKTAR");
1058 ASSERTL0(master, "Unable to find NEKTAR tag in file.");
1059
1060 // Loop through all nektar tags, finding all of the element tags.
1061 while (master)
1062 {
1063 TiXmlElement *element = master->FirstChildElement("ELEMENTS");
1064 ASSERTL0(element, "Unable to find ELEMENTS tag within nektar tag.");
1065 while (element)
1066 {
1067 // Extract the body, which is the "data".
1068 TiXmlNode *elementChild = element->FirstChild();
1069 ASSERTL0(elementChild,
1070 "Unable to extract the data from the element tag.");
1071 std::string elementStr;
1072 while (elementChild)
1073 {
1074 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1075 {
1076 elementStr += elementChild->ToText()->ValueStr();
1077 }
1078 elementChild = elementChild->NextSibling();
1079 }
1080
1081 std::vector<NekDouble> elementFieldData;
1082
1083 // Convert from base64 to binary.
1084 const char *CompressStr = element->Attribute("COMPRESSED");
1085 if (CompressStr)
1086 {
1088 CompressStr, CompressData::GetCompressString()),
1089 "Compressed formats do not match. "
1090 "Expected: " +
1091 CompressData::GetCompressString() + " but got " +
1092 std::string(CompressStr));
1093 }
1094
1096 elementStr, elementFieldData),
1097 "Failed to decompress field data.");
1098 fielddata.push_back(elementFieldData);
1099
1100 int datasize = CheckFieldDefinition(fielddefs[cntdumps]);
1101 ASSERTL0(
1102 fielddata[cntdumps].size() ==
1103 datasize * fielddefs[cntdumps]->m_fields.size(),
1104 "Input data is not the same length as header infoarmation");
1105
1106 cntdumps++;
1107
1108 element = element->NextSiblingElement("ELEMENTS");
1109 }
1110 master = master->NextSiblingElement("NEKTAR");
1111 }
1112}
#define ASSERTL0(condition, msg)
#define WARNINGL0(condition, msg)
int CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
Check field definitions for correctness and return storage size.
Definition FieldIO.cpp:689
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
std::shared_ptr< XmlDataSource > XmlDataSourceSharedPtr
Definition FieldIOXml.h:109
bool IEquals(std::string_view a, std::string_view b)

References ASSERTL0, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::StringUtils::IEquals(), WARNINGL0, and Nektar::LibUtilities::CompressData::ZlibDecodeFromBase64Str().

Referenced by v_Import().

◆ ImportFieldDefs()

void Nektar::LibUtilities::FieldIOXml::ImportFieldDefs ( DataSourceSharedPtr  dataSource,
std::vector< FieldDefinitionsSharedPtr > &  fielddefs,
bool  expChild 
)

Import field definitions from the target file.

Parameters
dataSourceTarget XML file
fielddefsOutput vector that will contain read field definitions.
expChildDetermines if the field definitions are defined by <EXPANSIONS> or in <NEKTAR>.

Definition at line 729 of file FieldIOXml.cpp.

732{
734 std::static_pointer_cast<XmlDataSource>(dataSource);
735 TiXmlElement *master =
736 nullptr; // Master tag within which all data is contained.
737
738 master = xml->Get().FirstChildElement("NEKTAR");
739 ASSERTL0(master, "Unable to find NEKTAR tag in file.");
740 std::string strLoop = "NEKTAR";
741 TiXmlElement *loopXml = master;
742
743 TiXmlElement *expansionTypes;
744 if (expChild)
745 {
746 expansionTypes = master->FirstChildElement("EXPANSIONS");
747 ASSERTL0(expansionTypes, "Unable to find EXPANSIONS tag in file.");
748 loopXml = expansionTypes;
749 strLoop = "EXPANSIONS";
750 }
751
752 // Loop through all nektar tags, finding all of the element tags.
753 while (loopXml)
754 {
755 TiXmlElement *element = loopXml->FirstChildElement("ELEMENTS");
756
757 while (element)
758 {
759 // Extract the attributes.
760 std::string idString;
761 std::string shapeString;
762 std::string basisString;
763 std::string homoLengthsString;
764 std::string homoSIDsString;
765 std::string homoZIDsString;
766 std::string homoYIDsString;
767 std::string numModesString;
768 std::string numPointsString;
769 std::string fieldsString;
770 std::string pointsString;
771 bool pointDef = false;
772 bool numPointDef = false;
773 TiXmlAttribute *attr = element->FirstAttribute();
774 while (attr)
775 {
776 std::string attrName(attr->Name());
777 if (attrName == "FIELDS")
778 {
779 fieldsString.insert(0, attr->Value());
780 }
781 else if (attrName == "SHAPE")
782 {
783 shapeString.insert(0, attr->Value());
784 }
785 else if (attrName == "BASIS")
786 {
787 basisString.insert(0, attr->Value());
788 }
789 else if (attrName == "HOMOGENEOUSLENGTHS")
790 {
791 homoLengthsString.insert(0, attr->Value());
792 }
793 else if (attrName == "HOMOGENEOUSSIDS")
794 {
795 homoSIDsString.insert(0, attr->Value());
796 }
797 else if (attrName == "HOMOGENEOUSZIDS")
798 {
799 homoZIDsString.insert(0, attr->Value());
800 }
801 else if (attrName == "HOMOGENEOUSYIDS")
802 {
803 homoYIDsString.insert(0, attr->Value());
804 }
805 else if (attrName == "NUMMODESPERDIR")
806 {
807 numModesString.insert(0, attr->Value());
808 }
809 else if (attrName == "ID")
810 {
811 idString.insert(0, attr->Value());
812 }
813 else if (attrName == "POINTSTYPE")
814 {
815 pointsString.insert(0, attr->Value());
816 pointDef = true;
817 }
818 else if (attrName == "NUMPOINTSPERDIR")
819 {
820 numPointsString.insert(0, attr->Value());
821 numPointDef = true;
822 }
823 else if (attrName == "COMPRESSED")
824 {
825 WARNINGL0(
826 StringUtils::IEquals(attr->Value(),
828 "Compressed formats do not "
829 "match. Expected: " +
830 CompressData::GetCompressString() + " but got " +
831 std::string(attr->Value()));
832 }
833 else if (attrName == "BITSIZE")
834 {
835 // This information is for future compatibility
836 // issues, for example in case we end up using a 128
837 // bit machine. Currently just do nothing.
838 }
839 else
840 {
841 std::string errstr("Unknown attribute: ");
842 errstr += attrName;
843 NEKERROR(ErrorUtil::ewarning, errstr.c_str());
844 }
845
846 // Get the next attribute.
847 attr = attr->Next();
848 }
849
850 // Check to see if using strips formulation
851 bool strips = false;
852 if (shapeString.find("Strips") != std::string::npos)
853 {
854 strips = true;
855 }
856
857 // Check to see if homogeneous expansion and if so
858 // strip down the shapeString definition
859 int numHomoDir = 0;
860 size_t loc;
861 //---> This finds the first location of 'n'!
862 if ((loc = shapeString.find_first_of("-")) != std::string::npos)
863 {
864 if (shapeString.find("Exp1D") != std::string::npos)
865 {
866 numHomoDir = 1;
867 }
868 else // HomogeneousExp1D
869 {
870 numHomoDir = 2;
871 }
872
873 shapeString.erase(loc, shapeString.length());
874 }
875
876 // Reconstruct the fielddefs.
877 std::vector<unsigned int> elementIds;
878 {
879 bool valid =
880 ParseUtils::GenerateSeqVector(idString, elementIds);
881 ASSERTL0(valid, "Unable to correctly parse the element ids.");
882 }
883
884 // Get the geometrical shape
885 ShapeType shape = (ShapeType)0;
886 bool valid = false;
887 for (unsigned int j = 0; j < SIZE_ShapeType; j++)
888 {
889 if (ShapeTypeMap[j] == shapeString)
890 {
891 shape = (ShapeType)j;
892 valid = true;
893 break;
894 }
895 }
896
897 ASSERTL0(valid,
898 std::string("Unable to correctly parse the shape type: ")
899 .append(shapeString)
900 .c_str());
901
902 // Get the basis
903 std::vector<std::string> basisStrings;
904 std::vector<BasisType> basis;
905 valid = ParseUtils::GenerateVector(basisString, basisStrings);
906 ASSERTL0(valid, "Unable to correctly parse the basis types.");
907 for (std::vector<std::string>::size_type i = 0;
908 i < basisStrings.size(); i++)
909 {
910 valid = false;
911 for (unsigned int j = 0; j < SIZE_BasisType; j++)
912 {
913 if (BasisTypeMap[j] == basisStrings[i])
914 {
915 basis.push_back((BasisType)j);
916 valid = true;
917 break;
918 }
919 }
920 ASSERTL0(
921 valid,
922 std::string("Unable to correctly parse the basis type: ")
923 .append(basisStrings[i])
924 .c_str());
925 }
926
927 // Get homoLengths
928 std::vector<NekDouble> homoLengths;
929 if (numHomoDir)
930 {
931 valid =
932 ParseUtils::GenerateVector(homoLengthsString, homoLengths);
933 ASSERTL0(valid, "Unable to correctly parse the number of "
934 "homogeneous lengths.");
935 }
936
937 // Get Homogeneous strips IDs
938 std::vector<unsigned int> homoSIDs;
939 if (strips)
940 {
941 valid = ParseUtils::GenerateVector(homoSIDsString, homoSIDs);
942 ASSERTL0(valid,
943 "Unable to correctly parse homogeneous strips IDs.");
944 }
945
946 // Get Homogeneous points IDs
947 std::vector<unsigned int> homoZIDs;
948 std::vector<unsigned int> homoYIDs;
949
950 if (numHomoDir == 1)
951 {
952 valid = ParseUtils::GenerateSeqVector(homoZIDsString, homoZIDs);
953 ASSERTL0(valid,
954 "Unable to correctly parse homogeneous planes IDs.");
955 }
956
957 if (numHomoDir == 2)
958 {
959 valid = ParseUtils::GenerateSeqVector(homoZIDsString, homoZIDs);
960 ASSERTL0(valid, "Unable to correctly parse homogeneous lines "
961 "IDs in z-direction.");
962 valid = ParseUtils::GenerateSeqVector(homoYIDsString, homoYIDs);
963 ASSERTL0(valid, "Unable to correctly parse homogeneous lines "
964 "IDs in y-direction.");
965 }
966
967 // Get points type
968 std::vector<PointsType> points;
969
970 if (pointDef)
971 {
972 std::vector<std::string> pointsStrings;
973 valid = ParseUtils::GenerateVector(pointsString, pointsStrings);
974 ASSERTL0(valid, "Unable to correctly parse the points types.");
975 for (std::vector<std::string>::size_type i = 0;
976 i < pointsStrings.size(); i++)
977 {
978 valid = false;
979 for (unsigned int j = 0; j < SIZE_PointsType; j++)
980 {
981 if (kPointsTypeStr[j] == pointsStrings[i])
982 {
983 points.push_back((PointsType)j);
984 valid = true;
985 break;
986 }
987 }
988
989 ASSERTL0(valid,
990 std::string(
991 "Unable to correctly parse the points type: ")
992 .append(pointsStrings[i])
993 .c_str());
994 }
995 }
996
997 // Get numModes
998 std::vector<unsigned int> numModes;
999 bool UniOrder = false;
1000
1001 if (strstr(numModesString.c_str(), "UNIORDER:"))
1002 {
1003 UniOrder = true;
1004 }
1005
1006 valid =
1007 ParseUtils::GenerateVector(numModesString.substr(9), numModes);
1008 ASSERTL0(valid, "Unable to correctly parse the number of modes.");
1009
1010 // Get numPoints
1011 std::vector<unsigned int> numPoints;
1012 if (numPointDef)
1013 {
1014 valid = ParseUtils::GenerateVector(numPointsString, numPoints);
1015 ASSERTL0(valid,
1016 "Unable to correctly parse the number of points.");
1017 }
1018
1019 // Get fields names
1020 std::vector<std::string> Fields;
1021 valid = ParseUtils::GenerateVector(fieldsString, Fields);
1022 ASSERTL0(valid, "Unable to correctly parse the number of fields.");
1023
1024 FieldDefinitionsSharedPtr fielddef =
1026 shape, elementIds, basis, UniOrder, numModes, Fields,
1027 numHomoDir, homoLengths, strips, homoSIDs, homoZIDs,
1028 homoYIDs, points, pointDef, numPoints, numPointDef);
1029
1030 fielddefs.push_back(fielddef);
1031
1032 element = element->NextSiblingElement("ELEMENTS");
1033 }
1034 loopXml = loopXml->NextSiblingElement(strLoop);
1035 }
1036}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
static bool GenerateSeqVector(const std::string &str, std::vector< unsigned int > &out)
Takes a comma-separated compressed string and converts it to entries in a vector.
const char *const ShapeTypeMap[SIZE_ShapeType]
Definition ShapeType.hpp:83
const char *const BasisTypeMap[]
const std::string kPointsTypeStr[]
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition FieldIO.h:184
@ SIZE_PointsType
Length of enum list.
Definition PointsType.h:105
@ SIZE_BasisType
Length of enum list.
Definition BasisType.h:71
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT const bool append

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::BasisTypeMap, Nektar::ErrorUtil::ewarning, Nektar::ParseUtils::GenerateSeqVector(), Nektar::ParseUtils::GenerateVector(), Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::StringUtils::IEquals(), Nektar::LibUtilities::kPointsTypeStr, NEKERROR, Nektar::LibUtilities::ShapeTypeMap, Nektar::LibUtilities::SIZE_BasisType, Nektar::LibUtilities::SIZE_PointsType, Nektar::LibUtilities::SIZE_ShapeType, and WARNINGL0.

Referenced by v_Import().

◆ ImportMultiFldFileIDs()

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.

Parameters
inFileInput multi-field file name.
fileNamesList of partition filenames.
elementListVector of element IDs that lie on each process.
fieldmetadatamapField metadata map that is read from inFile.

Definition at line 420 of file FieldIOXml.cpp.

424{
425 TiXmlDocument doc(inFile);
426 bool loadOkay = doc.LoadFile();
427
428 std::stringstream errstr;
429 errstr << "Unable to load file: " << inFile << std::endl;
430 errstr << "Reason: " << doc.ErrorDesc() << std::endl;
431 errstr << "Position: Line " << doc.ErrorRow() << ", Column "
432 << doc.ErrorCol() << std::endl;
433 ASSERTL0(loadOkay, errstr.str());
434
435 // Handle on XML document
436 TiXmlHandle docHandle(&doc);
437
438 // Retrieve main NEKTAR tag - XML specification states one
439 // top-level element tag per file.
440 TiXmlElement *master = doc.FirstChildElement("NEKTAR");
441 ASSERTL0(master, "Unable to find NEKTAR tag in file.");
442
443 // Partition element tag name
444 std::string strPartition = "Partition";
445
446 // First attempt to get the first Partition element
447 TiXmlElement *fldfileIDs = master->FirstChildElement(strPartition.c_str());
448 if (!fldfileIDs)
449 {
450 // If this files try previous name
451 strPartition = "MultipleFldFiles";
452 fldfileIDs = master->FirstChildElement("MultipleFldFiles");
453 }
454 ASSERTL0(fldfileIDs, "Unable to find 'Partition' or 'MultipleFldFiles' tag "
455 "within nektar tag.");
456
457 while (fldfileIDs)
458 {
459 // Read file name of partition file
460 const char *attr = fldfileIDs->Attribute("FileName");
461 ASSERTL0(attr, "'FileName' not provided as an attribute of '" +
462 strPartition + "' tag.");
463 fileNames.push_back(std::string(attr));
464
465 const char *elementIDs = fldfileIDs->GetText();
466 ASSERTL0(elementIDs, "Element IDs not specified.");
467
468 std::string elementIDsStr(elementIDs);
469
470 std::vector<unsigned int> idvec;
471 ParseUtils::GenerateSeqVector(elementIDsStr, idvec);
472
473 elementList.push_back(idvec);
474
475 fldfileIDs = fldfileIDs->NextSiblingElement(strPartition.c_str());
476 }
477}

References ASSERTL0, and Nektar::ParseUtils::GenerateSeqVector().

Referenced by Nektar::LibUtilities::PtsIO::Import(), and v_Import().

◆ SetUpFieldMetaData()

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.

Parameters
outnameOutput directory.
fielddefsField definitions, needed to grab element IDs.
fieldmetadatamapField metadata map that is also written to the Info.xml file.

Definition at line 653 of file FieldIOXml.cpp.

657{
658 ASSERTL0(!outname.empty(), "Empty path given to SetUpFieldMetaData()");
659
660 unsigned int nprocs = m_comm->GetSpaceComm()->GetSize();
661 unsigned int rank = m_comm->GetSpaceComm()->GetRank();
662
663 fs::path specPath(outname);
664
665 // Compute number of elements on this process and share with other
666 // processes. Also construct list of elements on this process from
667 // available vector of field definitions.
668 std::vector<size_t> elmtnums(nprocs, 0);
669 std::vector<unsigned int> idlist;
670 for (size_t i = 0; i < fielddefs.size(); ++i)
671 {
672 elmtnums[rank] += fielddefs[i]->m_elementIDs.size();
673 idlist.insert(idlist.end(), fielddefs[i]->m_elementIDs.begin(),
674 fielddefs[i]->m_elementIDs.end());
675 }
676 m_comm->GetSpaceComm()->AllReduce(elmtnums, LibUtilities::ReduceMax);
677
678 // Collate per-process element lists on root process to generate
679 // the info file.
680 if (rank == 0)
681 {
682 std::vector<std::vector<unsigned int>> ElementIDs(nprocs);
683
684 // Populate the list of element ID lists from all processes
685 ElementIDs[0] = idlist;
686 for (size_t i = 1; i < nprocs; ++i)
687 {
688 if (elmtnums[i] > 0)
689 {
690 std::vector<unsigned int> tmp(elmtnums[i]);
691 m_comm->GetSpaceComm()->Recv(i, tmp);
692 ElementIDs[i] = tmp;
693 }
694 }
695
696 // Set up output names
697 std::vector<std::string> filenames;
698 for (unsigned int i = 0; i < nprocs; ++i)
699 {
700 boost::format pad("P%1$07d.%2$s");
701 pad % i % GetFileEnding();
702 filenames.push_back(pad.str());
703 }
704
705 // Write the Info.xml file
706 std::string infofile =
707 LibUtilities::PortablePath(specPath / fs::path("Info.xml"));
708
709 WriteMultiFldFileIDs(infofile, filenames, ElementIDs, fieldmetadatamap);
710 }
711 else
712 {
713 // Send this process's ID list to the root process
714 if (elmtnums[rank] > 0)
715 {
716 m_comm->GetSpaceComm()->Send(0, idlist);
717 }
718 }
719}
LibUtilities::CommSharedPtr m_comm
Communicator to use when writing parallel format.
Definition FieldIO.h:280
std::string GetFileEnding() const
Helper function that determines default file extension.
Definition FieldIO.h:273
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.
static std::string PortablePath(const fs::path &path)
create portable path on different platforms for std::filesystem path.

References ASSERTL0, Nektar::LibUtilities::FieldIO::GetFileEnding(), Nektar::LibUtilities::FieldIO::m_comm, Nektar::LibUtilities::PortablePath(), rank, Nektar::LibUtilities::ReduceMax, and WriteMultiFldFileIDs().

Referenced by v_Write().

◆ v_GetClassName()

const std::string & Nektar::LibUtilities::FieldIOXml::v_GetClassName ( ) const
overrideprotectedvirtual

Returns the class name.

Implements Nektar::LibUtilities::FieldIO.

Definition at line 635 of file FieldIOXml.cpp.

636{
637 return className;
638}
static std::string className
Name of class.
Definition FieldIOXml.h:216

References className.

◆ v_Import()

void Nektar::LibUtilities::FieldIOXml::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 
)
overrideprotectedvirtual

Import an XML format file.

Parameters
finfilenameInput filename
fielddefsField definitions of resulting field
fielddataField data of resulting field
fieldinfomapField metadata of resulting field
ElementIDsIf 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 491 of file FieldIOXml.cpp.

496{
497 std::string infile = infilename;
498
499 fs::path pinfilename(infilename);
500
501 // Check to see whether infile is a directory and therefore read in parallel
502 // or serial.
503 if (fs::is_directory(pinfilename))
504 {
505 fs::path infofile("Info.xml");
506 fs::path fullpath = pinfilename / infofile;
507 infile = PortablePath(fullpath);
508
509 std::vector<std::string> filenames;
510 std::vector<std::vector<unsigned int>> elementIDs_OnPartitions;
511
512 ImportMultiFldFileIDs(infile, filenames, elementIDs_OnPartitions,
513 fieldinfomap);
514
515 // Load metadata
516 ImportFieldMetaData(infile, fieldinfomap);
517
518 if (ElementIDs == NullInt1DArray) // load all elements
519 {
520 for (int i = 0; i < filenames.size(); ++i)
521 {
522 fs::path pfilename(filenames[i]);
523 fullpath = pinfilename / pfilename;
524 std::string fname = PortablePath(fullpath);
525 DataSourceSharedPtr dataSource = XmlDataSource::create(fname);
526 ImportFieldDefs(dataSource, fielddefs, false);
527 if (fielddata != NullVectorNekDoubleVector)
528 {
529 ImportFieldData(dataSource, fielddefs, fielddata);
530 }
531 }
532 }
533 else // only load relevant elements from partitions
534 {
535 int i, j;
536 std::map<int, std::vector<int>> FileIDs;
537 std::set<int> LoadFile;
538
539 for (i = 0; i < elementIDs_OnPartitions.size(); ++i)
540 {
541 for (j = 0; j < elementIDs_OnPartitions[i].size(); ++j)
542 {
543 FileIDs[elementIDs_OnPartitions[i][j]].push_back(i);
544 }
545 }
546
547 for (i = 0; i < ElementIDs.size(); ++i)
548 {
549 auto it = FileIDs.find(ElementIDs[i]);
550 if (it != FileIDs.end())
551 {
552 for (j = 0; j < it->second.size(); ++j)
553 {
554 LoadFile.insert(it->second[j]);
555 }
556 }
557 }
558
559 for (auto &iter : LoadFile)
560 {
561 fs::path pfilename(filenames[iter]);
562 fullpath = pinfilename / pfilename;
563 std::string fname = PortablePath(fullpath);
564 DataSourceSharedPtr dataSource = XmlDataSource::create(fname);
565 ImportFieldDefs(dataSource, fielddefs, false);
566 if (fielddata != NullVectorNekDoubleVector)
567 {
568 ImportFieldData(dataSource, fielddefs, fielddata);
569 }
570 }
571 }
572 }
573 else
574 {
575 // Serial format case.
576 DataSourceSharedPtr doc = ImportFieldMetaData(infilename, fieldinfomap);
577 ImportFieldDefs(doc, fielddefs, false);
578 if (fielddata != NullVectorNekDoubleVector)
579 {
580 ImportFieldData(doc, fielddefs, fielddata);
581 }
582 }
583}
DataSourceSharedPtr ImportFieldMetaData(const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
Import the metadata from a field file.
Definition FieldIO.h:371
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.
void ImportFieldData(DataSourceSharedPtr dataSource, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata)
Import field data from a target file.
void ImportFieldDefs(DataSourceSharedPtr dataSource, std::vector< FieldDefinitionsSharedPtr > &fielddefs, bool expChild)
Import field definitions from the target file.
static DataSourceSharedPtr create(const std::string &fn)
Create a new XML data source based on the filename.
Definition FieldIOXml.h:92
std::shared_ptr< DataSource > DataSourceSharedPtr
Definition FieldIO.h:88
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
static Array< OneD, int > NullInt1DArray

References Nektar::LibUtilities::XmlDataSource::create(), ImportFieldData(), ImportFieldDefs(), Nektar::LibUtilities::FieldIO::ImportFieldMetaData(), ImportMultiFldFileIDs(), Nektar::NullInt1DArray, Nektar::LibUtilities::NullVectorNekDoubleVector, and Nektar::LibUtilities::PortablePath().

◆ v_ImportFieldMetaData()

DataSourceSharedPtr Nektar::LibUtilities::FieldIOXml::v_ImportFieldMetaData ( const std::string &  filename,
FieldMetaDataMap &  fieldmetadatamap 
)
overrideprotectedvirtual

Import field metadata from filename and return the data source which wraps filename.

Parameters
filenameInput filename.
fieldmetadatamapResulting field metadata from dataSource.

Implements Nektar::LibUtilities::FieldIO.

Definition at line 592 of file FieldIOXml.cpp.

594{
596 XmlDataSourceSharedPtr xml = std::static_pointer_cast<XmlDataSource>(doc);
597 TiXmlElement *metadata = nullptr;
598 TiXmlElement *master = nullptr; // Master tag within which all data is
599 // contained.
600
601 master = xml->Get().FirstChildElement("NEKTAR");
602 ASSERTL0(master, "Unable to find NEKTAR tag in file.");
603 std::string strLoop = "NEKTAR";
604
605 metadata = master->FirstChildElement("Metadata");
606 if (metadata)
607 {
608 TiXmlElement *param = metadata->FirstChildElement();
609
610 while (param)
611 {
612 std::string paramString = param->Value();
613 if (paramString != "Provenance")
614 {
615 // Now read body of param
616 if (param->NoChildren())
617 {
618 fieldmetadatamap[paramString] = "";
619 }
620 else
621 {
622 TiXmlNode *paramBody = param->FirstChild();
623 std::string paramBodyStr = paramBody->ToText()->Value();
624 fieldmetadatamap[paramString] = paramBodyStr;
625 }
626 }
627 param = param->NextSiblingElement();
628 }
629 }
630
631 return doc;
632}

References ASSERTL0, and Nektar::LibUtilities::XmlDataSource::create().

◆ v_Write()

void Nektar::LibUtilities::FieldIOXml::v_Write ( const std::string &  outFile,
std::vector< FieldDefinitionsSharedPtr > &  fielddefs,
std::vector< std::vector< NekDouble > > &  fielddata,
const FieldMetaDataMap &  fieldmetadatamap = NullFieldMetaDataMap,
const bool  backup = false 
)
overrideprotectedvirtual

Write an XML file to outFile given the field definitions fielddefs, field data fielddata and metadata fieldmetadatamap.

The writing strategy is as follows:

  • Use FieldIO::SetUpOutput to construct the directory to contain each partition.
  • The root processor writes an Info.xml file containing the field metadata and an index that describes which elements lie in which XML file.
  • Each processor then writes an XML file containing the field definitions for that processor and output data in base64-encoded zlib-compressed format.
Parameters
outFileOutput filename.
fielddefsInput field definitions.
fielddataInput field data.
fieldmetadatamapField metadata.

Implements Nektar::LibUtilities::FieldIO.

Definition at line 84 of file FieldIOXml.cpp.

89{
90 double tm0 = 0.0, tm1 = 0.0;
91 if (m_comm->TreatAsRankZero())
92 {
93 tm0 = m_comm->Wtime();
94 }
95
96 // Check everything seems sensible
97 ASSERTL1(fielddefs.size() == fielddata.size(),
98 "Length of fielddefs and fielddata incompatible");
99 for (int f = 0; f < fielddefs.size(); ++f)
100 {
101 ASSERTL1(fielddata[f].size() > 0,
102 "Fielddata vector must contain at least one value.");
103
104 ASSERTL1(fielddata[f].size() == fielddefs[f]->m_fields.size() *
105 CheckFieldDefinition(fielddefs[f]),
106 "Invalid size of fielddata vector.");
107 }
108
109 // Prepare to write out data. In parallel, we must create directory and
110 // determine the full pathname to the file to write out. Any existing
111 // file/directory which is in the way is removed.
112 std::string filename = SetUpOutput(outFile, true, backup);
113 SetUpFieldMetaData(outFile, fielddefs, fieldmetadatamap);
114
115 // Create the file (partition)
116 TiXmlDocument doc;
117 TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "utf-8", "");
118 doc.LinkEndChild(decl);
119
120 TiXmlElement *root = new TiXmlElement("NEKTAR");
121 doc.LinkEndChild(root);
122
123 AddInfoTag(XmlTagWriterSharedPtr(new XmlTagWriter(root)), fieldmetadatamap);
124
125 for (int f = 0; f < fielddefs.size(); ++f)
126 {
127 //---------------------------------------------
128 // Write ELEMENTS
129 TiXmlElement *elemTag = new TiXmlElement("ELEMENTS");
130 root->LinkEndChild(elemTag);
131
132 // Write FIELDS
133 std::string fieldsString;
134 {
135 std::stringstream fieldsStringStream;
136 bool first = true;
137 for (size_t i = 0; i < fielddefs[f]->m_fields.size(); i++)
138 {
139 if (!first)
140 {
141 fieldsStringStream << ",";
142 }
143 fieldsStringStream << fielddefs[f]->m_fields[i];
144 first = false;
145 }
146 fieldsString = fieldsStringStream.str();
147 }
148 elemTag->SetAttribute("FIELDS", fieldsString);
149
150 // Write SHAPE
151 std::string shapeString;
152 {
153 std::stringstream shapeStringStream;
154 shapeStringStream << ShapeTypeMap[fielddefs[f]->m_shapeType];
155 if (fielddefs[f]->m_numHomogeneousDir == 1)
156 {
157 shapeStringStream << "-HomogenousExp1D";
158 }
159 else if (fielddefs[f]->m_numHomogeneousDir == 2)
160 {
161 shapeStringStream << "-HomogenousExp2D";
162 }
163
164 if (fielddefs[f]->m_homoStrips)
165 {
166 shapeStringStream << "-Strips";
167 }
168
169 shapeString = shapeStringStream.str();
170 }
171 elemTag->SetAttribute("SHAPE", shapeString);
172
173 // Write BASIS
174 std::string basisString;
175 {
176 std::stringstream basisStringStream;
177 bool first = true;
178 for (size_t i = 0; i < fielddefs[f]->m_basis.size(); i++)
179 {
180 if (!first)
181 {
182 basisStringStream << ",";
183 }
184 basisStringStream << BasisTypeMap[fielddefs[f]->m_basis[i]];
185 first = false;
186 }
187 basisString = basisStringStream.str();
188 }
189 elemTag->SetAttribute("BASIS", basisString);
190
191 // Write homogeneuous length details
192 if (fielddefs[f]->m_numHomogeneousDir)
193 {
194 std::string homoLenString;
195 {
196 std::stringstream homoLenStringStream;
197 bool first = true;
198 for (int i = 0; i < fielddefs[f]->m_numHomogeneousDir; ++i)
199 {
200 if (!first)
201 {
202 homoLenStringStream << ",";
203 }
204 homoLenStringStream
205 << fielddefs[f]->m_homogeneousLengths[i];
206 first = false;
207 }
208 homoLenString = homoLenStringStream.str();
209 }
210 elemTag->SetAttribute("HOMOGENEOUSLENGTHS", homoLenString);
211 }
212
213 // Write homogeneuous planes/lines details
214 if (fielddefs[f]->m_numHomogeneousDir)
215 {
216 if (fielddefs[f]->m_homogeneousYIDs.size() > 0)
217 {
218 std::string homoYIDsString;
219 {
220 std::stringstream homoYIDsStringStream;
221 bool first = true;
222 for (int i = 0; i < fielddefs[f]->m_homogeneousYIDs.size();
223 i++)
224 {
225 if (!first)
226 {
227 homoYIDsStringStream << ",";
228 }
229 homoYIDsStringStream
230 << fielddefs[f]->m_homogeneousYIDs[i];
231 first = false;
232 }
233 homoYIDsString = homoYIDsStringStream.str();
234 }
235 elemTag->SetAttribute("HOMOGENEOUSYIDS", homoYIDsString);
236 }
237
238 if (fielddefs[f]->m_homogeneousZIDs.size() > 0)
239 {
240 std::string homoZIDsString;
241 {
242 std::stringstream homoZIDsStringStream;
243 bool first = true;
244 for (int i = 0; i < fielddefs[f]->m_homogeneousZIDs.size();
245 i++)
246 {
247 if (!first)
248 {
249 homoZIDsStringStream << ",";
250 }
251 homoZIDsStringStream
252 << fielddefs[f]->m_homogeneousZIDs[i];
253 first = false;
254 }
255 homoZIDsString = homoZIDsStringStream.str();
256 }
257 elemTag->SetAttribute("HOMOGENEOUSZIDS", homoZIDsString);
258 }
259
260 if (fielddefs[f]->m_homogeneousSIDs.size() > 0)
261 {
262 std::string homoSIDsString;
263 {
264 std::stringstream homoSIDsStringStream;
265 bool first = true;
266 for (int i = 0; i < fielddefs[f]->m_homogeneousSIDs.size();
267 i++)
268 {
269 if (!first)
270 {
271 homoSIDsStringStream << ",";
272 }
273 homoSIDsStringStream
274 << fielddefs[f]->m_homogeneousSIDs[i];
275 first = false;
276 }
277 homoSIDsString = homoSIDsStringStream.str();
278 }
279 elemTag->SetAttribute("HOMOGENEOUSSIDS", homoSIDsString);
280 }
281 }
282
283 // Write NUMMODESPERDIR
284 std::string numModesString;
285 {
286 std::stringstream numModesStringStream;
287
288 if (fielddefs[f]->m_uniOrder)
289 {
290 numModesStringStream << "UNIORDER:";
291 // Just dump single definition
292 bool first = true;
293 for (size_t i = 0; i < fielddefs[f]->m_basis.size(); i++)
294 {
295 if (!first)
296 {
297 numModesStringStream << ",";
298 }
299 numModesStringStream << fielddefs[f]->m_numModes[i];
300 first = false;
301 }
302 }
303 else
304 {
305 numModesStringStream << "MIXORDER:";
306 bool first = true;
307 for (size_t i = 0; i < fielddefs[f]->m_numModes.size(); i++)
308 {
309 if (!first)
310 {
311 numModesStringStream << ",";
312 }
313 numModesStringStream << fielddefs[f]->m_numModes[i];
314 first = false;
315 }
316 }
317
318 numModesString = numModesStringStream.str();
319 }
320 elemTag->SetAttribute("NUMMODESPERDIR", numModesString);
321
322 // Write ID
323 // Should ideally look at ways of compressing this stream
324 // if just sequential;
325 std::string idString;
326 {
327 std::stringstream idStringStream;
328 idString =
329 ParseUtils::GenerateSeqString(fielddefs[f]->m_elementIDs);
330 }
331 elemTag->SetAttribute("ID", idString);
332 elemTag->SetAttribute("COMPRESSED",
334
335 // Add this information for future compatibility
336 // issues, for exmaple in case we end up using a 128
337 // bit machine.
338 elemTag->SetAttribute("BITSIZE",
340
341 // Write field data.
342 std::string base64string;
344 base64string),
345 "Failed to compress field data.");
346
347 elemTag->LinkEndChild(new TiXmlText(base64string));
348 }
349 doc.SaveFile(filename);
350
351 m_comm->GetSpaceComm()->Block();
352
353 // All data has been written
354 if (m_comm->TreatAsRankZero())
355 {
356 tm1 = m_comm->Wtime();
357 std::cout << " (" << tm1 - tm0 << "s, XML)" << std::endl;
358 }
359}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
std::string SetUpOutput(const std::string outname, bool perRank, bool backup=false)
Set up the filesystem ready for output.
Definition FieldIO.cpp:403
static void AddInfoTag(TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap)
Add provenance information to the field metadata map.
Definition FieldIO.cpp:341
void SetUpFieldMetaData(const std::string &outname, const std::vector< FieldDefinitionsSharedPtr > &fielddefs, const FieldMetaDataMap &fieldmetadatamap)
Set up field meta data map.
static std::string GenerateSeqString(const std::vector< T > &v)
Generate a compressed comma-separated string representation of a vector of unsigned integers.
Definition ParseUtils.h:72
int ZlibEncodeToBase64Str(std::vector< T > &in, std::string &out64, int level=Z_DEFAULT_COMPRESSION)
std::shared_ptr< XmlTagWriter > XmlTagWriterSharedPtr
Definition FieldIOXml.h:166

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().

◆ WriteMultiFldFileIDs()

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.

Parameters
outFileOutput multi-field file name.
fileNamesList of partition filenames.
elementListVector of element IDs that lie on each process.
fieldmetadatamapField metadata map that is written into outFile.

Definition at line 373 of file FieldIOXml.cpp.

377{
378 TiXmlDocument doc;
379 TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "utf-8", "");
380 doc.LinkEndChild(decl);
381
382 ASSERTL0(fileNames.size() == elementList.size(),
383 "Outfile names and list of elements ids does not match");
384
385 TiXmlElement *root = new TiXmlElement("NEKTAR");
386 doc.LinkEndChild(root);
387
388 AddInfoTag(XmlTagWriterSharedPtr(new XmlTagWriter(root)), fieldmetadatamap);
389
390 for (int t = 0; t < fileNames.size(); ++t)
391 {
392 if (elementList[t].size())
393 {
394 TiXmlElement *elemIDs = new TiXmlElement("Partition");
395 root->LinkEndChild(elemIDs);
396
397 elemIDs->SetAttribute("FileName", fileNames[t]);
398
399 std::string IDstr = ParseUtils::GenerateSeqString(elementList[t]);
400
401 elemIDs->LinkEndChild(new TiXmlText(IDstr));
402 }
403 }
404
405 doc.SaveFile(outFile);
406}

References Nektar::LibUtilities::FieldIO::AddInfoTag(), ASSERTL0, and Nektar::ParseUtils::GenerateSeqString().

Referenced by SetUpFieldMetaData(), and Nektar::LibUtilities::PtsIO::SetUpFieldMetaData().

Member Data Documentation

◆ className

std::string Nektar::LibUtilities::FieldIOXml::className
static
Initial value:
"Xml", FieldIOXml::create, "XML-based output of field data.")
static FieldIOSharedPtr create(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Creates an instance of this class.
Definition FieldIOXml.h:208
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
Definition FieldIO.cpp:69

Name of class.

Definition at line 216 of file FieldIOXml.h.

Referenced by v_GetClassName().