Commit ec42c15f authored by Douglas Serson's avatar Douglas Serson
Browse files

Use clang-format on FieldIO header to make merging master easier

parent 1f9fc6d0
......@@ -56,186 +56,166 @@
namespace Nektar
{
namespace LibUtilities
namespace LibUtilities
{
static std::vector<NekDouble> NullNekDoubleVector;
static std::vector<LibUtilities::PointsType> NullPointsTypeVector;
static std::vector<unsigned int> NullUnsignedIntVector;
typedef std::map<std::string, std::string> FieldMetaDataMap;
static FieldMetaDataMap NullFieldMetaDataMap;
static std::vector<std::vector<NekDouble> > NullVectorNekDoubleVector =
boost::assign::list_of(NullNekDoubleVector);
struct FieldDefinitions
{
FieldDefinitions(
ShapeType shapeType,
const std::vector<unsigned int> &elementIDs, // vector[2]
const std::vector<LibUtilities::BasisType> &basis,
bool uniOrder,
// UniOrder = vector[dimension] - MixOrder
// = vector[element*dimension]
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)
: m_shapeType(shapeType), m_elementIDs(elementIDs), m_basis(basis),
m_numHomogeneousDir(NumHomoDir), m_homogeneousLengths(HomoLengths),
m_homoStrips(homoStrips), m_homogeneousSIDs(HomoSIDs),
m_homogeneousZIDs(HomoZIDs), m_homogeneousYIDs(HomoYIDs),
m_points(points), m_pointsDef(pointsDef), m_uniOrder(uniOrder),
m_numModes(numModes), m_numPoints(numPoints),
m_numPointsDef(numPointsDef), m_fields(fields)
{
static std::vector<NekDouble> NullNekDoubleVector;
static std::vector<LibUtilities::PointsType> NullPointsTypeVector;
static std::vector<unsigned int> NullUnsignedIntVector;
typedef std::map<std::string, std::string> FieldMetaDataMap;
static FieldMetaDataMap NullFieldMetaDataMap;
static std::vector<std::vector< NekDouble> > NullVectorNekDoubleVector = boost::assign::list_of(NullNekDoubleVector);
struct FieldDefinitions
{
FieldDefinitions(ShapeType shapeType,
const std::vector<unsigned int> &elementIDs,// vector[2]
const std::vector<LibUtilities::BasisType> &basis,
bool uniOrder,
// UniOrder = vector[dimension] - MixOrder
// = vector[element*dimension]
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):
m_shapeType(shapeType),
m_elementIDs(elementIDs),
m_basis(basis),
m_numHomogeneousDir(NumHomoDir),
m_homogeneousLengths(HomoLengths),
m_homoStrips(homoStrips),
m_homogeneousSIDs(HomoSIDs),
m_homogeneousZIDs(HomoZIDs),
m_homogeneousYIDs(HomoYIDs),
m_points(points),
m_pointsDef(pointsDef),
m_uniOrder(uniOrder),
m_numModes(numModes),
m_numPoints(numPoints),
m_numPointsDef(numPointsDef),
m_fields(fields)
{
}
ShapeType m_shapeType;
std::vector<unsigned int> m_elementIDs;
std::vector<LibUtilities::BasisType> m_basis;
int m_numHomogeneousDir;
std::vector<NekDouble> m_homogeneousLengths;
bool m_homoStrips;
std::vector<unsigned int> m_homogeneousSIDs;
std::vector<unsigned int> m_homogeneousZIDs;
std::vector<unsigned int> m_homogeneousYIDs;
/// Define the type of points per direction.
std::vector<LibUtilities::PointsType> m_points;
bool m_pointsDef;
/// Define order of the element group.
/// * UniOrder: same order for each element
/// * MixOrder: definition of a different order for each element.
bool m_uniOrder;
/// Define number of modes per direction.
std::vector<unsigned int> m_numModes;
std::vector<unsigned int> m_numPoints;
bool m_numPointsDef;
std::vector<std::string> m_fields;
};
typedef boost::shared_ptr<FieldDefinitions> FieldDefinitionsSharedPtr;
/// Write a field file in serial only
LIB_UTILITIES_EXPORT void Write(
const std::string &outFile,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
/// Imports an FLD file
LIB_UTILITIES_EXPORT 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);
/// Class for operating on FLD files
class FieldIO
{
public:
/// Constructor
LIB_UTILITIES_EXPORT FieldIO(
LibUtilities::CommSharedPtr pComm);
/// Write data in FLD format
LIB_UTILITIES_EXPORT void Write(
const std::string &outFile,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
/// Imports an FLD file.
LIB_UTILITIES_EXPORT 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 the definition of the meta data
LIB_UTILITIES_EXPORT void ImportFieldMetaData(
std::string filename,
FieldMetaDataMap &fieldmetadatamap);
/// Imports the definition of the meta data
LIB_UTILITIES_EXPORT void ImportFieldMetaData(
TiXmlDocument &doc,
FieldMetaDataMap &fieldmetadatamap);
/// Imports the definition of the fields.
LIB_UTILITIES_EXPORT void ImportFieldDefs(
TiXmlDocument &doc,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
bool expChild);
/// Imports the data fileds.
LIB_UTILITIES_EXPORT void ImportFieldData(
TiXmlDocument &doc,
const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata);
LIB_UTILITIES_EXPORT void WriteMultiFldFileIDs(
const std::string &outfile,
const std::vector<std::string> fileNames,
std::vector<std::vector<unsigned int> > &elementList,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
private:
/// Communicator to use when writing parallel format
LibUtilities::CommSharedPtr m_comm;
LIB_UTILITIES_EXPORT void AddInfoTag(
TiXmlElement * root,
const FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT void GenerateSeqString(
const std::vector<unsigned int> &elmtids,
std::string &idString);
LIB_UTILITIES_EXPORT std::string SetUpOutput(
const std::string outname,
const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
const FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT void ImportMultiFldFileIDs(
const std::string &inFile,
std::vector<std::string> &fileNames,
std::vector<std::vector<unsigned int> > &elementList,
FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT int CheckFieldDefinition(
const FieldDefinitionsSharedPtr &fielddefs);
};
typedef boost::shared_ptr<FieldIO> FieldIOSharedPtr;
}
ShapeType m_shapeType;
std::vector<unsigned int> m_elementIDs;
std::vector<LibUtilities::BasisType> m_basis;
int m_numHomogeneousDir;
std::vector<NekDouble> m_homogeneousLengths;
bool m_homoStrips;
std::vector<unsigned int> m_homogeneousSIDs;
std::vector<unsigned int> m_homogeneousZIDs;
std::vector<unsigned int> m_homogeneousYIDs;
/// Define the type of points per direction.
std::vector<LibUtilities::PointsType> m_points;
bool m_pointsDef;
/// Define order of the element group.
/// * UniOrder: same order for each element
/// * MixOrder: definition of a different order for each element.
bool m_uniOrder;
/// Define number of modes per direction.
std::vector<unsigned int> m_numModes;
std::vector<unsigned int> m_numPoints;
bool m_numPointsDef;
std::vector<std::string> m_fields;
};
typedef boost::shared_ptr<FieldDefinitions> FieldDefinitionsSharedPtr;
/// Write a field file in serial only
LIB_UTILITIES_EXPORT void Write(
const std::string &outFile,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
/// Imports an FLD file
LIB_UTILITIES_EXPORT 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);
/// Class for operating on FLD files
class FieldIO
{
public:
/// Constructor
LIB_UTILITIES_EXPORT FieldIO(LibUtilities::CommSharedPtr pComm);
/// Write data in FLD format
LIB_UTILITIES_EXPORT void Write(
const std::string &outFile,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
/// Imports an FLD file.
LIB_UTILITIES_EXPORT 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 the definition of the meta data
LIB_UTILITIES_EXPORT void ImportFieldMetaData(
std::string filename, FieldMetaDataMap &fieldmetadatamap);
/// Imports the definition of the meta data
LIB_UTILITIES_EXPORT void ImportFieldMetaData(
TiXmlDocument &doc, FieldMetaDataMap &fieldmetadatamap);
/// Imports the definition of the fields.
LIB_UTILITIES_EXPORT void ImportFieldDefs(
TiXmlDocument &doc,
std::vector<FieldDefinitionsSharedPtr> &fielddefs,
bool expChild);
/// Imports the data fileds.
LIB_UTILITIES_EXPORT void ImportFieldData(
TiXmlDocument &doc,
const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
std::vector<std::vector<NekDouble> > &fielddata);
LIB_UTILITIES_EXPORT void WriteMultiFldFileIDs(
const std::string &outfile,
const std::vector<std::string> fileNames,
std::vector<std::vector<unsigned int> > &elementList,
const FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap);
private:
/// Communicator to use when writing parallel format
LibUtilities::CommSharedPtr m_comm;
LIB_UTILITIES_EXPORT void AddInfoTag(
TiXmlElement *root, const FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT void GenerateSeqString(
const std::vector<unsigned int> &elmtids, std::string &idString);
LIB_UTILITIES_EXPORT std::string SetUpOutput(
const std::string outname,
const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
const FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT void ImportMultiFldFileIDs(
const std::string &inFile,
std::vector<std::string> &fileNames,
std::vector<std::vector<unsigned int> > &elementList,
FieldMetaDataMap &fieldmetadatamap);
LIB_UTILITIES_EXPORT int CheckFieldDefinition(
const FieldDefinitionsSharedPtr &fielddefs);
};
typedef boost::shared_ptr<FieldIO> FieldIOSharedPtr;
}
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment