diff --git a/Xdmf.i b/Xdmf.i index fe473be79efa3c8e18258c95c98d89a2ebbc149d..1357e557d3620686729cd2beb928a4b1e5d7e359 100644 --- a/Xdmf.i +++ b/Xdmf.i @@ -168,10 +168,14 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i %include std_set.i %include std_map.i +%include std_vector.i %template(XdmfMapNodeIdSet) std::set; %template(XdmfMapNodeIdMap) std::map >; %template(XdmfMapMap) std::map > >; +%template(AttributeVector) std::vector >; +%template(MapVector) std::vector >; +%template(ArrayVector) std::vector >; %pythoncode { from XdmfCore import * diff --git a/XdmfAttribute.hpp b/XdmfAttribute.hpp index 761b878b09b3c16e89d6361846e8bad3e080a182..5566e75aa6b02e4615008241515151a3b14a1697 100644 --- a/XdmfAttribute.hpp +++ b/XdmfAttribute.hpp @@ -48,6 +48,16 @@ public: /** * Create a new XdmfAttribute. * + * Example of use: + * + * C++ + * + * shared_ptr exampleAttribute = XdmfAttribute::New(); + * + * Python + * + * exampleAttribute = XdmfAttribute.New() + * * @return constructed XdmfAttribute. */ static shared_ptr New(); @@ -60,6 +70,20 @@ public: /** * Get the XdmfAttributeCenter associated with this attribute. * + * Example of use: + * + * C++ + * + * //Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object with its center set + * shared_ptr exampleCenter = exampleAttribute->getCenter(); + * + * Python + * + * ''' + * Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object with its center set + * ''' + * exampleCenter = exampleAttribute.getCenter() + * * @return XdmfAttributeCenter of the attribute. */ shared_ptr getCenter() const; @@ -71,6 +95,20 @@ public: /** * Get the name of the attribute. * + * Example of use: + * + * C++ + * + * //Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object + * std::string exampleName = exampleAttribute->getName(); + * + * Python + * + * ''' + * Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object + * ''' + * exampleName = exampleAttribute.getName() + * * @return a string containing the name of the attribute. */ std::string getName() const; @@ -78,6 +116,20 @@ public: /** * Get the XdmfAttributeType associated with this attribute. * + * Example of use: + * + * C++ + * + * //Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object with its type set + * shared_ptr exampleType = exampleAttribute->getType(); + * + * Python + * + * ''' + * Assuming that exampleAttribute is a shared pointer to an XdmfAttribute object with its type set + * ''' + * exampleType = exampleAttribute.getType() + * * @return XdmfAttributeType of the attribute. */ shared_ptr getType() const; @@ -85,6 +137,18 @@ public: /** * Set the XdmfAttributeCenter associated with this attribute. * + * Example of use: + * + * C++ + * + * shared_ptr exampleAttribute = XdmfAttribute::New(); + * exampleAttribute->setCenter(XdmfAttributeCenter::Node()); + * + * Python + * + * exampleAttribute = XdmfAttribute.New() + * exampleAttribute.setCenter(XdmfAttributeCenter.Node()) + * * @param center the XdmfAttributeCenter to set. */ void setCenter(const shared_ptr center); @@ -92,6 +156,20 @@ public: /** * Set the name of the attribute. * + * Example of use: + * + * C++ + * + * shared_ptr exampleAttribute = XdmfAttribute::New(); + * std::string newName = "New Name"; + * exampleAttribute->setName(newName); + * + * Python + * + * exampleAttribute = XdmfAttribute.New() + * newName = "New Name" + * exampleAttribute.setName(newName) + * * @param name a string containing the name to set. */ void setName(const std::string & name); @@ -99,6 +177,18 @@ public: /** * Set the XdmfAttributeType associated with this attribute. * + * Example of use: + * + * C++ + * + * shared_ptr exampleAttribute = XdmfAttribute::New(); + * exampleAttribute->setType(XdmfAttributeType::Node()); + * + * Python + * + * exampleAttribute = XdmfAttribute.New() + * exampleAttribute.setType(XdmfAttributeType.Node()) + * * @param type XdmfAttributeType to set. */ void setType(const shared_ptr type); diff --git a/XdmfAttributeCenter.hpp b/XdmfAttributeCenter.hpp index 85cdb2a46748e35fa6b4b59f1ded82a3b1f0a79f..1d0d54ac02300cc25af957c203f86361e6033b1d 100644 --- a/XdmfAttributeCenter.hpp +++ b/XdmfAttributeCenter.hpp @@ -35,8 +35,15 @@ * where its values are centered on an XdmfGrid. A specific * XdmfAttributeCenter can be created by calling on of the static * methods in the class, i.e. XdmfAttributeCenter::Cell(). - * * Xdmf supports the following attribute centers: + * + * Example of use: + * //Assuming that exampleAttribute is a shared pointer to an XdmfAttribute with a set center + * if (exampleAttribute->getCenter() == XdmfAttributeCenter::Grid()) + * { + * //do whatever is to be done if the center is grid + * } + * * Grid * Cell * Face diff --git a/XdmfAttributeType.hpp b/XdmfAttributeType.hpp index 5e6d67d60282be90e2d64aadd9bb415897a54068..13372e571bcc9813c1eba1cddd4449fcafb7e77f 100644 --- a/XdmfAttributeType.hpp +++ b/XdmfAttributeType.hpp @@ -37,6 +37,14 @@ * XdmfAttributeType can be created by calling one of the static * methods in the class, i.e. XdmfAttributeType::Scalar(). * + * Example of use: + * + * //Assuming that exampleAttribute is a shared pointer to an XdmfAttribute that has had its type set + * if (exampleAttribute->getType() == XdmfAttributeType:Scalar()) + * { + * //do whatever is to be done if the attribute is a scalar + * } + * * Xdmf supports the following attribute types: * NoAttributeType * Scalar diff --git a/XdmfCurvilinearGrid.hpp b/XdmfCurvilinearGrid.hpp index dc4fb7299976cf12f9727f34c615ded3421ddddf..0fde97b388a3559ecd7aa7649291fa7202b2b3a9 100644 --- a/XdmfCurvilinearGrid.hpp +++ b/XdmfCurvilinearGrid.hpp @@ -49,6 +49,20 @@ public: /** * Create a new curvilinear grid (Two dimensional). * + * Example of use: + * + * C++ + * + * unsigned int newPointsX = 5; + * unsigned int newPointsY = 5; + * shared_ptr exampleGrid = XdmfCurvilinearGrid::New(newPointsX, newPointsY); + * + * Python + * + * newPointsX = 5 + * newPointsY = 5 + * exampleGrid = XdmfCurvilinearGrid.New(newPointsX, newPointsY) + * * @param xNumPoints the number of points in the x direction. * @param yNumPoints the number of points in the y direction. * @@ -61,6 +75,22 @@ public: /** * Create a new curvilinear grid (Three dimensional). * + * Example of use: + * + * C++ + * + * unsigned int newPointsX = 5; + * unsigned int newPointsY = 5; + * unsigned int newPointsZ = 5; + * shared_ptr exampleGrid = XdmfCurvilinearGrid::New(newPointsX, newPointsY, newPointsZ); + * + * Python + * + * newPointsX = 5 + * newPointsY = 5 + * newPointsZ = 5 + * exampleGrid = XdmfCurvilinearGrid.New(newPointsX, newPointsY, newPointsZ) + * * @param xNumPoints the number of points in the x direction. * @param yNumPoints the number of points in the y direction. * @param zNumPoints the number of points in the z direction. @@ -75,6 +105,24 @@ public: /** * Create a new curvilinear grid (N dimensional). * + * Example of use: + * + * C++ + * + * shared_ptr newPoints = XdmfArray::New(); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * shared_ptr exampleGrid = XdmfCurvilinearGrid::New(newPoints); + * + * Python + * + * newPoints = XdmfArray.New() + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * exampleGrid = XdmfCurvilinearGrid.New(newPoints) + * * @param numPoints the number of points in each direction. * * @return constructed curvilinear grid. @@ -91,6 +139,20 @@ public: * Get the dimensions of the grid, the number of points in each * direction. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object + * shared_ptr exampleDimensions = exampleGrid->getDimensions(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object + * ''' + * exampleDimensions = exampleGrid.getDimensions() + * * @return XdmfArray containing dimensions of this grid. */ shared_ptr getDimensions(); @@ -99,6 +161,15 @@ public: * Get the dimensions of the grid, the number of points in each * direction (const version). * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object + * shared_ptr exampleDimensions = exampleGrid->getDimensions(); + * + * Python: Python doesn't have a constant version + * * @return XdmfArray containing the dimensions of this grid. */ shared_ptr getDimensions() const; @@ -106,6 +177,20 @@ public: /** * Get the geometry associated with this grid. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * shared_ptr exampleGeometry = exampleGrid->getGeometry(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * ''' + * exampleGeometry = exampleGrid.getGeometry() + * * @return the geometry associated with this grid. */ shared_ptr getGeometry(); @@ -114,6 +199,28 @@ public: * Set the dimensions of the grid, the number of points in each * direction. * + * Example of use: + * + * C++ + * + * shared_ptr newPoints = XdmfArray::New(); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * //Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * exampleGrid->setDimensions(newPoints); + * + * Python + * + * newPoints = XdmfArray.New() + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * ''' + * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * ''' + * exampleGrid.setDimensions(newPoints) + * * @param dimensions the dimension of the grid. */ void setDimensions(const shared_ptr dimensions); @@ -121,6 +228,34 @@ public: /** * Set the geometry associated with this grid. * + * Example of use: + * + * C++ + * + * shared_ptr newPoints = XdmfArray::New(); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * newPoints->pushBack(5); + * shared_ptr newGeometry = XdmfGeometry::New(); + * newGeometry->setType(XdmfGeometryType::XYZ()); + * newGeometry->insert(0, newPoints, 0, 3, 1, 1);//Start index is 0, 3 values are passed, stride for both arrays is 1 + * //Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * exampleGrid->setGeometry(newGeometry); + * + * Python + * + * newPoints = XdmfArray.New() + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * newPoints.pushBackAsInt32(5) + * newGeometry = XdmfGeometry.New() + * newGeometry.setType(XdmfGeometryType.XYZ()) + * newGeometry.insert(0, newPoints, 0, 3, 1, 1)//Start index is 0, 3 values are passed, stride for both arrays is 1 + * ''' + * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object + * ''' + * exampleGrid.setGeometry(newGeometry) + * * @param geometry an XdmfGeometry to associate with this grid. */ void setGeometry(const shared_ptr geometry); diff --git a/XdmfDomain.hpp b/XdmfDomain.hpp index 758cad830bd50e0b9ffbdb94a3c89abb4e171721..004adc4d67fd660d659fe732f03a9831f2a64a67 100644 --- a/XdmfDomain.hpp +++ b/XdmfDomain.hpp @@ -49,6 +49,16 @@ public: /** * Create a new XdmfDomain. * + * Example of use: + * + * C++ + * + * shared_ptr exampleDomain = XdmfDomain::New(); + * + * Python + * + * exampleDomain = XdmfDomain.New(); + * * @return constructed XdmfDomain. */ static shared_ptr New(); @@ -56,11 +66,11 @@ public: virtual ~XdmfDomain(); LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem); - XDMF_CHILDREN(XdmfGridCollection, GridCollection, Name); - XDMF_CHILDREN(XdmfCurvilinearGrid, CurvilinearGrid, Name); - XDMF_CHILDREN(XdmfRectilinearGrid, RectilinearGrid, Name); - XDMF_CHILDREN(XdmfRegularGrid, RegularGrid, Name); - XDMF_CHILDREN(XdmfUnstructuredGrid, UnstructuredGrid, Name); + XDMF_CHILDREN(XdmfDomain, XdmfGridCollection, GridCollection, Name); + XDMF_CHILDREN(XdmfDomain, XdmfCurvilinearGrid, CurvilinearGrid, Name); + XDMF_CHILDREN(XdmfDomain, XdmfRectilinearGrid, RectilinearGrid, Name); + XDMF_CHILDREN(XdmfDomain, XdmfRegularGrid, RegularGrid, Name); + XDMF_CHILDREN(XdmfDomain, XdmfUnstructuredGrid, UnstructuredGrid, Name); static const std::string ItemTag; std::map getItemProperties() const; diff --git a/XdmfGeometry.hpp b/XdmfGeometry.hpp index 2bf69c02a7affd44fe7c9637148ac4425cb8cf00..2334b95e65fac82d953c69a79ac860784afcb334 100644 --- a/XdmfGeometry.hpp +++ b/XdmfGeometry.hpp @@ -46,6 +46,16 @@ public: /** * Create a new XdmfGeometry. * + * Example of use: + * + * C++ + * + * shared_ptr exampleGeometry = XdmfGeometry::New(); + * + * Python + * + * exampleGeometry = XdmfGeometry.New() + * * @return constructed XdmfGeometry. */ static shared_ptr New(); @@ -61,12 +71,40 @@ public: /** * Get the number of points stored in this geometry. + * + * Example of use: + * + * C++ + * + * //assuming that exampleGeometry is a shared pointer to a XdmfGeometry object that has been filled with data + * unsigned int numPoints = exampleGeometry->getNumberPoints(); + * + * Python + * + * ''' + * assuming that exampleGeometry is a shared pointer to a XdmfGeometry object that has been filled with data + * ''' + * numPoints = exampleGeometry.getNumberPoints() */ virtual unsigned int getNumberPoints() const; /** * Get the XdmfGeometryType associated with this geometry. * + * Example of use: + * + * C++ + * + * //assuming that exampleGeometry is a shared pointer to a XdmfGeometry object + * shared_ptr exampleType = exampleGeometry->getType(); + * + * Python + * + * ''' + * assuming that exampleGeometry is a shared pointer to a XdmfGeometry object + * ''' + * exampleType = exampleGeometry.getType() + * * @return XdmfGeometryType of this geometry. */ shared_ptr getType() const; @@ -74,6 +112,18 @@ public: /** * Set the XdmfGeometryType associated with this geometry. * + * Example of use: + * + * C++ + * + * shared_ptr exampleGeometry = XdmfGeometry::New(); + * exampleGeometry->setType(XdmfGeometryType::XYZ()); + * + * Python + * + * exampleGeometry = XdmfGeometry.New() + * exampleGeometry.setType(XdmfGeometryType.XYZ()) + * * @param type the XdmfGeometryType to set. */ void setType(const shared_ptr type); diff --git a/XdmfGeometryType.hpp b/XdmfGeometryType.hpp index 80d06af04ca87a2e020d9516ea0fc7499ea0a6e3..0abc87f85ca2466ff49c8694c7eeccfa718a5cb9 100644 --- a/XdmfGeometryType.hpp +++ b/XdmfGeometryType.hpp @@ -37,6 +37,14 @@ * XdmfGeometryType can be created by calling one of the static * methods in the class, i.e. XdmfAttributeType::XYZ(). * + * Example of use: + * + * //Assuming that exampleGeometry is a shared pointer to an XdmfGeometry with its type set + * if (exampleGeometry->getType() == XdmfGeometry::XYZ()) + * { + * //do whatever is to be done if the geometry is xyz + * } + * * Xdmf supports the following geometry types: * NoGeometryType * XYZ @@ -58,6 +66,11 @@ public: /** * Get the dimensions of this geometry type - i.e. XYZ = 3. * + * Example of use: + * + * unsigned int exampleDimensions = XdmfGeometryType::XYZ()->getDimensions(); + * //The variable exampleDimensions now holds the number of dimensions that XYZ has + * * @return an int containing number of dimensions. */ virtual unsigned int getDimensions() const; @@ -65,6 +78,11 @@ public: /** * Get the name of this geometry type. * + * Example of use: + * + * std::string exampleName = XdmfGeometryType::XYZ()->getName(); + * //The variable exampleName now holds the name of XYZ + * * @return the name of this geometry type. */ std::string getName() const; diff --git a/XdmfGrid.hpp b/XdmfGrid.hpp index 67f372ffc6aa121d3200557dfe50c6d324336ba2..e5c49309c7125760f88a4d5a42433c43fb6c4099 100644 --- a/XdmfGrid.hpp +++ b/XdmfGrid.hpp @@ -58,14 +58,30 @@ public: virtual ~XdmfGrid() = 0; LOKI_DEFINE_VISITABLE(XdmfGrid, XdmfItem); - XDMF_CHILDREN(XdmfAttribute, Attribute, Name); - XDMF_CHILDREN(XdmfSet, Set, Name); - XDMF_CHILDREN(XdmfMap, Map, Name); + XDMF_CHILDREN(XdmfGrid, XdmfAttribute, Attribute, Name); + XDMF_CHILDREN(XdmfGrid, XdmfSet, Set, Name); + XDMF_CHILDREN(XdmfGrid, XdmfMap, Map, Name); static const std::string ItemTag; /** * Get the geometry associated with this grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleGeometry = exampleGrid->getGeometry(); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleGeometry = exampleGrid.getGeometry() + * * @return the geometry associated with this grid. */ shared_ptr getGeometry() const; @@ -77,6 +93,22 @@ public: /** * Get the name of the grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * std::string exampleName = exampleGrid->getName(); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleName = exampleGrid.getName() + * * @return the name of the grid. */ std::string getName() const; @@ -84,6 +116,22 @@ public: /** * Get the time associated with this grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleTime = exampleGrid->getTime(); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleTime = exampleGrid.getTime() + * * @return pointer to the XdmfTime attached to this grid. If no * XdmfTime is attached, return a NULL pointer. */ @@ -92,6 +140,16 @@ public: /** * Get the time associated with this grid (const version). * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleTime = exampleGrid->getTime(); + * + * Python: Python doesn't have a constant version + * * @return pointer to the XdmfTime attached to this grid. If no * XdmfTime is attached, return a NULL pointer. */ @@ -100,6 +158,22 @@ public: /** * Get the topology associated with this grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleTopology = exampleGrid->getTopology(); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleTopology = exampleGrid.getTopology() + * * @return the topology associated with this grid. */ shared_ptr getTopology() const; @@ -109,6 +183,24 @@ public: /** * Set the name of the grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * std::string newName = "New Name"; + * exampleGrid->setName(newName); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * newName = "New Name" + * exampleGrid.setName(newName) + * * @param name of the grid to set. */ void setName(const std::string & name); @@ -116,6 +208,24 @@ public: /** * Set the time associated with this grid. * + * Example of use: + * + * C++ + * + * //using an unstructured grid since XdmfGrid is an abstract class + * //Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr newTime = XdmfTime::New(20.0); + * exampleGrid->setTime(newTime); + * + * Python + * + * ''' + * using an unstructured grid since XdmfGrid is an abstract class + * Assumming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * newTime = XdmfTime.New(20.0) + * exampleGrid.setTime(newTime) + * * @param time an XdmfTime to associate with this grid. */ void setTime(const shared_ptr time); diff --git a/XdmfGridCollection.hpp b/XdmfGridCollection.hpp index d6af6d4191cb09fbeed629682e094bfcd7fc0f71..aad8a412a3d3d3ca041bf57140090cf28b77a5db 100644 --- a/XdmfGridCollection.hpp +++ b/XdmfGridCollection.hpp @@ -51,6 +51,16 @@ public: /** * Create a new XdmfGridCollection. * + * Example of use: + * + * C++ + * + * shared_ptr exampleCollection = XdmfGridCollection::New(); + * + * Python + * + * exampleCollection = XdmfGridCollection.New() + * * @return constructed XdmfGridCollection. */ static shared_ptr New(); @@ -67,6 +77,20 @@ public: /** * Get the XdmfGridCollectionType associated with this grid collection. * + * Example of use: + * + * C++ + * + * //Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set + * shared_ptr exampleType = exampleCollection->getType(); + * + * Python + * + * ''' + * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set + * ''' + * exampleType = exampleCollection.getType() + * * @return XdmfGridCollectionType of this collection. */ shared_ptr getType() const; @@ -77,6 +101,30 @@ public: /** * Insert an information into the grid collection. * + * Example of use: + * + * C++ + * + * //Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set + * shared_ptr exampleInformation = XdmfInformation::New(); + * std::string newKey = "New Key"; + * std::string newValue = "New Value"; + * exampleInformation->setKey(newKey); + * exampleInformation->setValue(newValue); + * exampleCollection->insert(exampleInformation); + * + * Python + * + * ''' + * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set + * ''' + * exampleInformation = XdmfInformation.New() + * newKey = "New Key" + * newValue = "New Value" + * exampleInformation.setKey(newKey) + * exampleInformation.setValue(newValue) + * exampleCollection.insert(exampleInformation) + * * @param information an XdmfInformation to attach to this item. */ void insert(const shared_ptr information); @@ -85,6 +133,20 @@ public: * Set the XdmfGridCollectionType associated with this grid * collection. * + * Example of use: + * + * C++ + * + * //Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object + * exampleCollection->setType(XdmfGridCollectionType::Temporal()); + * + * Python + * + * ''' + * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object + * ''' + * exampleCollection.setType(XdmfGridCollectionType.Temporal()) + * * @param type the XdmfGridCollectionType to set. */ void setType(const shared_ptr type); diff --git a/XdmfGridCollectionType.hpp b/XdmfGridCollectionType.hpp index 58f2fb566ce36cf2f1245555f3b333ab2c7af069..f6b8a3f9eba73799172042c44db2f477efa99f42 100644 --- a/XdmfGridCollectionType.hpp +++ b/XdmfGridCollectionType.hpp @@ -37,6 +37,14 @@ * the static methods in the class, * i.e. XdmfGridCollectionType::Temporal(). * + * Example of use: + * + * //Assuming that exampleCollection is a shared pointer to an XmdfGridCollection with a type that has been set + * if (exampleCollection->getType() == XdmfGridCollectionType::Temporal()) + * { + * //do whatever is to be done if the grid collection is temporal + * } + * * Xdmf supports the following collection types: * NoCollectionType * Spatial diff --git a/XdmfItemFactory.hpp b/XdmfItemFactory.hpp index 57377620e73522176ad413926b1a714c302bf66a..4cb2f30a0946dfbb2c25e7ae86f8ff94fe4af56a 100644 --- a/XdmfItemFactory.hpp +++ b/XdmfItemFactory.hpp @@ -42,6 +42,16 @@ public: /** * Create a new XdmfItemFactory. * + * Example of use: + * + * C++ + * + * shared_ptr exampleFactory = XdmfItemFactory::New(); + * + * Python + * + * exampleFactory = XdmfItemFactory.New() + * * @return constructed XdmfItemFactory. */ static shared_ptr New(); diff --git a/XdmfMap.hpp b/XdmfMap.hpp index 6dbc3b4422ef435ca9d081152e8892331bc890e6..c8bcdad45ebe8cefbaf616c2f0828b1a04d27b5e 100644 --- a/XdmfMap.hpp +++ b/XdmfMap.hpp @@ -65,6 +65,16 @@ public: /** * Create a new XdmfMap. * + * Example of use: + * + * C++ + * + * shared_ptr exampleMap = XdmfMap::New(); + * + * Python + * + * exampleMap = XdmfMap.New() + * * @return constructed XdmfMap. */ static shared_ptr New(); @@ -74,6 +84,75 @@ public: * entry in the globalNodeIds vector contains the global node ids * for that partition. * + * Example of use: + * + * C++ + * + * std::vector > holdGlobalNodes; + * shared_ptr nodeAttribute = XdmfAttribute::New(); + * //The globalNodeIDs are placed into the attribute + * //The index they are at in the attribute corresponds to their localNodeID + * nodeAttribute->insert(0, 1); + * nodeAttribute->insert(1, 5); + * nodeAttribute->insert(2, 8); + * nodeAttribute->insert(3, 9); + * nodeAttribute->insert(4, 4); + * //The Attribute is then added to the vector + * //The index that the Attribute has in the vector corresponds to a task id + * holdGlobalNodes.push_back(nodeAttribute); + * //using this method add all the required nodes + * std::vector > exampleMaps = XdmfMap::New(holdGlobalNodes); + * //returns a vector of maps that holds the equivalencies for the nodes provided + * //for example if Attribute 1 had globalNodeID 3 at localNodeID 2 + * //and Attribute 3 had globalNodeID 3 at localNodeID 5 + * //then map 1 would have an entry of (3, 5, 2) + * //and map 3 would have an entry of (1, 2, 5) + * //The entries are formatted (remoteTaskID, remoteLocalNodeID, localNodeID) + * + * Python + * + * grid = XdmfUnstructuredGrid.New() + * + * ''' + * create attributes for each task id + * the index of the node id in the attribute is the local node id + * ''' + * map1Attribute = XdmfAttribute.New() + * map1Attribute.setName("Test Attribute") + * map1Attribute.setType(XdmfAttributeType.Scalar()) + * map1Attribute.setCenter(XdmfAttributeCenter.Node()) + * map1Vals = [1,2,3,4,5,7,9] + * map1Attribute.insertAsInt32(0, map1Vals) + * + * map2Attribute = XdmfAttribute.New() + * map2Attribute.setName("Test Attribute") + * map2Attribute.setType(XdmfAttributeType.Scalar()) + * map2Attribute.setCenter(XdmfAttributeCenter.Node()) + * map2Vals = [9,8,7,4,3] + * map2Attribute.insertAsInt32(0, map2Vals) + * + * ''' + * insert the attributes into a vector + * the id of the attribute in the vector is equal to the task id + * ''' + * testVector = AttributeVector() + * testVector.push_back(map1Attribute) + * testVector.push_back(map2Attribute) + * + * testMap = XdmfMap.New(testVector) + * + * ''' + * returns a vector of maps that holds the equivalencies for the nodes provided + * for example if Attribute 1 had globalNodeID 3 at localNodeID 2 + * and Attribute 3 had globalNodeID 3 at localNodeID 5 + * then map 1 would have an entry of (3, 5, 2) + * and map 3 would have an entry of (1, 2, 5) + * The entries are formatted (remoteTaskID, remoteLocalNodeID, localNodeID) + * ''' + * + * grid.insert(testMap[0]) + * grid.insert(testMap[1]) + * * @param globalNodeIds a vector of attributes containing globalNodeId * values for each partition to be mapped. * @@ -93,6 +172,80 @@ public: /** * Get stored boundary communicator map. * + * Example of use: + * + * C++ + * + * //Assuming that exampleMap is a shared pointer to an XdmfMap object filled with the following tuples + * //(1, 1, 9) + * //(1, 2, 8) + * //(2, 3, 7) + * //(2, 4, 6) + * //(3, 5, 5) + * //(3, 6, 4) + * std::map > taskIDMap = exampleMap->getMap(); + * //taskIDMap now contains the same tuples as exampleMap + * std::map >::iterator taskWalker = taskIDMap.begin(); + * int taskIDValue = (*taskWalker).first; + * //taskIDValue is now equal to 1, because that is the first taskID listed + * std::map nodeIDMap = taskIDMap[1]; + * //nodeIDMap now contains the following tuples because it retrieved the tuples associated with taskID 1 + * //(1, 9) + * //(2, 8) + * std::map::iterator mapWalker = nodeIDMap.begin(); + * int localNodeValue = (*mapWalker).first; + * //localNodeValue is now equal to 1, because it is the first entry in the first tuple in the set + * std::set remoteNodeSet = exampleMap[1]; + * //remoteNodeSet now contains all remoteLocalNodeIDs for taskID 1 and LocalNode 1 + * //in this case remoteNodeSet contains (9) + * std::set::iterator setWalker = remoteNodeSet.begin(); + * int remoteNodeValue = (*setWalker); + * //remoteNodeValue now equals 9 + * + * Python + * + * ''' + * Assuming that exampleMap is a shared pointer to an XdmfMap object filled with the following tuples + * (1, 1, 9) + * (1, 2, 8) + * (2, 3, 7) + * (2, 4, 6) + * (3, 5, 5) + * (3, 6, 4) + * ''' + * taskIDMap = exampleMap.getMap() + * i = 0 + * for val in taskIDMap: + * print val + * i = i + 1 + * if i == taskIDMap.size(): + * break + * ''' + * This prints out all the task IDs + * unless the break is called on the last iteration the program will fail because of an issue with SWIG + * ''' + * nodeIDMap = taskIDMap[1] + * ''' + * nodeIDMap now contains the following tuples because it retrieved the tuples associated with taskID 1 + * (1, 9) + * (2, 8) + * ''' + * i = 0 + * for val in nodeIDMap: + * print val + * i = i + 1 + * if i == nodeIDMap.size(): + * break + * ''' + * This prints out all the local node IDs + * unless the break is called on the last iteration the program will fail because of an issue with SWIG + * ''' + * for val in nodeIDMap[1]: + * print val + * ''' + * prints out all the remote node values associated with taskID 1 and localNode 1 + * ''' + * * @return stored boundary communicator map. */ std::map getMap() const; @@ -100,6 +253,20 @@ public: /** * Get name of boundary communicator map. * + * Example of use: + * + * C++ + * + * //Assumming that exampleMap is a shared pointer to a XdmfMap object + * std::string exampleName = exampleMap->getName(); + * + * Python + * + * ''' + * Assumming that exampleMap is a shared pointer to a XdmfMap object + * ''' + * exampleName = exampleMap.getName() + * * @return name of boundary communicator map. */ std::string getName() const; @@ -108,6 +275,64 @@ public: * Given a remote task id return a map of local node ids to remote * node ids * + * Example of use: + * + * C++ + * + * //Assuming that exampleMap is a shared pointer to an XdmfMap object filled with the following tuples + * //(1, 1, 9) + * //(1, 2, 8) + * //(2, 3, 7) + * //(2, 4, 6) + * //(3, 5, 5) + * //(3, 6, 4) + * std::map nodeIDMap = exampleMap->getRemoteNodeIds(1); + * //nodeIDMap now contains the following tuples because it retrieved the tuples associated with taskID 1 + * //(1, 9) + * //(2, 8) + * std::map::iterator mapWalker = nodeIDMap.begin(); + * int localNodeValue = (*mapWalker).first; + * //localNodeValue is now equal to 1, because it is the first entry in the first tuple in the set + * std::set remoteNodeSet = exampleMap[1]; + * //remoteNodeSet now contains all remoteLocalNodeIDs for taskID 1 and LocalNode 1 + * //in this case remoteNodeSet contains (9) + * std::set::iterator setWalker = remoteNodeSet.begin(); + * int remoteNodeValue = (*setWalker); + * //remoteNodeValue now equals 9 + * + * Python + * + * ''' + * Assuming that exampleMap is a shared pointer to an XdmfMap object filled with the following tuples + * (1, 1, 9) + * (1, 2, 8) + * (2, 3, 7) + * (2, 4, 6) + * (3, 5, 5) + * (3, 6, 4) + * ''' + * nodeIDMap = exampleMap.getRemoteNodeIds(1) + * ''' + * nodeIDMap now contains the following tuples because it retrieved the tuples associated with taskID 1 + * (1, 9) + * (2, 8) + * ''' + * i = 0 + * for val in nodeIDMap: + * print val + * i = i + 1 + * if i == nodeIDMap.size(): + * break + * ''' + * This prints out all the local node IDs + * unless the break is called on the last iteration the program will fail because of an issue with SWIG + * ''' + * for val in nodeIDMap[1]: + * print val + * ''' + * prints out all the remote node values associated with taskID 1 and localNode 1 + * ''' + * * @param remoteTaskId a task id to retrieve mapping for. * * @return a map of local node ids to a vector of remote node ids on @@ -122,6 +347,28 @@ public: /** * Insert a new entry in map. * + * Example of use: + * + * C++ + * + * shared_ptr exampleMap = XdmfMap::New(); + * unsigned int newRemoteTaskID = 4; + * unsigned int newLocalNodeID = 7; + * unsigned int newRemoteLocalNodeID = 3; + * exampleMap->insert(newRemoteTaskID, newLocalNodeID, newRemoteLocalNodeID); + * //This inserts an entry of (4, 7, 3) into the map + * + * Python + * + * exampleMap = XdmfMap.New() + * newRemoteTaskID = 4 + * newLocalNodeID = 7 + * newRemoteLocalNodeID = 3 + * exampleMap.insert(newRemoteTaskID, newLocalNodeID, newRemoteLocalNodeID) + * ''' + * This inserts an entry of (4, 7, 3) into the map + * ''' + * * @param remoteTaskId task id where the remoteLoalNodeId is located. * @param localNodeId the node id of the node being mapped. * @param remoteLocalNodeId a node id on the remoteTaskId that the @@ -135,23 +382,132 @@ public: * Returns whether the map is initialized (contains values in * memory). * + * Example of use: + * + * C++ + * + * //Assumming that exampleMap is a shared pointer to a XdmfMap object + * if (exampleMap->isInitialized()) + * { + * //Do what is to be done if the map contains values + * } + * + * Python + * + * ''' + * Assumming that exampleMap is a shared pointer to a XdmfMap object + * ''' + * if exampleMap.isInitialized(): + * ''' + * Do what is to be done if the map contains values + * ''' + * * @return bool true if map contains values in memory. */ bool isInitialized() const; /** * Read data from disk into memory. + * + * Example of use: + * + * C++ + * + * //Assumming that exampleMap is a shared pointer to a XdmfMap object + * if (!exampleMap->isInitialized()) + * { + * exampleMap->read(); + * } + * + * Python + * + * ''' + * Assumming that exampleMap is a shared pointer to a XdmfMap object + * ''' + * if not(exampleMap.isInitialized()): + * exampleMap.read() */ void read(); /** * Release all data held in memory. The heavy data remain attached. + * + * Example of use: + * + * C++ + * + * //Assumming that exampleMap is a shared pointer to a XdmfMap object + * exampleMap->release(); + * + * Python + * + * ''' + * Assumming that exampleMap is a shared pointer to a XdmfMap object + * ''' + * exampleMap.release() */ void release(); /** * Set the heavy data controllers for this map. * + * Example of use: + * + * C++ + * + * std::string hdf5FilePath = "The HDF5 file path goes here"; + * std::string hdf5SetPath = "The HDF5 set path goes here"; + * int startIndex = 0; //start at the beginning + * int readStride = 1; //read all values + * int readNumber = 10; //read 10 values + * shared_ptr newRemoteTaskController = XdmfHDF5Controller::New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType::Int32(), + * startIndex, readStride, readNumber); + * hdf5FilePath = "The HDF5 file path for the local nodes goes here"; + * hdf5SetPath = "The HDF5 set path for the local nodes goes here"; + * shared_ptr newLocalNodeController = XdmfHDF5Controller::New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType::Int32(), + * startIndex, readStride, readNumber); + * hdf5FilePath = "The HDF5 file path for the remote local nodes goes here"; + * hdf5SetPath = "The HDF5 set path for the remote local nodes goes here"; + * shared_ptr newRemoteLocalNodeController = XdmfHDF5Controller::New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType::Int32(), + * startIndex, readStride, readNumber); + * shared_ptr exampleMap = XdmfMap::New(); + * exampleMap->setHeavyDataControllers(newRemoteTaskController, newLocalNodeController, newRemoteLocalNodeController); + * + * Python + * + * hdf5FilePath = "The HDF5 file path goes here" + * hdf5SetPath = "The HDF5 set path goes here" + * startIndex = 0 + * ''' + * start at the beginning + * ''' + * readStride = 1 + * ''' + * read all values + * ''' + * readNumber = 10 + * ''' + * read 10 values + * ''' + * newRemoteTaskController = XdmfHDF5Controller.New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType.Int32(), + * startIndex, readStride, readNumber) + * hdf5FilePath = "The HDF5 file path for the local nodes goes here" + * hdf5SetPath = "The HDF5 set path for the local nodes goes here" + * newLocalNodeController = XdmfHDF5Controller.New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType.Int32(), + * startIndex, readStride, readNumber) + * hdf5FilePath = "The HDF5 file path for the remote local nodes goes here" + * hdf5SetPath = "The HDF5 set path for the remote local nodes goes here" + * newRemoteLocalNodeController = XdmfHDF5Controller.New( + * hdf5FilePath, hdf5SetPath, XdmfArrayType.Int32(), + * startIndex, readStride, readNumber) + * exampleMap = XdmfMap.New() + * exampleMap.setHeavyDataControllers(newRemoteTaskController, newLocalNodeController, newRemoteLocalNodeController) + * * @param remoteTaskIdsController an XdmfHeavyDataController to the remote * task ids dataset. * @param localNodeIdsController an XdmfHeavyDataController to the local @@ -167,6 +523,95 @@ public: /** * Set the boundary communicator map. * + * Example of use: + * + * C++ + * + * shared_ptr exampleMap = XdmfMap::New(); + * //First create several std::map + * std::map nodeMap; + * nodeMap.insert(pair(2,3)); + * nodeMap.insert(pair(2,6)); + * nodeMap.insert(pair(2,8)); + * nodeMap.insert(pair(3,3)); + * nodeMap.insert(pair(4,7)); + * nodeMap.insert(pair(4,9)); + * std::map nodeMap2; + * nodeMap.insert(pair(5,3)); + * nodeMap.insert(pair(5,6)); + * nodeMap.insert(pair(5,8)); + * nodeMap.insert(pair(7,3)); + * nodeMap.insert(pair(9,7)); + * nodeMap.insert(pair(9,9)); + * //Then create a std::map > + * std::map > taskMap; + * taskMap.insert(pair >(1, nodeMap); + * taskMap.insert(pair >(2, nodeMap2); + * //then the result is set to the XdmfMap + * exampleMap->setMap(taskMap); + * //This fills the XdmfMap with the following tuples + * //(1, 2, 3) + * //(1, 2, 6) + * //(1, 2, 8) + * //(1, 3, 3) + * //(1, 4, 7) + * //(1, 4, 9) + * //(2, 5, 3) + * //(2, 5, 6) + * //(2, 5, 8) + * //(2, 7, 3) + * //(2, 9, 7) + * //(2, 9, 9) + * + * Python + * + * newTaskMap = XdmfMapMap() + * newNodeIdMap = XdmfMapNodeIdMap() + * newNodeIdMap[2] = (3, 6, 8) + * newNodeIdMap[3] = (3,) + * newNodeIdMap[4] = (7,9) + * ''' + * newNodeIdMap now contains the following + * (2, 3) + * (2, 6) + * (2, 8) + * (3, 3) + * (4, 7) + * (4, 9) + * ''' + * secondNodeIdMap = XdmfMapNodeIdMap() + * secondNodeIdMap[5] = (3, 6, 8) + * secondNodeIdMap[7] = (3,) + * secondNodeIdMap[9] = (7,9) + * ''' + * secondNodeIdMap now contains the following + * (5, 3) + * (5, 6) + * (5, 8) + * (7, 3) + * (9, 7) + * (9, 9) + * ''' + * newTaskMap[1] = newNodeIdMap + * newTaskMap[2] = secondNodeIdMap + * exampleMap = XdmfMap.New() + * exampleMap.setMap(newTaskMap) + * ''' + * This fills the XdmfMap with the following tuples + * (1, 2, 3) + * (1, 2, 6) + * (1, 2, 8) + * (1, 3, 3) + * (1, 4, 7) + * (1, 4, 9) + * (2, 5, 3) + * (2, 5, 6) + * (2, 5, 8) + * (2, 7, 3) + * (2, 9, 7) + * (2, 9, 9) + * ''' + * * @param map the boundary communicator map to store. */ void setMap(std::map map); @@ -174,6 +619,22 @@ public: /** * Set the name of the boundary communicator map. * + * Example of use: + * + * C++ + * + * //Assumming that exampleMap is a shared pointer to a XdmfMap object + * std::string newName = "New Name"; + * exampleMap->setName(newName); + * + * Python + * + * ''' + * Assumming that exampleMap is a shared pointer to a XdmfMap object + * ''' + * newName = "New Name" + * exampleMap.setName(newName) + * * @param name the name of the boundary communicator map to set. */ void setName(const std::string & name); diff --git a/XdmfReader.hpp b/XdmfReader.hpp index 5d7914b79926d7f6b0b8873de787897d6e1c0cd0..140a862fc1df4ecea3404050bd9568be3209f362 100644 --- a/XdmfReader.hpp +++ b/XdmfReader.hpp @@ -43,6 +43,16 @@ public: /** * Create a new XdmfReader. * + * Example of use: + * + * C++ + * + * shared_ptr exampleReader = XdmfReader::New(); + * + * Python + * + * exampleReader = XdmfReader.New() + * * @return constructed XdmfReader. */ static shared_ptr New(); diff --git a/XdmfRectilinearGrid.hpp b/XdmfRectilinearGrid.hpp index 0f16769ec77a7377ac6c2159bc3cf185de2a649a..3030917aa632e7bbcab23a36f95427d5b9e41a41 100644 --- a/XdmfRectilinearGrid.hpp +++ b/XdmfRectilinearGrid.hpp @@ -50,6 +50,44 @@ public: /** * Create a new rectilinear grid (Two dimensional). * + * Example of use: + * + * C++ + * + * shared_ptr pointsXArray = XdmfArray::New(); + * pointsXArray->pushBack(5); + * pointsXArray->pushBack(6); + * pointsXArray->pushBack(7); + * pointsXArray->pushBack(8); + * pointsXArray->pushBack(9); + * pointsXArray->pushBack(10); + * shared_ptr pointsYArray = XdmfArray::New(); + * pointsYArray->pushBack(3); + * pointsYArray->pushBack(6); + * pointsYArray->pushBack(4); + * pointsYArray->pushBack(8); + * pointsYArray->pushBack(7); + * pointsYArray->pushBack(10); + * shared_ptr exampleGrid = XdmfRectilinearGrid::New(pointsXArray, pointsYArray); + * + * Python + * + * pointsXArray = XdmfArray.New() + * pointsXArray.pushBackAsInt32(5) + * pointsXArray.pushBackAsInt32(6) + * pointsXArray.pushBackAsInt32(7) + * pointsXArray.pushBackAsInt32(8) + * pointsXArray.pushBackAsInt32(9) + * pointsXArray.pushBackAsInt32(10) + * pointsYArray = XdmfArray.New() + * pointsYArray.pushBackAsInt32(3) + * pointsYArray.pushBackAsInt32(6) + * pointsYArray.pushBackAsInt32(4) + * pointsYArray.pushBackAsInt32(8) + * pointsYArray.pushBackAsInt32(7) + * pointsYArray.pushBackAsInt32(10) + * exampleGrid = XdmfRectilinearGrid.New(pointsXArray, pointsYArray) + * * @param xCoordinates the coordinates of points along the x axis * @param yCoordinates the coordinates of points along the y axis. * @@ -62,6 +100,58 @@ public: /** * Create a new rectilinear grid (Three dimensional). * + * Example of use: + * + * C++ + * + * shared_ptr pointsXArray = XdmfArray::New(); + * pointsXArray->pushBack(5); + * pointsXArray->pushBack(6); + * pointsXArray->pushBack(7); + * pointsXArray->pushBack(8); + * pointsXArray->pushBack(9); + * pointsXArray->pushBack(10); + * shared_ptr pointsYArray = XdmfArray::New(); + * pointsYArray->pushBack(3); + * pointsYArray->pushBack(6); + * pointsYArray->pushBack(4); + * pointsYArray->pushBack(8); + * pointsYArray->pushBack(7); + * pointsYArray->pushBack(10); + * shared_ptr pointsZArray = XdmfArray::New(); + * pointsZArray->pushBack(3); + * pointsZArray->pushBack(9); + * pointsZArray->pushBack(4); + * pointsZArray->pushBack(5); + * pointsZArray->pushBack(7); + * pointsZArray->pushBack(2); + * shared_ptr exampleGrid = XdmfRectilinearGrid::New(pointsXArray, pointsYArray, pointsZArray); + * + * Python + * + * pointsXArray = XdmfArray.New() + * pointsXArray.pushBackAsInt32(5) + * pointsXArray.pushBackAsInt32(6) + * pointsXArray.pushBackAsInt32(7) + * pointsXArray.pushBackAsInt32(8) + * pointsXArray.pushBackAsInt32(9) + * pointsXArray.pushBackAsInt32(10) + * pointsYArray = XdmfArray.New() + * pointsYArray.pushBackAsInt32(3) + * pointsYArray.pushBackAsInt32(6) + * pointsYArray.pushBackAsInt32(4) + * pointsYArray.pushBackAsInt32(8) + * pointsYArray.pushBackAsInt32(7) + * pointsYArray.pushBackAsInt32(10) + * pointsZArray = XdmfArray.New() + * pointsZArray.pushBackAsInt32(3) + * pointsZArray.pushBackAsInt32(9) + * pointsZArray.pushBackAsInt32(4) + * pointsZArray.pushBackAsInt32(5) + * pointsZArray.pushBackAsInt32(7) + * pointsZArray.pushBackAsInt32(2) + * exampleGrid = XdmfRectilinearGrid.New(pointsXArray, pointsYArray, pointsZArray) + * * @param xCoordinates the coordinates of points along the x axis * @param yCoordinates the coordinates of points along the y axis. * @param zCoordinates the coordinates of points along the z axis. @@ -76,6 +166,66 @@ public: /** * Create a new rectilinear grid (N dimensional). * + * Example of use: + * + * C++ + * + * shared_ptr pointsXArray = XdmfArray::New(); + * pointsXArray->pushBack(5); + * pointsXArray->pushBack(6); + * pointsXArray->pushBack(7); + * pointsXArray->pushBack(8); + * pointsXArray->pushBack(9); + * pointsXArray->pushBack(10); + * shared_ptr pointsYArray = XdmfArray::New(); + * pointsYArray->pushBack(3); + * pointsYArray->pushBack(6); + * pointsYArray->pushBack(4); + * pointsYArray->pushBack(8); + * pointsYArray->pushBack(7); + * pointsYArray->pushBack(10); + * shared_ptr pointsZArray = XdmfArray::New(); + * pointsZArray->pushBack(3); + * pointsZArray->pushBack(9); + * pointsZArray->pushBack(4); + * pointsZArray->pushBack(5); + * pointsZArray->pushBack(7); + * pointsZArray->pushBack(2); + * std::vector > pointsCollector; + * pointsCollector.push_back(pointsXArray); + * pointsCollector.push_back(pointsYArray); + * pointsCollector.push_back(pointsZArray); + * shared_ptr exampleGrid = XdmfRectilinearGrid::New(pointsCollector); + * + * Python + * + * pointsXArray = XdmfArray.New() + * pointsXArray.pushBackAsInt32(5) + * pointsXArray.pushBackAsInt32(6) + * pointsXArray.pushBackAsInt32(7) + * pointsXArray.pushBackAsInt32(8) + * pointsXArray.pushBackAsInt32(9) + * pointsXArray.pushBackAsInt32(10) + * pointsYArray = XdmfArray.New() + * pointsYArray.pushBackAsInt32(3) + * pointsYArray.pushBackAsInt32(6) + * pointsYArray.pushBackAsInt32(4) + * pointsYArray.pushBackAsInt32(8) + * pointsYArray.pushBackAsInt32(7) + * pointsYArray.pushBackAsInt32(10) + * pointsZArray = XdmfArray.New() + * pointsZArray.pushBackAsInt32(3) + * pointsZArray.pushBackAsInt32(9) + * pointsZArray.pushBackAsInt32(4) + * pointsZArray.pushBackAsInt32(5) + * pointsZArray.pushBackAsInt32(7) + * pointsZArray.pushBackAsInt32(2) + * pointsCollector = ArrayVector() + * pointsCollector.push_back(pointsXArray) + * pointsCollector.push_back(pointsYArray) + * pointsCollector.push_back(pointsZArray) + * exampleGrid = XdmfRectilinearGrid.New(pointsCollector) + * * @param axesCoordinates the coordinates of points along each axis. * * @return constructed rectilinear grid. @@ -91,6 +241,22 @@ public: /** * Get the coordinates of the grid along a single axis. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid with two axes + * shared_ptr readPointsX = exampleGrid->getCoordinates(0); + * shared_ptr readPointsY = exampleGrid->getCoordinates(1); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid with two axes + * ''' + * readPointsX = exampleGrid.getCoordinates(0) + * readPointsY = exampleGrid.getCoordinates(1) + * * @param axisIndex the index of the axis to retrieve, (i.e. 0 for * x-axis). If no array exists at the index, return NULL. * @@ -102,6 +268,16 @@ public: * Get the coordinates of the grid along a single axis (const * version). * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid with two axes + * shared_ptr readPointsX = exampleGrid->getCoordinates(0); + * shared_ptr readPointsY = exampleGrid->getCoordinates(1); + * + * Python: does not support a constant version of this function + * * @param axisIndex the index of the axis to retrieve (i.e. 0 for * x-axis). If no array exists at the index, return NULL. * @@ -113,6 +289,20 @@ public: /** * Get the coordinates of the grid along all axes. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * std::vector > exampleCoordinates = exampleGrid->getCoordinates(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * ''' + * exampleCoordinates = exampleGrid.getCoordinates() + * * @return vector containing an array of coordinates along each * direction. */ @@ -121,6 +311,13 @@ public: /** * Get the coordinates of the grid along all axes (const version). * + * Example of use: + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * const std::vector > exampleCoordinates = exampleGrid->getCoordinates(); + * + * Python: does not support a constant version of this function + * * @return vector containing an array of coordinates along each * direction. */ @@ -130,6 +327,20 @@ public: * Get the dimensions of the grid, the number of points in each * direction. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * shared_ptr exampleDimensions = exampleGrid->getDimensions(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * ''' + * exampleDimensions = exampleGrid->getDimensions(); + * * @return XdmfArray containing dimensions of this grid. */ shared_ptr getDimensions(); @@ -138,6 +349,15 @@ public: * Get the dimensions of the grid, the number of points in each * direction (const version). * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * shared_ptr = exampleGrid->getDimensions(); + * + * Python: Doesn't support a constant version of this function + * * @return XdmfArray containing the dimensions of this grid. */ shared_ptr getDimensions() const; @@ -145,6 +365,34 @@ public: /** * Set the coordinates of the grid along a single axis. * + * Example of use: + * + * C++ + * + * shared_ptr pointsXArray = XdmfArray::New(); + * pointsXArray->pushBack(5); + * pointsXArray->pushBack(6); + * pointsXArray->pushBack(7); + * pointsXArray->pushBack(8); + * pointsXArray->pushBack(9); + * pointsXArray->pushBack(10); + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * exampleGrid->setCoordinates(0, pointsXArray); + * + * Python + * + * pointsXArray = XdmfArray.New() + * pointsXArray.pushBackAsInt32(5) + * pointsXArray.pushBackAsInt32(6) + * pointsXArray.pushBackAsInt32(7) + * pointsXArray.pushBackAsInt32(8) + * pointsXArray.pushBackAsInt32(9) + * pointsXArray.pushBackAsInt32(10) + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * ''' + * exampleGrid.setCoordinates(0, pointsXArray) + * * @param axisIndex the index of the axis to set (i.e. 0 for x-axis). * @param axisCoordinates the coordinates of points along a single axis to * set. @@ -155,6 +403,70 @@ public: /** * Set the coordinates of the grid along all axes. * + * Example of use: + * + * C++ + * + * shared_ptr pointsXArray = XdmfArray::New(); + * pointsXArray->pushBack(5); + * pointsXArray->pushBack(6); + * pointsXArray->pushBack(7); + * pointsXArray->pushBack(8); + * pointsXArray->pushBack(9); + * pointsXArray->pushBack(10); + * shared_ptr pointsYArray = XdmfArray::New(); + * pointsYArray->pushBack(3); + * pointsYArray->pushBack(6); + * pointsYArray->pushBack(4); + * pointsYArray->pushBack(8); + * pointsYArray->pushBack(7); + * pointsYArray->pushBack(10); + * shared_ptr pointsZArray = XdmfArray::New(); + * pointsZArray->pushBack(3); + * pointsZArray->pushBack(9); + * pointsZArray->pushBack(4); + * pointsZArray->pushBack(5); + * pointsZArray->pushBack(7); + * pointsZArray->pushBack(2); + * std::vector > pointsCollector; + * pointsCollector.push_back(pointsXArray); + * pointsCollector.push_back(pointsYArray); + * pointsCollector.push_back(pointsZArray); + * //Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * exampleGrid->setCoordinates(pointsCollector); + * + * Python + * + * pointsXArray = XdmfArray.New() + * pointsXArray.pushBackAsInt32(5) + * pointsXArray.pushBackAsInt32(6) + * pointsXArray.pushBackAsInt32(7) + * pointsXArray.pushBackAsInt32(8) + * pointsXArray.pushBackAsInt32(9) + * pointsXArray.pushBackAsInt32(10) + * pointsYArray = XdmfArray.New() + * pointsYArray.pushBackAsInt32(5) + * pointsYArray.pushBackAsInt32(6) + * pointsYArray.pushBackAsInt32(7) + * pointsYArray.pushBackAsInt32(8) + * pointsYArray.pushBackAsInt32(9) + * pointsYArray.pushBackAsInt32(10) + * pointsZArray = XdmfArray.New() + * pointsZArray.pushBackAsInt32(5) + * pointsZArray.pushBackAsInt32(6) + * pointsZArray.pushBackAsInt32(7) + * pointsZArray.pushBackAsInt32(8) + * pointsZArray.pushBackAsInt32(9) + * pointsZArray.pushBackAsInt32(10) + * pointsCollector = ArrayVector(); + * pointsCollector.push_back(pointsXArray); + * pointsCollector.push_back(pointsYArray); + * pointsCollector.push_back(pointsZArray); + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfRectilinearGrid + * ''' + * exampleGrid.setCoordinates(pointsCollector); + * * @param axesCoordinates the coordinates of points along each axis. */ void diff --git a/XdmfRegularGrid.hpp b/XdmfRegularGrid.hpp index 288ba588fb0c1b68aaa6ed63e8f8a0ba78b173e6..6c262ef3e891916ba9c7c260372d94b3b7cf1659 100644 --- a/XdmfRegularGrid.hpp +++ b/XdmfRegularGrid.hpp @@ -50,6 +50,30 @@ public: /** * Create a new structured grid (Two dimensional). * + * Example of use: + * + * C++ + * + * double newBrickX = 20.0; + * double newBrickY = 20.0; + * unsigned int newPointsX = 5; + * unsigned int newPointsY = 5; + * double newOriginX = 0; + * double newOriginY = 0; + * shared_ptr exampleGrid = XdmfRegularGrid::New( + * newBrickX, newBrickY, newPointsX, newPointsY, newOriginX, newOriginY); + * + * Python + * + * newBrickX = 20.0 + * newBrickY = 20.0 + * newPointsX = 5 + * newPointsY = 5 + * newOriginX = 0.0 + * newOriginY = 0.0 + * exampleGrid = XdmfRegularGrid.New( + * newBrickX, newBrickY, newPointsX, newPointsY, newOriginX, newOriginY) + * * @param xBrickSize the size of the brick in the x direction. * @param yBrickSize the size of the brick in the y direction. * @param xNumPoints the number of points in the x direction. @@ -69,6 +93,36 @@ public: /** * Create a new structured grid (Three dimensional). * + * Example of use: + * + * C++ + * + * double newBrickX = 20.0; + * double newBrickY = 20.0; + * double newBrickZ = 20.0; + * unsigned int newPointsX = 5; + * unsigned int newPointsY = 5; + * unsigned int newPointsZ = 5; + * double newOriginX = 0; + * double newOriginY = 0; + * double newOriginZ = 0; + * shared_ptr exampleGrid = XdmfRegularGrid::New( + * newBrickX, newBrickY, newBrickZ, newPointsX, newPointsY, newPointsZ, newOriginX, newOriginY, newOriginZ); + * + * Python + * + * newBrickX = 20.0 + * newBrickY = 20.0 + * newBrickZ = 20.0 + * newPointsX = 5 + * newPointsY = 5 + * newPointsZ = 5 + * newOriginX = 0.0 + * newOriginY = 0.0 + * newOriginZ = 0.0 + * exampleGrid = XdmfRegularGrid::New( + * newBrickX, newBrickY, newBrickZ, newPointsX, newPointsY, newPointsZ, newOriginX, newOriginY, newOriginZ) + * * @param xBrickSize the size of the brick in the x direction. * @param yBrickSize the size of the brick in the y direction. * @param zBrickSize the size of the brick in the z direction. @@ -94,6 +148,40 @@ public: /** * Create a new structured grid (N dimensional). * + * Example of use: + * + * C++ + * + * shared_ptr newBrickSize = XdmfArray::New(); + * newBrickSize->pushBack(20.0); + * newBrickSize->pushBack(20.0); + * newBrickSize->pushBack(20.0); + * shared_ptr newNumPoints = XdmfArray::New(); + * newNumPoints->pushBack(5); + * newNumPoints->pushBack(5); + * newNumPoints->pushBack(5); + * shared_ptr newOrigin = XdmfArray::New(); + * newOrigin->pushBack(0.0); + * newOrigin->pushBack(0.0); + * newOrigin->pushBack(0.0); + * shared_ptr exampleGrid = XdmfRegularGrid::New(newBrickSize, newNumPoints, newOrigin); + * + * Python + * + * newBrickSize = XdmfArray.New() + * newBrickSize.pushBackAsFloat64(20.0) + * newBrickSize.pushBackAsFloat64(20.0) + * newBrickSize.pushBackAsFloat64(20.0) + * newNumPoints = XdmfArray.New() + * newNumPoints.pushBackAsUInt32(5) + * newNumPoints.pushBackAsUInt32(5) + * newNumPoints.pushBackAsUInt32(5) + * newOrigin = XdmfArray.New() + * newOrigin.pushBackAsFloat64(0.0) + * newOrigin.pushBackAsFloat64(0.0) + * newOrigin.pushBackAsFloat64(0.0) + * exampleGrid = XdmfRegularGrid.New(newBrickSize, newNumPoints, newOrigin) + * * @param brickSize the size of the brick in each direction. * @param numPoints the number of points in each direction. * @param origin the coordinates of the origin. @@ -113,6 +201,20 @@ public: /** * Get the size of the bricks composing the grid. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleBrick = exampleGrid->getBrickSize(); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * exampleBrick = exampleGrid.getBrickSize() + * * @return XdmfArray containing brick sizes for this grid. */ shared_ptr getBrickSize(); @@ -120,6 +222,15 @@ public: /** * Get the size of the bricks composing the grid (const version). * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleBrick = exampleGrid->getBrickSize(); + * + * Python: Does not support a constant version of this function + * * @return XdmfArray containing brick sizes for this grid. */ shared_ptr getBrickSize() const; @@ -128,6 +239,20 @@ public: * Get the dimensions of the grid, the number of points in each * direction. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleDimensions = exampleGrid->getDimensions(); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * exampleDimensions = exampleGrid.getDimensions() + * * @return XdmfArray containing dimensions of this grid. */ shared_ptr getDimensions(); @@ -136,6 +261,15 @@ public: * Get the dimensions of the grid, the number of points in each * direction (const version). * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleDimensions = exampleGrid->getDimensions(); + * + * Python: Does not support a constant version of this function + * * @return XdmfArray containing the dimensions of this grid. */ shared_ptr getDimensions() const; @@ -143,6 +277,20 @@ public: /** * Get the location of the origin of the grid. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleOrigin = exampleGrid->getOrigin(); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * exampleOrigin = exampleGrid.getOrigin() + * * @return XdmfArray containing the location of the origin of the * grid. */ @@ -151,6 +299,15 @@ public: /** * Get the location of the origin of the grid. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr exampleOrigin = exampleGrid->getOrigin(); + * + * Python: Does not support a constant version of this function + * * @return XdmfArray containing the location of the origin of the * grid (const version). */ @@ -159,6 +316,28 @@ public: /** * Set the size of the points composing the grid. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr newBrickSize = XdmfArray::New(); + * newBrickSize->pushBack(20.0); + * newBrickSize->pushBack(20.0); + * newBrickSize->pushBack(20.0); + * exampleGrid->setBrickSize(newBrickSize); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * newBrickSize = XdmfArray.New() + * newBrickSize.pushBackAsFloat64(20.0) + * newBrickSize.pushBackAsFloat64(20.0) + * newBrickSize.pushBackAsFloat64(20.0) + * exampleGrid.setBrickSize(newBrickSize) + * * @param brickSize the sizes of the points composing the mesh. This * should have the same number of terms as the dimensionality of the * mesh. @@ -169,6 +348,28 @@ public: * Set the dimensions of the grid, the number of points in each * direction. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr newNumPoints = XdmfArray::New(); + * newNumPoints->pushBack(5); + * newNumPoints->pushBack(5); + * newNumPoints->pushBack(5); + * exampleGrid->setDimensions(newNumPoints); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * newNumPoints = XdmfArray.New() + * newNumPoints.pushBackAsInt32(5) + * newNumPoints.pushBackAsInt32(5) + * newNumPoints.pushBackAsInt32(5) + * exampleGrid.setDimensions(newNumPoints) + * * @param dimensions the dimension of the grid. */ void setDimensions(const shared_ptr dimensions); @@ -176,6 +377,28 @@ public: /** * Set the origin of the grid. * + * Example of use: + * + * C++ + * + * //Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * shared_ptr newOrigin = XdmfArray::New(); + * newOrigin->pushBack(0.0); + * newOrigin->pushBack(0.0); + * newOrigin->pushBack(0.0); + * exampleGrid->setDimensions(newOrigin); + * + * Python + * + * ''' + * Assuming exampleGrid is a shared pointer to an XdmfRegularGrid object + * ''' + * newOrigin = XdmfArray.New() + * newOrigin.pushBackAsFloat64(0.0) + * newOrigin.pushBackAsFloat64(0.0) + * newOrigin.pushBackAsFloat64(0.0) + * exampleGrid.setDimensions(newOrigin) + * * @param origin location of the origin of the grid. This should * have the same number of terms as the dimensionality of the mesh. */ diff --git a/XdmfSet.hpp b/XdmfSet.hpp index d1ca70259faee8234ebc64d14f2799f49d9b1a05..82768dc47e140e687089f37e72b9e6e2c01a522f 100644 --- a/XdmfSet.hpp +++ b/XdmfSet.hpp @@ -51,6 +51,16 @@ public: /** * Create a new XdmfSet. * + * Example of use: + * + * C++ + * + * shared_ptr exampleSet = XdmfSet::New(); + * + * Python + * + * exampleSet = XdmfSet.New() + * * @return constructed XdmfSet. */ static shared_ptr New(); @@ -58,7 +68,7 @@ public: virtual ~XdmfSet(); LOKI_DEFINE_VISITABLE(XdmfSet, XdmfArray); - XDMF_CHILDREN(XdmfAttribute, Attribute, Name); + XDMF_CHILDREN(XdmfSet, XdmfAttribute, Attribute, Name); static const std::string ItemTag; std::map getItemProperties() const; @@ -68,6 +78,20 @@ public: /** * Get the name of the set. * + * Example of use: + * + * C++ + * + * //Assuming that exampleSet is a shared pointer to an XdmfSet object with its name set + * std::string exampleName = exampleSet->getName(); + * + * Python + * + * ''' + * Assuming that exampleSet is a shared pointer to an XdmfSet object with its name set + * ''' + * exampleName = exampleSet.getName() + * * @return a string containing the name of the set. */ std::string getName() const; @@ -75,6 +99,20 @@ public: /** * Get the XdmfSetType associated with this set. * + * Example of use: + * + * C++ + * + * //Assuming that exampleSet is a shared pointer to an XdmfSet object with its type set + * shared_ptr exampleType = exampleSet->getType(); + * + * Python + * + * ''' + * Assuming that exampleSet is a shared pointer to an XdmfSet object with its type set + * ''' + * exampleType = exampleSet.getType() + * * @return XdmfSetType of this set. */ shared_ptr getType() const; @@ -88,6 +126,20 @@ public: /** * Set the name of the set. * + * Example of use: + * + * C++ + * + * shared_ptr exampleSet = XdmfSet::New(); + * std::string newName = "New Name"; + * exampleSet->setName(newName); + * + * Python + * + * exampleSet = XdmfSet.New() + * newName = "New Name" + * exampleSet.setName(newName) + * * @param name a string containing the name to set. */ void setName(const std::string & name); @@ -95,6 +147,18 @@ public: /** * Set the XdmfSetType associated with this set. * + * Example of use: + * + * C++ + * + * shared_ptr exampleSet = XdmfSet::New(); + * exampleSet->setType(XdmfSetType::Node()); + * + * Python + * + * exampleSet = XdmfSet.New() + * exampleSet.setType(XdmfSetType.Node()) + * * @param type the XdmfSetType to set. */ void setType(const shared_ptr type); diff --git a/XdmfSetType.hpp b/XdmfSetType.hpp index 56a190c9a760c73c9fcb7cf5119415581f5c382f..2435eb7692e7fa8eb3fa2acc8f1bee251555afbe 100644 --- a/XdmfSetType.hpp +++ b/XdmfSetType.hpp @@ -12,6 +12,14 @@ * edges that are part of an XdmfGrid. This property indicates which * type the set contains. * + * Example of use: + * + * //Assuming that exampleSet is a shared pointer to an XdmfSet with its type set + * if (exampleSet->getType() == XdmfSetType::Node()) + * { + * //Do whatever is to be done if the set is a node + * } + * * Xdmf supports the following set types: * NoSetType * Node diff --git a/XdmfTime.hpp b/XdmfTime.hpp index a79faccca78de075b3aa5b072a683e76b74f4c52..8554764e526746abb86326c633d97356cb6ca4f1 100644 --- a/XdmfTime.hpp +++ b/XdmfTime.hpp @@ -40,6 +40,28 @@ public: /** * Create a new XdmfTime. * + * Example of use: + * + * C++ + * + * //specifying a time + * double newTime = 5.0; + * shared_ptr exampleTime = XdmfTime::New(newTime); + * //Or the default case can be used to have time set to 0 + * shared_ptr exampleTime2 = XdmfTime::New(); + * + * Python + * + * ''' + * specifying a time + * ''' + * newTime = 5.0 + * exampleTime = XdmfTime.New(newTime) + * ''' + * Or the default case can be used to have time set to 0 + * ''' + * exampleTime2 = XdmfTime.New() + * * @param value the timeValue of the XdmfTime to create. * @return the new XdmfTime. */ @@ -57,6 +79,20 @@ public: /** * Get the time value associated with this XdmfTime. * + * Example of use: + * + * C++ + * + * //Assumming that exampleTime is a shared pointer to an XdmfTime object + * double readTime = exampleTime->getTime(); + * + * Python + * + * ''' + * Assumming that exampleTime is a shared pointer to an XdmfTime object + * ''' + * readTime = exampleTime.getTime() + * * @return a double containing the time value. */ double getValue() const; @@ -64,6 +100,24 @@ public: /** * Set the time value associated with this XdmfTime. * + * Example of use: + * + * C++ + * + * shared_ptr exampleTime = XdmfTime::New(); + * double newTime = 5.0; + * exampleTime->setValue(newTime); + * //This sets the exampleTime's value to the value of newTime, which is 5.0. + * + * Python + * + * exampleTime = XdmfTime.New() + * newTime = 5.0 + * exampleTime.setValue(newTime) + * ''' + * This sets the exampleTime's value to the value of newTime, which is 5.0. + * ''' + * * @param time a double containing the time value. */ void setValue(const double & time); diff --git a/XdmfTopology.hpp b/XdmfTopology.hpp index b970b8a20491aefcb24b95644d68845a1d7da410..7296a264f0dc47e764d1326ed23d847f5ae77eab 100644 --- a/XdmfTopology.hpp +++ b/XdmfTopology.hpp @@ -59,6 +59,16 @@ public: /** * Create a new XdmfTopology. * + * Example of use: + * + * C++ + * + * shared_ptr exampleTopology = XdmfTopology::New(); + * + * Python + * + * exampleTopology = XdmfTopology.New() + * * @return constructed XdmfTopology. */ static shared_ptr New(); @@ -75,6 +85,20 @@ public: /** * Get the number of elements this Topology contains. * + * Example of use: + * + * C++ + * + * //Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set + * unsigned int numElements = exampleTopology->getNumberElements(); + * + * Python + * + * ''' + * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set + * ''' + * numElements = exampleTopology.getNumberElements() + * * @return int of number elements in the Topology. */ virtual unsigned int getNumberElements() const; @@ -82,6 +106,20 @@ public: /** * Get the XdmfTopologyType associated with this topology. * + * Example of use: + * + * C++ + * + * //Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set + * shared_ptr exampleType = exampleTopology->getType(); + * + * Python + * + * ''' + * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set + * ''' + * exampleType = exampleTopology.getType() + * * @return XdmfTopologyType of the topology. */ shared_ptr getType() const; @@ -89,6 +127,18 @@ public: /** * Set the XdmfTopologyType associated with this topology. * + * Example of use: + * + * C++ + * + * shared_ptr exampleTopology = XdmfTopology::New(); + * exampleTopology->setType(XdmfTopologyType::Pyramid()); + * + * Python + * + * exampleTopology = XdmfTopology.New() + * exampleTopology.setType(XdmfTopologyType.Pyramid()) + * * @param type the XdmfTopologyType to set. */ void setType(const shared_ptr type); diff --git a/XdmfTopologyType.hpp b/XdmfTopologyType.hpp index 49ba887c6f17fd788760cf1758c1b31a5e4d2b54..7d663171935c746942acb933dcb6c4d2daea7750 100644 --- a/XdmfTopologyType.hpp +++ b/XdmfTopologyType.hpp @@ -37,6 +37,14 @@ * calling one of the static methods in the class, * i.e. XdmfTopologyType::Tetrahedron(). * + * Example of use: + * + * //Assuming that exampleTopology is a shared pointer to an XdmfTopology with its type set + * if (exampleTopology->getType() == XdmfTopologyType::Triangle()) + * { + * //Do whatever is to be done if the type is Triangle + * } + * * Xdmf supports the following topology types: * NoTopologyType * Polyvertex - Unconnected Points @@ -131,6 +139,12 @@ public: /** * Get a topology type from id. * + * Example of use: + * + * //Assume that exampleTopology is a shared pointer to an XdmfTopology object with its type set + * unsigned int exampleID = exampleTopology->getID(); + * shared_ptr createdTopology = XdmfTopology::New(exampleID); + * * @param id of the topology type. * * @return topology type corresponding to id - if no topology type is found @@ -141,6 +155,15 @@ public: /** * Get the cell type associated with this topology type. * + * Example of use: + * + * XdmfTopologyType::CellType exampleType = XdmfTopologyType::Linear; + * //Assuming that exampleTopology is a shared pointer to a filled XdmfTopology object + * if (exampleType == exampleTopology->getCellType()) + * { + * //Do whatever is to be done if the cell type is linear + * } + * * @return a CellType containing the cell type. */ CellType getCellType() const; @@ -148,6 +171,11 @@ public: /** * Get the number of edges per element associated with this topology type. * + * Example of use: + * + * unsigned int numEdges = XdmfTopologyType::Triangle()->getEdgesPerElement(); + * //numEdges now contains the number of edges per element of the Triangle type. + * * @return an unsigned int containing the number of edges per element. */ virtual unsigned int getEdgesPerElement() const; @@ -155,6 +183,11 @@ public: /** * Get the number of faces per element associated with this topology type. * + * Example of use: + * + * unsigned int numFaces = XdmfTopologyType::Triangle()->getFacesPerElement(); + * //numFaces now contains the number of faces per element of the Triangle type. + * * @return an unsigned int containing the number of faces per element. */ virtual unsigned int getFacesPerElement() const; @@ -163,6 +196,11 @@ public: * Get the id of this cell type, necessary in order to create grids * containing mixed cells. * + * Example of use: + * + * unsigned int holdID = XdmfTopologyType::Triangle()->getID(); + * //holdID now contains the ID of the Triangle type. + * * @return the ID of the topology type. */ virtual unsigned int getID() const; @@ -170,6 +208,10 @@ public: /** * Get the name of this topology type. * + * Example of use: + * + * std::string exampleName = XdmfTopologyType::Triangle()->getName(); + * * @return the name of this topology type. */ virtual std::string getName() const; @@ -178,6 +220,11 @@ public: * Get the number of nodes per element associated with this topology * type. * + * Example of use: + * + * unsigned int numNodes = XdmfTopologyType::Triangle()->getNodesPerElement(); + * //numNodes now contains the number of nodes per element of the Triangle type. + * * @return an unsigned int containing number of nodes per element. */ virtual unsigned int getNodesPerElement() const; diff --git a/XdmfUnstructuredGrid.hpp b/XdmfUnstructuredGrid.hpp index 3e8241eb6bbefc95d4a03b9a705e96e6fbc22e38..9dfb5548e25a9df3cfff36af852d9a03a6190550 100644 --- a/XdmfUnstructuredGrid.hpp +++ b/XdmfUnstructuredGrid.hpp @@ -47,6 +47,16 @@ public: /** * Create a new XdmfUnstructuredGrid. * + * Example of use: + * + * C++ + * + * shared_ptr exampleGrid = XdmfUnstructuredGrid::New(); + * + * Python + * + * exampleGrid = XdmfUnstructuredGrid.New() + * * @return constructed XdmfUnstructuredGrid. */ static shared_ptr New(); @@ -54,6 +64,32 @@ public: /** * Create a new XdmfUnstructuredGrid from a XdmfRegularGrid. * + * Example of use: + * + * C++ + * + * double newBrickX = 0.0; + * double newBrickY = 0.0; + * unsigned int newPointsX = 5; + * unsigned int newPointsY = 5; + * double newOriginX = 20.0; + * double newOriginY = 20.0; + * shared_ptr baseGrid = XdmfRegularGrid::New(newBrickX, newBrickY, newPointsX, newPointsY, newOriginX, newOriginY); + * shared_ptr exampleGrid = XdmfUnstructuredGrid::New(baseGrid); + * + * Python + * + * newBrickX = 0.0 + * newBrickY = 0.0 + * newPointsX = 5 + * newPointsY = 5 + * newOriginX = 20.0 + * newOriginY = 20.0 + * baseGrid = XdmfRegularGrid.New(newBrickX, newBrickY, newPointsX, newPointsY, newOriginX, newOriginY) + * exampleGrid = XdmfUnstructuredGrid.New(baseGrid) + * + * @param regularGrid The grid that the unstructured grid will be created from + * * @return constructed XdmfUnstructuredGrid. */ static shared_ptr @@ -66,6 +102,20 @@ public: /** * Get the geometry associated with this grid. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleGeometry = exampleGrid->getGeometry(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleGeometry = exampleGrid.getGeometry() + * * @return the geometry associated with this grid. */ shared_ptr getGeometry(); @@ -75,6 +125,20 @@ public: /** * Get the topology associated with this grid. * + * Example of use: + * + * C++ + * + * //Assuming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * shared_ptr exampleTopology = exampleGrid->getTopology(); + * + * Python + * + * ''' + * Assuming that exampleGrid is a shared pointer to an XdmfUnstructuredGrid object + * ''' + * exampleTopology = exampleGrid.getTopology() + * * @return the topology associated with this grid. */ shared_ptr getTopology(); @@ -82,6 +146,40 @@ public: /** * Set the geometry associated with this grid. * + * Example of use: + * + * C++ + * + * shared_ptr exampleGrid = XdmfUnstructuredGrid::New(); + * shared_ptr newGeometry = XdmfGeometry::New(); + * newGeometry->setType(XdmfGeometryType::XYZ()); + * newGeometry->pushBack(1); + * newGeometry->pushBack(2); + * newGeometry->pushBack(3); + * newGeometry->pushBack(4); + * newGeometry->pushBack(5); + * newGeometry->pushBack(6); + * newGeometry->pushBack(7); + * newGeometry->pushBack(8); + * newGeometry->pushBack(9); + * exampleGrid->setGeometry(newGeometry); + * + * Python + * + * exampleGrid = XdmfUnstructuredGrid.New() + * newGeometry = XdmfGeometry.New() + * newGeometry.setType(XdmfGeometryType.XYZ()) + * newGeometry.pushBackAsInt32(1) + * newGeometry.pushBackAsInt32(2) + * newGeometry.pushBackAsInt32(3) + * newGeometry.pushBackAsInt32(4) + * newGeometry.pushBackAsInt32(5) + * newGeometry.pushBackAsInt32(6) + * newGeometry.pushBackAsInt32(7) + * newGeometry.pushBackAsInt32(8) + * newGeometry.pushBackAsInt32(9) + * exampleGrid.setGeometry(newGeometry) + * * @param geometry an XdmfGeometry to associate with this grid. */ void setGeometry(const shared_ptr geometry); @@ -89,6 +187,40 @@ public: /** * Set the topology associated with this grid. * + * Example of use: + * + * C++ + * + * shared_ptr exampleGrid = XdmfUnstructuredGrid::New(); + * shared_ptr newTopology = XdmfTopology::New(); + * newTopology->setType(XdmfTopologyType::Triangle()); + * newTopology->pushBack(1); + * newTopology->pushBack(2); + * newTopology->pushBack(3); + * newTopology->pushBack(4); + * newTopology->pushBack(5); + * newTopology->pushBack(6); + * newTopology->pushBack(7); + * newTopology->pushBack(8); + * newTopology->pushBack(9); + * exampleGrid->setTopology(newTopology); + * + * Python + * + * exampleGrid = XdmfUnstructuredGrid.New() + * newTopology = XdmfTopology.New() + * newTopology.setType(XdmfTopologyType.Triangle()) + * newTopology.pushBackAsInt32(1) + * newTopology.pushBackAsInt32(2) + * newTopology.pushBackAsInt32(3) + * newTopology.pushBackAsInt32(4) + * newTopology.pushBackAsInt32(5) + * newTopology.pushBackAsInt32(6) + * newTopology.pushBackAsInt32(7) + * newTopology.pushBackAsInt32(8) + * newTopology.pushBackAsInt32(9) + * exampleGrid.setTopology(newTopology) + * * @param topology an XdmfTopology to associate with this grid. */ void setTopology(const shared_ptr topology); diff --git a/core/XdmfArray.hpp b/core/XdmfArray.hpp index e7ecddb8c3cf4c686621980defba4261fd65cc87..8f9431247c7c3a26d803aa8a31bda60868c10535 100644 --- a/core/XdmfArray.hpp +++ b/core/XdmfArray.hpp @@ -97,6 +97,16 @@ public: /** * Create a new XdmfArray. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * + * Python + * + * exampleArray = XdmfArray.New() + * * @return constructed XdmfArray. */ static shared_ptr New(); @@ -108,17 +118,69 @@ public: /** * Remove all values from this array. + * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * exampleArray->clear(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleArray.clear() */ void clear(); /** * Remove a value from this array. + * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to a XdmfArray object with the following values + * // [0, 1, 2, 3, 4, 5, 6, 7] + * unsigned int erasedIndex = 4; + * exampleArray->erase(erasedIndex); + * //exampleArray now contains the following + * // [0, 1, 2, 3, 5, 6, 7] + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to a XdmfArray object with the following values + * [0, 1, 2, 3, 4, 5, 6, 7] + * ''' + * erasedIndex = 4; + * exampleArray.erase(erasedIndex) + * ''' + * exampleArray now contains the following + * [0, 1, 2, 3, 5, 6, 7] + * ''' */ void erase(const unsigned int index); /** * Get the data type of this array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to a filled XdmfArray object + * shared_ptr exampleType = exampleArray->getArrayType(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to a filled XdmfArray object + * ''' + * exampleType = exampleArray.getArrayType() + * * @return a XdmfArrayType containing the data type for the array. */ shared_ptr getArrayType() const; @@ -127,6 +189,20 @@ public: * Get the capacity of this array, the number of values the array * can store without reallocation. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * unsigned int exampleCapacity = exampleArray->getCapacity(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleCapacity = exampleArray.getCapacity() + * * @return the capacity of this array. */ unsigned int getCapacity() const; @@ -134,6 +210,20 @@ public: /** * Get the dimensions of the array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * std::vector exampleDimensions = exampleArray->getDimensions(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleDimensions = exampleArray.getDimensions() + * * @return the dimensions of the array. */ std::vector getDimensions() const; @@ -141,6 +231,20 @@ public: /** * Get the dimensions of the array as a string. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * std::string exampleDimensions = exampleArray->getDimensionsString(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleDimensions = exampleArray.getDimensionsString() + * * @return the dimensions of the array as a string. */ std::string getDimensionsString() const; @@ -148,6 +252,20 @@ public: /** * Get the heavy data controller attached to this array. * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object that has a heavy data controller + * shared_ptr exampleController = exampleArray->getHeavyDataController(); + * + * Python + * + * ''' + * Assume that exampleArray is a shared pointer to an XdmfArray object that has a heavy data controller + * ''' + * exampleController = exampleArray.getHeavyDataController() + * * @return the heavy data controller attached to this array. */ shared_ptr getHeavyDataController(); @@ -156,6 +274,15 @@ public: * Get the heavy data controller attached to this array (const * version). * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object that has a heavy data controller + * shared_ptr exampleController = exampleArray->getHeavyDataController(); + * + * Python: Doesn't support a constant version of this function + * * @return the heavy data controller attached to this array. */ shared_ptr @@ -168,6 +295,20 @@ public: /** * Get the name of the array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * std::string exampleName = exampleArray->getItemName(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleName = exampleArray.getItemName() + * * @return a string containing the name of the array. */ std::string getName() const; @@ -175,6 +316,20 @@ public: /** * Get the number of values stored in this array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * unsigned int exampleSize = exampleArray->getSize(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleSize = exampleArray.getSize() + * * @return the number of values stored in this array. */ unsigned int getSize() const; @@ -182,6 +337,29 @@ public: /** * Get a copy of a single value stored in this array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to a XdmfArray object with the following values + * // [0, 1, 2, 3, 4, 5, 6, 7] all of which are int + * int exampleValue = exampleArray->getValue(4); + * //exampleValue now has the value of what was stored at index 4, which in this case is 4 + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to a XdmfArray object with the following values + * [0, 1, 2, 3, 4, 5, 6, 7] all of which are int + * ''' + * exampleValue = exampleArray->getValueAsInt32(4); + * ''' + * exampleValue now has the value of what was stored at index 4, which in this case is 4 + * The data type of the returned value can be changed by changing the function name + * getValueAsInt32 returns an int value while getValueAsFloat64 returns a double value + * Variations of this function exist for all supported data types + * ''' + * * @return the requested value. */ template @@ -190,6 +368,21 @@ public: /** * Get a copy of the values stored in this array * + * Example of use: + * + * C++ + * + * int storeArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * shared_ptr exampleArray = XdmfArray::New(); + * exampleArray->insert(0, &storeArray, 10, 1, 1); + * int readArray [10] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; + * exampleArray->getValues(0, &readArray, 5, 1, 2); + * //readArray now contains {0, 11, 1, 13, 2, 15, 3, 17, 4, 19} + * exampleArray->getValues(0, &readArray, 5, 2, 1); + * //readArray now contains {0, 2, 4, 6, 8, 15, 3, 17, 4, 19} + * + * Python: This function is not supported in Python + * * @param startIndex the index in this array to begin copying from. * @param valuesPointer a pointer to an array to copy into. * @param numValues the number of values to copy. @@ -208,6 +401,16 @@ public: /** * Get a smart pointer to the internal values stored in this array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object filled with ints + * shared_ptr > exampleValues = exampleArray->getValuesInternal(); + * + * Python: + * Python does not support this version of the getValuesInternal function, it defaults to the version that returns a void pointer + * * @return a smart pointer to the internal vector of values stored * in this array. */ @@ -217,6 +420,24 @@ public: /** * Get a pointer to the internal values stored in this array. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * void * exampleValues = exampleArray->getValuesInternal(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleValues = exampleArray->getValuesInternal(); + * ''' + * due to the way python handles void pointers, this function is only useful for getting a pointer to pass + * if the retrieval of the internal values of the array is required, another function should be used + * ''' + * * @return a void pointer to the first value stored in this array. */ void * getValuesInternal(); @@ -225,6 +446,14 @@ public: * Get a pointer to the internal values stored in this array (const * version). * + * Example of use: + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * const void * exampleValues = exampleArray->getValuesInternal(); + * + * Python: + * Python does not support this version of the getValuesInternal function, it defaults to the version that returns a void pointer + * * @return a void pointer to the first value stored in this array. */ const void * getValuesInternal() const; @@ -232,12 +461,40 @@ public: /** * Get the values stored in this array as a string. * + * Example of use: + * + * C++ + * + * //Assuming that exampleArray is a shared pointer to an XdmfArray object + * std::string exampleValues = exampleArray->getValuesString(); + * + * Python + * + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleValues = exampleArray.getValuesString() + * exampleArray = [float(piece) for piece in testArray.getValuesString().split()] + * ''' + * This is one method of getting the contained values of the array + * ''' + * * @return a string containing the contents of the array. */ std::string getValuesString() const; /** - * Initialize the array to contain a particular type. + * Initialize the array to a specific size. + * + * Example of use: + * + * C++ + * + * int newSize = 10; + * //Assuming that exampleArray is a shared pointer to an XdmfArray containing ints + * shared_ptr > exampleVector = exampleArray->initialize(newSize); + * + * Python: Does not support this version of initialize * * @param size the number of values in the initialized array. * @@ -248,7 +505,20 @@ public: shared_ptr > initialize(const unsigned int size = 0); /** - * Initialize the array to contain a particular type. + * Initialize the array to specific dimensions. + * + * Example of use: + * + * C++ + * + * vector newSize; + * newSize.push_back(5); + * newSize.push_back(5); + * newSize.push_back(5); + * //Assuming that exampleArray is a shared pointer to an XdmfArray containing ints + * shared_ptr > exampleVector = exampleArray->initialize(newSize); + * + * Python: Does not support this version of initialize * * @param dimensions the dimensions of the initialized array. * @@ -260,7 +530,23 @@ public: initialize(const std::vector & dimensions); /** - * Initialize the array to contain a particular type. + * Initialize the array to contain a specified amount of a particular type. + * + * Example of use: + * + * C++ + * + * int newSize = 10; + * //Assuming that exampleArray is a shared pointer to an XdmfArray + * exampleArray->initialize(XdmfArrayType::Int32(), newSize); + * + * Python + * + * newSize = 10 + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray + * ''' + * exampleArray.initialize(XdmfArrayType.Int32(), newSize) * * @param arrayType the type of array to initialize. * @param size the number of values in the initialized array. @@ -269,7 +555,29 @@ public: const unsigned int size = 0); /** - * Initialize the array to contain a particular type. + * Initialize the array with specified dimensions to contain a particular type. + * + * Example of use: + * + * C++ + * + * vector newSize; + * newSize.push_back(5); + * newSize.push_back(5); + * newSize.push_back(5); + * //Assuming that exampleArray is a shared pointer to an XdmfArray containing ints + * exampleArray->initialize(XdmfArrayType::Int32(), newSize); + * + * Python + * + * newSize = UInt32Vector() + * newSize.push_back(5) + * newSize.push_back(5) + * newSize.push_back(5) + * ''' + * Assuming that exampleArray is a shared pointer to an XdmfArray containing ints + * ''' + * exampleArray.initialize(XdmfArrayType.Int32(), newSize) * * @param arrayType the type of array to initialize. * @param dimensions the number dimensions of the initialized array. @@ -282,6 +590,27 @@ public: /** * Insert value into this array * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int newIndex = 0; + * double newValue = 3.5; + * exampleArray->insert(newIndex, newValue);//the value of 3.5 is inserted at index 0 + * + * Python + * + * exampleArray = XdmfArray.New() + * newIndex = 0 + * newValue = 3.5 + * exampleArray.insertAsFloat64(newIndex, newValue)//the value of 3.5 is inserted at index 0 + * ''' + * this example uses insertAsFloat64 to insert a double value + * versions for all other data types exist + * for example insertAsInt32 inserts as an int + * ''' + * * @param index the index in this array to insert. * @param value the value to insert */ @@ -292,6 +621,40 @@ public: /** * Insert values from an XdmfArray into this array. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * shared_ptr storeArray = XdmfArray::New(); + * exampleArray->insert(0, *initArray, 10, 1, 1); + * storeArray->insert(0, exampleArray, 0, 10, 1, 1); + * //storeArray now contains {0,1,2,3,4,5,6,7,8,9} + * storeArray->insert(0, exampleArray, 0, 5, 2, 1); + * //storeArray now contains {0,1,1,3,2,5,3,7,4,9} + * storeArray->insert(0, exampleArray, 0, 5, 1, 2); + * //storeArray now contains {0,2,4,6,8,5,3,7,4,9} + * + * Python + * + * exampleArray = XdmfArray.New() + * initArray = [0,1,2,3,4,5,6,7,8,9] + * storeArray = XdmfArray.New(; + * exampleArray.insert(0, initArray) + * storeArray.insert(0, exampleArray, 0, 10, 1, 1) + * ''' + * storeArray now contains {0,1,2,3,4,5,6,7,8,9} + * ''' + * storeArray.insert(0, exampleArray, 0, 5, 2, 1) + * ''' + * storeArray now contains {0,1,1,3,2,5,3,7,4,9} + * ''' + * storeArray.insert(0, exampleArray, 0, 5, 1, 2) + * ''' + * storeArray now contains {0,2,4,6,8,5,3,7,4,9} + * ''' + * * @param startIndex the index in this array to begin insertion. * @param values a shared pointer to an XdmfArray to copy into this array. * @param valuesStartIndex the index in the XdmfArray to begin copying. @@ -311,6 +674,42 @@ public: /** * Insert values into this array. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * shared_ptr storeArray = XdmfArray::New(); + * exampleArray->insert(0, *initArray, 10, 1, 1); + * //exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * exampleArray->insert(0, *initArray, 0, 5, 2, 1); + * //exampleArray now contains {0,1,1,3,2,5,3,7,4,9} + * examleArray->insert(0, *initArray, 0, 5, 1, 2); + * //exampleArray now contains {0,2,4,6,8,5,3,7,4,9} + * + * Python + * + * exampleArray = XdmfArray.New() + * initArray = [0,1,2,3,4,5,6,7,8,9] + * exampleArray.insertAsInt32(0, initArray) + * ''' + * exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * ''' + * examleArray.insertAsInt32(0, initArray[0:5:2]) + * ''' + * exampleArray now contains {0,2,4,6,8,5,3,7,4,9} + * ''' + * examleArray.insertAsInt32(0, initArray[::-1]) + * ''' + * exampleArray now contains {9,8,7,6,5,4,3,2,1,0} + * Python uses a different function for each data type + * This example uses insertAsInt32 to insert ints + * insertAsFloat64 can also be used to insert doubles + * This function takes a start index and a list + * Sublists are inserted using Python's sublist notation + * ''' + * * @param startIndex the index in this array to begin insertion. * @param valuesPointer a pointer to the values to copy into this array. * @param numValues the number of values to copy into this array. @@ -329,27 +728,113 @@ public: /** * Returns whether the array is initialized (contains values in * memory). + * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object + * if (exampleArray->isInitialized()) + * { + * //do whatever is to be done if the array is initialized + * } + * + * Python + * + * ''' + * Assume that exampleArray is a shared pointer to an XdmfArray object + * ''' + * if exampleArray.isInitialized(): + * ''' + * do whatever is to be done if the array is initialized + * ''' */ bool isInitialized() const; /** * Copy a value to the back of this array + * + * Example of use; + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int newValue = 5; + * exampleArray->pushBack(newValue); + * + * Python + * + * exampleArray = XdmfArray.New() + * newValue = 5 + * exampleArray.pushBackAsInt32(newValue) + * ''' + * For Python pushBack has multiple functions to cover different data types + * This case used an int so the function was pushBackAsInt32 + * Another example would be to use pushBackAsFloat64 for double values + * ''' */ template void pushBack(const T & value); /** * Read data from disk into memory. + * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object + * if (!exampleArray->isInitialized()) + * { + * exampleArray->read(); + * } + * + * Python + * + * ''' + * Assume that exampleArray is a shared pointer to an XdmfArray object + * ''' + * if not(exampleArray.isInitialized()): + * exampleArray->read(); */ void read(); + /** * Release all data currently held in memory. + * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object + * exampleArray->release(); + * + * Python + * + * ''' + * Assume that exampleArray is a shared pointer to an XdmfArray object + * ''' + * exampleArray.release() */ void release(); /** * Set the capacity of the array to at least size. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * unsigned int newSize = 10; + * exampleArray->reserve(newSize); + * + * Python + * + * exampleArray = XdmfArray.New() + * newSize = 10 + * exampleArray.reserve(newSize) + * * @param size the capacity to set this array to. */ void reserve(const unsigned int size); @@ -360,6 +845,45 @@ public: * the array equal to value. If numValues is less than the current * size, values at indices larger than numValues are removed. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->insert(0, *initArray, 10, 1, 1); + * //exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * unsigned int newSize = 20; + * int baseValue = 1 + * exampleArray->resize(newSize, baseValue) + * //exampleArray now contains {0,1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1,1,1,1} + * newSize = 5; + * exampleArray->resize(newSize, baseValue) + * //exampleArray now contains {0,1,2,3,4} + * + * Python + * + * exampleArray = XdmfArray.New() + * initArray = [0,1,2,3,4,5,6,7,8,9] + * exampleArray.insertAsInt32(0, initArray); + * ''' + * exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * ''' + * newSize = 20; + * baseValue = 1 + * exampleArray.resizeAsInt32(newSize, baseValue) + * ''' + * exampleArray now contains {0,1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1,1,1,1} + * ''' + * newSize = 5; + * exampleArray.resizeAsInt32(newSize, baseValue) + * ''' + * exampleArray now contains {0,1,2,3,4} + * This example uses resizeAsInt32 because the baseValue inserted is to be an integer + * All other supported data types have similarly named function calls + * For example to insert a double resizeAsFloat64 is called + * ''' + * * @param numValues the number of values to resize this array to. * @param value the number to initialize newly created values to, if needed. */ @@ -374,7 +898,48 @@ public: * value. If numValues is less than the current size, values at * indices larger than numValues are removed. * - * @param dimensions the dimensions to resize the arrat to. + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->insert(0, *initArray, 10, 1, 1); + * //exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * std::vector newSize; + * newSize.push_back(4); + * newSize.push_back(5); + * int baseValue = 1 + * exampleArray->resize(newSize, baseValue) + * //exampleArray now contains {0,1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1,1,1,1} + * newSize[0] = 1; + * exampleArray->resize(newSize, baseValue) + * //exampleArray now contains {0,1,2,3,4} + * + * Python + * + * exampleArray = XdmfArray.New() + * initArray = [0,1,2,3,4,5,6,7,8,9] + * exampleArray.insertAsInt32(0, initArray); + * ''' + * exampleArray now contains {0,1,2,3,4,5,6,7,8,9} + * ''' + * newSize = [4, 5]; + * baseValue = 1 + * exampleArray.resizeAsInt32(newSize, baseValue) + * ''' + * exampleArray now contains {0,1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1,1,1,1} + * ''' + * newSize[0] = 1; + * exampleArray.resizeAsInt32(newSize, baseValue) + * ''' + * exampleArray now contains {0,1,2,3,4} + * This example uses resizeAsInt32 because the baseValue inserted is to be an integer + * All other supported data types have similarly named function calls + * For example to insert a double resizeAsFloat64 is called + * ''' + * + * @param dimensions the dimensions to resize the array to. * @param value the number to intialize newly created values to, if needed. */ template @@ -384,6 +949,24 @@ public: /** * Attach an heavy data controller to this array. * + * Example of use: + * + * C++ + * + * //Assume that exampleArray is a shared pointer to an XdmfArray object that has a heavy data controller + * shared_ptr exampleController = exampleArray->getHeavyDataController(); + * shared_ptr newArray = XdmfArray::New(); + * newArray->setHeaveyDataController(exampleController); + * + * Python + * + * ''' + * Assume that exampleArray is a shared pointer to an XdmfArray object that has a heavy data controller + * ''' + * exampleController = exampleArray.getHeavyDataController() + * newArray = XdmfArray.New() + * newArray.setHeaveyDataController(exampleController) + * * @param heavyDataController the heavy data controller to attach to * this array. */ @@ -393,6 +976,20 @@ public: /** * Set the name of the array. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * std::string newName = "New Name"; + * exampleArray->setName(newName); + * + * Python + * + * exampleArray = XdmfArray.New() + * newName = "New Name" + * exampleArray.setName(newName) + * * @param name of the array to set. */ void setName(const std::string & name); @@ -412,6 +1009,16 @@ public: * operation that should not require a copy. Other applications that * use Xdmf for in memory data storage should avoid this function. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->setValuesInternal(&initArray, 10, 1); + * + * Python: does not support setValuesInternal + * * @param arrayPointer a pointer to an array to store in this XdmfArray. * @param numValues the number of values in the array. * @param transferOwnership whether to transfer responsibility for deletion @@ -428,6 +1035,21 @@ public: * ownership of the data and must ensure that the array is still * valid for the entire time Xdmf needs it. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * std::vector initVector; + * initVector.push_back(1); + * initVector.push_back(2); + * initVector.push_back(3); + * initVector.push_back(4); + * initVector.push_back(5); + * exampleArray->setValuesInternal(initVector, 1); + * + * Python: does not support setValuesInternal + * * @param array a vector to store in this XdmfArray. * @param transferOwnership whether to transfer responsibility for deletion * of the array to XdmfArray. @@ -441,6 +1063,22 @@ public: * vector. No copy is made. This array shares ownership with other * references to the smart pointer. * + * Example of use: + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * std::vector initVector; + * initVector.push_back(1); + * initVector.push_back(2); + * initVector.push_back(3); + * initVector.push_back(4); + * initVector.push_back(5); + * shared_ptr storeVector(&initVector); + * exampleArray->setValuesInternal(storeVector); + * + * Python: does not support setValuesInternal + * * @param array a smart pointer to a vector to store in this array. */ template @@ -450,6 +1088,25 @@ public: * Exchange the contents of the vector with the contents of this * array. No copy is made. The internal arrays are swapped. * + * Example of use + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->insert(0, &initArray, 10, 1, 1); + * std::vector initVector; + * initVector.push_back(1); + * initVector.push_back(2); + * initVector.push_back(3); + * initVector.push_back(4); + * initVector.push_back(5); + * //The vector contains {1,2,3,4,5} and the XdmfArray contains {0,1,2,3,4,5,6,7,8,9} + * bool swapSucceded = exampleArray->swap(initVector); + * //The vector contains {0,1,2,3,4,5,6,7,8,9} and the XdmfArray contains {1,2,3,4,5} + * + * Python: The Python version only supports swapping XdmfArrays + * * @param array a vector to exchange values with. * @return bool whether the swap was successful. */ @@ -460,6 +1117,26 @@ public: * Exchange the contents of the vector with the contents of this * array. No copy is made. The internal arrays are swapped. * + * Example of use + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->insert(0, &initArray, 10, 1, 1); + * std::vector initVector; + * initVector.push_back(1); + * initVector.push_back(2); + * initVector.push_back(3); + * initVector.push_back(4); + * initVector.push_back(5); + * shared_ptr storeVector(&initVector); + * //storeVector contains {1,2,3,4,5} and the XdmfArray contains {0,1,2,3,4,5,6,7,8,9} + * bool swapSucceded = exampleArray->swap(storeVector); + * //storeVector contains {0,1,2,3,4,5,6,7,8,9} and the XdmfArray contains {1,2,3,4,5} + * + * Python: The Python version only supports swapping XdmfArrays + * * @param array a smart pointer to a vector to exchange values with. * @return bool whether the swap was successful. */ @@ -470,6 +1147,36 @@ public: * Exchange the contents of an XdmfArray with the contents of this * array. No copy is made. The internal arrays are swapped. * + * Example of use + * + * C++ + * + * shared_ptr exampleArray = XdmfArray::New(); + * int initArray [10] = {0,1,2,3,4,5,6,7,8,9}; + * exampleArray->insert(0, &initArray, 10, 1, 1); + * shared_ptr swapArray = XdmfArray::New(); + * int initArray2 [5] = {1,2,3,4,5}; + * swapArray->insert(0, &initArray2, 5, 1, 1); + * //exampleArray contains {0,1,2,3,4,5,6,7,8,9} and swapArray contains {1,2,3,4,5} + * exampleArray->swap(swapArray); + * //Now exampleArray contains {1,2,3,4,5} and swapArray contains {0,1,2,3,4,5,6,7,8,9} + * + * Python + * + * exampleArray = XdmfArray.New() + * initArray = [0,1,2,3,4,5,6,7,8,9] + * exampleArray.insert(0, initArray) + * swapArray = XdmfArray.New() + * initArray2 = [1,2,3,4,5] + * swapArray.insert(0, initArray2) + * ''' + * exampleArray contains {0,1,2,3,4,5,6,7,8,9} and swapArray contains {1,2,3,4,5} + * ''' + * exampleArray.swap(swapArray) + * ''' + * Now exampleArray contains {1,2,3,4,5} and swapArray contains {0,1,2,3,4,5,6,7,8,9} + * ''' + * * @param array a smart pointer to a vector to exchange values with. */ void swap(const shared_ptr array); diff --git a/core/XdmfArrayType.hpp b/core/XdmfArrayType.hpp index 6be1a644e42e90f45b164f9fefa3e5b6a3858064..8be596aadb5ec449bdca362e08ad661626545e58 100644 --- a/core/XdmfArrayType.hpp +++ b/core/XdmfArrayType.hpp @@ -36,6 +36,13 @@ * A specific XdmfArrayType can be created by calling one of the * static methods in the class, i.e. XdmfArrayType::Int32(). * + * Example of use: + * //Assuming that exampleArray is a shared pointer to an XdmfArray object that has been filled with data + * if (XdmfArrayType::Int8() == exampleArray->getArrayType()) + * { + * //do whatever is to be done with in the case that the array type is Int8 + * } + * * Xdmf supports the following attribute types: * Uninitialized * Int8 @@ -72,6 +79,20 @@ public: * Get the data size, in bytes, of the value associated with this * array type. * + * Example of use: + * + * C++ + * + * unsigned int dataSize = XdmfArrayType::Int8()->getElementSize(); + * //The number of bytes in an Int8 will be stored in the dataSize variable + * + * Python + * + * dataSize = XdmfArrayType.Int8().getElementSize() + * ''' + * The number of bytes in an Int8 will be stored in the dataSize variable + * ''' + * * @return the data size, in bytes. */ unsigned int getElementSize() const; @@ -79,10 +100,24 @@ public: /** * Get the name of the data type. * + * Example of use: + * + * C++ + * + * std::string dataName = XdmfArrayType::Int8()->getName(); + * //The name of the Int8 data type will be stored in the dataName variable + * + * Python + * + * dataName = XdmfArrayType.Int8().getName() + * ''' + * The name of the Int8 data type will be stored in the dataName variable + * ''' + * * @return the name of the data type. */ std::string getName() const; - + void getProperties(std::map & collectedProperties) const; diff --git a/core/XdmfCore.i b/core/XdmfCore.i index 83294dae7c0956e04bc52b114db6fecdbbeed98b..234b4ad55b67fee3cf08c0fc0b5fe97a4bf2a71f 100644 --- a/core/XdmfCore.i +++ b/core/XdmfCore.i @@ -265,6 +265,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i %include std_string.i %include std_vector.i +%include std_map.i %shared_ptr(Loki::BaseVisitor) %shared_ptr(Loki::BaseVisitable) @@ -381,6 +382,14 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i %template(resizeAsUInt16) XdmfArray::resize; %template(resizeAsUInt32) XdmfArray::resize; -%template(UIntVector) std::vector; +%template(UInt8Vector) std::vector; +%template(UInt16Vector) std::vector; +%template(UInt32Vector) std::vector; +%template(Int8Vector) std::vector; +%template(Int16Vector) std::vector; +%template(Int32Vector) std::vector; +%template(Int64Vector) std::vector; +%template(Float32Vector) std::vector; +%template(Float64Vector) std::vector; %template(ItemVector) std::vector >; - +%template(StringMap) std::map; diff --git a/core/XdmfCoreItemFactory.hpp b/core/XdmfCoreItemFactory.hpp index 7b9050766ba7dd32167cd5aa5e663390403913ac..f23cb933bf5c8a8f19d651c1a5104fc70d575c25 100644 --- a/core/XdmfCoreItemFactory.hpp +++ b/core/XdmfCoreItemFactory.hpp @@ -47,6 +47,34 @@ public: /** * Create a new XdmfItem. * + * Example of use: + * + * //using XdmfItemFactory because XdmfCoreItemFactory is abstract + * shared_ptr exampleFactory = XdmfItemFactory::New(); + * std::map newProperties; + * std::vector > newChildren; + * shared_ptr exampleAttribute = + * shared_dynamic_cast(exampleFactory->createItem(XdmfAttribute::ItemTag, newProperties, newChildren)); + * //Same usage as the individual constructors + * //But the item has to be cast afterwards to the correct type. + * //childItems and itemProperties are not added to the item when created this way + * //the collections are used to determine type + * + * Python + * + * ''' + * using XdmfItemFactory because XdmfCoreItemFactory is abstract + * ''' + * exampleFactory = XdmfItemFactory.New() + * newProperties = StringMap() + * newChildren = ItemVector() + * exampleItem = exampleFactory.createItem(XdmfAttribute.ItemTag, newProperties, newChildren) + * ''' + * Same usage as the individual constructors + * childItems and itemProperties are not added to the item when created this way + * the collections are used to determine type + * ''' + * * @param itemTag a string containing the tag of the XdmfItem to create. * @param itemProperties a map of key/value properties for the the XdmfItem. * @param childItems the children of the XdmfItem to create. diff --git a/core/XdmfCoreReader.hpp b/core/XdmfCoreReader.hpp index ec9916609343643db21a5b01b9856f04236dfc04..78e5d3092b0d87560ba0f09dd5650658e940e39e 100644 --- a/core/XdmfCoreReader.hpp +++ b/core/XdmfCoreReader.hpp @@ -54,6 +54,25 @@ public: * Parse a string containing light data into an Xdmf structure in * memory. * + * Example of use: + * + * C++ + * + * //using XdmfReader since XdmfCoreReader is abstract + * shared_ptr exampleReader = XdmfReader::New(); + * std::string readLight = "your light data here"; + * //Assuming that an XdmfArray is the root item generated by the light data provided + * shared_ptr exampleArray = shared_dynamic_cast(reader->parse(readLight)); + * + * Python + * + * ''' + * using XdmfReader since XdmfCoreReader is abstract + * ''' + * exampleReader = XdmfReader.New() + * readLight = "your light data here" + * exampleItem = reader->parse(readLight) + * * @param lightData a string containing light data description of an * Xdmf file. * @@ -64,6 +83,25 @@ public: /** * Read an Xdmf file from disk into memory. * + * Example of use: + * + * C++ + * + * //using XdmfReader since XdmfCoreReader is abstract + * shared_ptr exampleReader = XdmfReader::New(); + * std::string readPath = "your file path here"; + * //Assuming that an XdmfDomain is the root item at the file path provided + * shared_ptr exampleDomain = shared_dynamic_cast(reader->read(readPath)); + * + * Python + * + * ''' + * using XdmfReader since XdmfCoreReader is abstract + * ''' + * exampleReader = XdmfReader.New() + * readPath = "your file path here"; + * exampleItem = reader->read(readPath) + * * @param filePath the path of the Xdmf file to read in from disk. * * @return an XdmfItem at the root of the Xdmf tree. @@ -73,6 +111,26 @@ public: /** * Read part of an Xdmf file from disk into memory. * + * Example of use: + * + * C++ + * + * //using XdmfReader since XdmfCoreReader is abstract + * shared_ptr exampleReader = XdmfReader::New(); + * std::string readPath = "your file path here"; + * std::string readXPath = "your X path here"; + * std::vector > exampleItems = reader->read(readPath, readXPath); + * + * Python + * + * ''' + * using XdmfReader since XdmfCoreReader is abstract + * ''' + * exampleReader = XdmfReader.New() + * readPath = "your file path here" + * readXPath = "your X path here" + * exampleItems = reader.read(readPath, readXPath) + * * @param filePath the path of the Xdmf file to read in from disk. * @param xPath an XPath corresponding to the portion of the file to read. * @@ -85,6 +143,28 @@ public: /** * Read an Xdmf file from disk into memory. * + * Example of use: + * + * C++ + * + * //using XdmfReader since XdmfCoreReader is abstract + * shared_ptr exampleReader = XdmfReader::New(); + * std::string readPath = "your file path here"; + * std::vector > exampleCollection = reader->read(readPath); + * //Used in a similar manner as read, but in this case the read file has multiple items at the returned level + * + * Python + * + * ''' + * using XdmfReader since XdmfCoreReader is abstract + * ''' + * exampleReader = XdmfReader.New() + * readPath = "your file path here" + * exampleCollection = reader.read(readPath) + * ''' + * Used in a similar manner as read, but in this case the read file has multiple items at the returned level + * ''' + * * @param filePath the path of the Xdmf file to read in from disk. * * @return a vector of XdmfItems at the root of the Xdmf tree. @@ -92,6 +172,15 @@ public: virtual std::vector > readItems(const std::string & filePath) const; + /** + * Used by the other functions to read items from an open file. + * + * Since files are closed between reads, this does nothing by itself. + * + * @param xPath An XPath corresponding to the portion of the file to read. + * + * @return A vector of items at the X path provided. + */ std::vector > readPathObjects(const std::string & xPath) const; diff --git a/core/XdmfHDF5Controller.hpp b/core/XdmfHDF5Controller.hpp index f944af7b2cb72a8ff54cad8768d699d0260504f0..30a79bb0084f0e3627ef8d1f8b8afcac01afb020 100644 --- a/core/XdmfHDF5Controller.hpp +++ b/core/XdmfHDF5Controller.hpp @@ -46,6 +46,70 @@ public: /** * Create a new controller for an hdf5 data set on disk. * + * Example of use: + * + * C++ + * + * std::string newPath = "File path to hdf5 file goes here"; + * std::string newSetPath = "path to the set goes here"; + * shared_ptr readType = XdmfArrayType::Int32(); + * std::vector readStarts; + * //Three dimensions, all starting at index 0 + * readStarts.push_back(0); + * readStarts.push_back(0); + * readStarts.push_back(0); + * std::vector readStrides; + * //Three dimensions, no skipping between reads + * readStrides.push_back(1); + * readStrides.push_back(1); + * readStrides.push_back(1); + * std::vector readCounts; + * //Three dimensions, reading 10 values from each + * readCounts.push_back(10); + * readCounts.push_back(10); + * readCounts.push_back(10); + * shared_ptr exampleController = XdmfHDF5Controller::New( + * newPath, + * newSetPath, + * readType, + * readStarts, + * readStrides, + * readCounts); + * + * Python + * + * newPath = "File path to hdf5 file goes here" + * newSetPath = "path to the set goes here" + * readType = XdmfArrayType.Int32() + * readStarts = UInt32Vector() + * ''' + * Three dimensions, all starting at index 0 + * ''' + * readStarts.push_back(0) + * readStarts.push_back(0) + * readStarts.push_back(0) + * readStrides = UInt32Vector() + * ''' + * Three dimensions, no skipping between reads + * ''' + * readStrides.push_back(1) + * readStrides.push_back(1) + * readStrides.push_back(1) + * readCounts = UInt32Vector() + * ''' + * Three dimensions, reading 10 values from each + * ''' + * readCounts.push_back(10) + * readCounts.push_back(10) + * readCounts.push_back(10) + * exampleController = XdmfHDF5Controller.New( + * newPath, + * newSetPath, + * readType, + * readStarts, + * readStrides, + * readCounts); + * * @param hdf5FilePath the location of the hdf5 file the data set resides in. * @param dataSetPath the location of the dataset within the hdf5 file. * @param type the data type of the dataset to read. diff --git a/core/XdmfHDF5ControllerDSM.hpp b/core/XdmfHDF5ControllerDSM.hpp index c38dbb79e11fae581fe71a48c393f35331ecbd0e..8718f0cca9cc7482695b26da373ea11a17f9f59f 100644 --- a/core/XdmfHDF5ControllerDSM.hpp +++ b/core/XdmfHDF5ControllerDSM.hpp @@ -48,6 +48,84 @@ public: /** * Create a new controller for an DSM data set. + * + * Example of use: + * + * C++ + * + * std::string newPath = "Your file path goes here"; + * std::string newSetPath = "The data set path goes here"; + * shared_ptr newType = XdmfArrayType::Int32(); + * std::vector readStarts; + * //Three dimensions, all starting at 0 + * readStarts.push_back(0); + * readStarts.push_back(0); + * readStarts.push_back(0); + * std::vector readStrides; + * //Three dimensions, all of them skip no values + * readStrides.push_back(1); + * readStrides.push_back(1); + * readStrides.push_back(1); + * std::vector readCounts; + * //Three dimensions, read 10 values from all of them + * readCounts.push_back(10); + * readCounts.push_back(10); + * readCounts.push_back(10); + * //assume newDsmBuffer is a pointer to the dsm buffer where the data is stored + * shared_ptr exampleController = XdmfHDF5ControllerDSM::New( + * newPath, + * newSetPath, + * newType, + * readStarts, + * readStrides, + * readCounts, + * newDsmBuffer); + * + * Python + * + * newPath = "Your file path goes here" + * newSetPath = "The data set path goes here" + * newType = XdmfArrayType.Int32() + * readStarts = UInt32Vector() + * ''' + * Three dimensions, all starting at 0 + * ''' + * readStarts.push_back(0) + * readStarts.push_back(0) + * readStarts.push_back(0) + * readStrides = UInt32Vector() + * ''' + * Three dimensions, all of them skip no values + * ''' + * readStrides.push_back(1) + * readStrides.push_back(1) + * readStrides.push_back(1) + * readCounts = UInt32Vector() + * ''' + * Three dimensions, read 10 values from all of them + * ''' + * readCounts.push_back(10) + * readCounts.push_back(10) + * readCounts.push_back(10) + * ''' + * assume newDsmBuffer is a pointer to the dsm buffer where the data is stored + * ''' + * exampleController = XdmfHDF5ControllerDSM.New( + * newPath, + * newSetPath, + * newType, + * readStarts, + * readStrides, + * readCounts, + * newDsmBuffer) + * + * @param hdf5FilePath The path to the hdf5 file that the controller will be accessing + * @param dataSetPath The location within the file of the data the controller with be accessing + * @param type The data type of the data Ex: XdmfArrayType::Int32() + * @param start A vector of the start indexes for all dimensions of the data + * @param stride A vector of the distance between reads for all dimensions of the data + * @param count A vector of the number of values read from all dimensions of the data + * @param dsmBuffer A pointer to the dsm buffer */ static shared_ptr New(const std::string & hdf5FilePath, diff --git a/core/XdmfHDF5Writer.hpp b/core/XdmfHDF5Writer.hpp index 7855b85ffca395490acef424ca763dd6af39f33a..eed1d92dacff4e5aeda9933d3a683988a705ddef 100644 --- a/core/XdmfHDF5Writer.hpp +++ b/core/XdmfHDF5Writer.hpp @@ -53,6 +53,20 @@ public: /** * Construct XdmfHDF5Writer. * + * Example of use: + * + * C++ + * + * std::string newPath = "Your file path goes here"; + * bool replaceOrig = true; + * shared_ptr exampleWriter = XdmfHDF5Writer::New(newPath, replaceOrig); + * + * Python + * + * newPath = "Your file path goes here" + * replaceOrig = True + * exampleWriter = XdmfHDF5Writer.New(newPath, replaceOrig) + * * @param filePath the location of the hdf5 file to output to on disk. * @param clobberFile whether to overwrite the previous file if it exists. * diff --git a/core/XdmfHDF5WriterDSM.hpp b/core/XdmfHDF5WriterDSM.hpp index ed54f05015876ce9076173661e8d0572d84952b8..586dd65c5ee17b5851062c7b055dfc1c3401652b 100644 --- a/core/XdmfHDF5WriterDSM.hpp +++ b/core/XdmfHDF5WriterDSM.hpp @@ -51,6 +51,22 @@ public: /** * Construct XdmfHDF5WriterDSM * + * Example of use: + * + * C++ + * + * std::string newPath = "Your file path goes here"; + * //Assume newDsmBuffer is a pointer to a dsm + * shared_ptr exampleWriter = XdmfHDF5WriterDSM::New(newPath, newDsmBuffer); + * + * Python + * + * newPath = "Your file path goes here" + * ''' + * Assume newDsmBuffer is a pointer to a dsm + * ''' + * exampleWriter = XdmfHDF5WriterDSM.New(newPath, newDsmBuffer) + * * @param filePath the location of the hdf5 file to output to on disk. * @param dsmBuffer the dsm buffer to write to. * @return new XdmfHDF5WriterDSM. diff --git a/core/XdmfHeavyDataController.hpp b/core/XdmfHeavyDataController.hpp index 288153c0b7b0ffdaac1802a3a62f8ef0fb70cc16..5f2af71f7d96a8cdbd1b90b40c09745e39800d92 100644 --- a/core/XdmfHeavyDataController.hpp +++ b/core/XdmfHeavyDataController.hpp @@ -57,6 +57,22 @@ public: * this controller. * For "/home/output.h5:/foo/data" this is "/foo/data" * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * std::string examplePath = exampleController->getDataSetPath(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * examplePath = exampleController.getDataSetPath() + * * @return a std::string containing the path of the data set. */ std::string getDataSetPath() const; @@ -64,6 +80,22 @@ public: /** * Get the dimensions of the heavy data set owned by this controller. * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * std::vector exampleDimensions = exampleController->getDimensions(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * exampleDimensions = exampleController.getDimensions() + * * @return a vector containing the size in each dimension of the heavy data * set owned by this controller. */ @@ -74,6 +106,22 @@ public: * data set owned by this controller resides. * For "/home/output.h5:/foo/data" this is "/home/output.h5" * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * std::string examplePath = exampleController->getFilePath(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * examplePath = exampleController.getFilePath() + * * @return a std::string containing the path to the heavy data file. */ std::string getFilePath() const; @@ -82,6 +130,22 @@ public: * Get the name of this heavy data format. E.g. "HDF" for hdf5 * format. * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * std::string exampleName = exampleController->getName(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * exampleName = exampleController.getName() + * * @return std::string containing the name of this heavy data format */ virtual std::string getName() const = 0; @@ -89,6 +153,22 @@ public: /** * Get the size of the heavy data set owned by this controller. * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * unsigned int exampleSize = exampleController->getSize(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * exampleSize = exampleController.getSize() + * * @return a int containing the size of the heavy data set. */ unsigned int getSize() const; @@ -97,6 +177,22 @@ public: * Get the array type of the heavy data set owned by this * controller. * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * shared_ptr exampleType = exampleController->getType(); + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * exampleType = exampleController.getType() + * * @return an XdmfArrayType containing the array type of the heavy data set. */ shared_ptr getType() const; @@ -105,6 +201,28 @@ public: * Read data owned by this controller on disk into the passed * XdmfArray. * + * Example of use: + * + * C++ + * + * //Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * //Since XdmfHeavyDataController is an abstract class + * shared_ptr exampleArray = XdmfArray::New(); + * exampleController->read(exampleArray); + * //exampleArray now holds the data that exampleController holds. + * + * Python + * + * ''' + * Assuming that exampleController is a shared pointer to an XdmfHDF5Controller object + * Since XdmfHeavyDataController is an abstract class + * ''' + * exampleArray = XdmfArray.New() + * exampleController.read(exampleArray) + * ''' + * exampleArray now holds the data that exampleController holds. + * ''' + * * @param array and XdmfArray to read data into. */ virtual void read(XdmfArray * const array) = 0; diff --git a/core/XdmfHeavyDataWriter.hpp b/core/XdmfHeavyDataWriter.hpp index 019763d75ba76899047b71d1a6d7bf4b6ba1cfe3..7e33acc80f424da224d0ac90ed99eaea45ced864 100644 --- a/core/XdmfHeavyDataWriter.hpp +++ b/core/XdmfHeavyDataWriter.hpp @@ -74,12 +74,40 @@ public: /** * Close file. This is only needed when the file is opened manually * through openFile(). + * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * exampleWriter->closeFile(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * ''' + * exampleWriter.closeFile() */ virtual void closeFile() = 0; /** * Get the path to the heavy data file on disk this writer is writing to. * + * Example of use: + * + * C++ + * + * //Assume that examplewriter is a shared poinnter to a XdmfHDF5Writer. + * std::string examplePath = exampleWriter->getFilePath(); + * + * Python + * + * ''' + * Assume that examplewriter is a shared poinnter to a XdmfHDF5Writer. + * ''' + * examplePath = exampleWriter.getFilePath() + * * @return a std::string containing the path to the heavy file on disk this * writer is writing to. */ @@ -88,6 +116,28 @@ public: /** * Get the Mode of operation for this writer. * + * Example of use: + * + * C++ + * + * XdmfHeavyDataWriter::Mode exampleMode = XdmfHeavyDataWriter::Default; + * //Assuming that exampleWriter is a shared pointer to a XdmfHDF5Writer + * if (exampleWriter->getMode() == exampleMode) + * { + * //Do whatever is to be done if the mode is default + * } + * + * Python + * + * exampleMode = XdmfHeavyDataWriter.Default + * ''' + * Assuming that exampleWriter is a shared pointer to a XdmfHDF5Writer + * ''' + * if exampleWriter.getMode() == exampleMode: + * ''' + * Do whatever is to be done if the mode is default + * ''' + * * @return the Mode of operation for this writer. */ Mode getMode() const; @@ -95,6 +145,20 @@ public: /** * Get whether to release data from memory after writing to disk. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * bool testRelease = exampleWriter->getReleaseData(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * ''' + * testRelease = exampleWriter.getReleaseData() + * * @return true if data is freed after writing */ bool getReleaseData() const; @@ -112,12 +176,40 @@ public: * safe. Opening the file once and writing many datasets may result * in improved performance, but the user must tell the writer when * to open and close the file. + * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * exampleWriter->openFile(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * ''' + * exampleWriter.openFile() */ virtual void openFile() = 0; /** * Set the mode of operation for this writer. * + * Example of use: + * + * C++ + * + * //Assuming that exampleWriter is a shared pointer to a XdmfHDF5Writer + * exampleWriter->setMode(XdmfHeavyDataWriter::Default); + * + * Python + * + * ''' + * Assuming that exampleWriter is a shared pointer to a XdmfHDF5Writer + * ''' + * exampleWriter.setMode(XdmfHeavyDataWriter.Default) + * * @param mode the Mode of operation for this writer. */ void setMode(const Mode mode); @@ -125,6 +217,24 @@ public: /** * Set whether to release data from memory after writing to disk. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * exampleWriter->setReleaseData(true); + * //Sets the writer to release data after writing + * + * Python + * + * ''' + * Assume that exampleWriter is a shared poinnter to a XdmfHDF5Writer. + * ''' + * exampleWriter.setReleaseData(True) + * ''' + * Sets the writer to release data after writing + * ''' + * * @param releaseData true if data should be freed after writing */ void setReleaseData(const bool releaseData = true); @@ -132,6 +242,32 @@ public: /** * Write an XdmfArray to heavy data file on disk. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to an XdmfHDF5Writer. + * shared_ptr exampleArray = XdmfArray::New(); + * exampleArray->pushBack(1); + * exampleArray->pushBack(2); + * exampleArray->pushBack(3); + * exampleArray->pushBack(4); + * exampleArray->pushBack(5); + * exampleWriter->visit(exampleArray, exampleWriter); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to an XdmfHDF5Writer. + * ''' + * exampleArray = XdmfArray.New() + * exampleArray.pushBackAsInt32(1) + * exampleArray.pushBackAsInt32(2) + * exampleArray.pushBackAsInt32(3) + * exampleArray.pushBackAsInt32(4) + * exampleArray.pushBackAsInt32(5) + * exampleWriter.visit(exampleArray, exampleWriter) + * * @param array an XdmfArray to write to heavy data. * @param visitor a smart pointer to this visitor --- aids in grid traversal. */ diff --git a/core/XdmfInformation.hpp b/core/XdmfInformation.hpp index eb733baa4f5a51aeb9cf1f1d27622b0cb27baf51..4e15b9bf02bef9cd2cf776df73f80d4ad339efdd 100644 --- a/core/XdmfInformation.hpp +++ b/core/XdmfInformation.hpp @@ -46,6 +46,24 @@ public: /** * Create a new XdmfInformation. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New(); + * //Then the key and value must be set seperately + * infoExample->setKey("Your Key String"); + * infoExample->setValue("Your Value String"); + * + * Python + * + * infoExample = XdmfInformation.New() + * ''' + * Then the key and value must be set seperately + * ''' + * infoExample.setKey("Your Key String") + * infoExample.setValue("Your Value String") + * * @return constructed XdmfInformation. */ static shared_ptr New(); @@ -53,6 +71,20 @@ public: /** * Create a new XdmfInformation. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New("Your Key String", "Your Value String"); + * //This code creates an information with the key "Your Key String" and the value "Your Value String" + * + * Python + * + * infoExample = XdmfInformation.New("Your Key String", "Your Value String") + * ''' + * This code creates an information with the key "Your Key String" and the value "Your Value String" + * ''' + * * @param key a string containing the key of the XdmfInformation to create. * @param value a string containing the value of the XdmfInformation to * create. @@ -65,7 +97,7 @@ public: virtual ~XdmfInformation(); LOKI_DEFINE_VISITABLE(XdmfInformation, XdmfItem); - XDMF_CHILDREN(XdmfArray, Array, Name); + XDMF_CHILDREN(XdmfInformation, XdmfArray, Array, Name); static const std::string ItemTag; std::map getItemProperties() const; @@ -75,6 +107,26 @@ public: /** * Get the key for this information item. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New("Your Key String", "Your Value String"); + * //This code creates an information with the key "Your Key String" and the value "Your Value String" + * std::string storedKey = infoExample->getKey(); + * //"Your Key String" is now stored in the variable storedKey + * + * Python + * + * infoExample = XdmfInformation.New("Your Key String", "Your Value String") + * ''' + * This code creates an information with the key "Your Key String" and the value "Your Value String" + * ''' + * storedKey = infoExample.getKey() + * ''' + * "Your Key String" is now stored in the variable storedKey + * ''' + * * @return string containing the key. */ std::string getKey() const; @@ -82,6 +134,26 @@ public: /** * Get the value for this information item. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New("Your Key String", "Your Value String"); + * //This code creates an information with the key "Your Key String" and the value "Your Value String" + * std::string storedValue = infoExample->getValue(); + * //"Your Value String" is now stored in the variable storedValue + * + * Python + * + * infoExample = XdmfInformation.New("Your Key String", "Your Value String") + * ''' + * This code creates an information with the key "Your Key String" and the value "Your Value String" + * ''' + * storedValue = infoExample.getValue() + * ''' + * "Your Value String" is now stored in the variable storedValue + * ''' + * * @return string containing the value. */ std::string getValue() const; @@ -91,6 +163,26 @@ public: /** * Set the key for this information item. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New("Your Key String", "Your Value String"); + * //This code creates an information with the key "Your Key String" and the value "Your Value String" + * infoExample->setKey("Your New Key"); + * //"Your New Key" is now the key for infoExample + * + * Python + * + * infoExample = XdmfInformation.New("Your Key String", "Your Value String") + * ''' + * This code creates an information with the key "Your Key String" and the value "Your Value String" + * ''' + * infoExample.setKey("Your New Key") + * ''' + * "Your New Key" is now the key for infoExample + * ''' + * * @param key a string containing the key to set. */ void setKey(const std::string & key); @@ -98,6 +190,26 @@ public: /** * Set the value for this information item. * + * Example of use: + * + * C++ + * + * shared_ptr infoExample = XdmfInformation::New("Your Key String", "Your Value String"); + * //This code creates an information with the key "Your Key String" and the value "Your Value String" + * infoExample->setValue("Your New Value"); + * //"Your New Value" is now the value for infoExample + * + * Python + * + * infoExample = XdmfInformation.New("Your Key String", "Your Value String") + * ''' + * This code creates an information with the key "Your Key String" and the value "Your Value String" + * ''' + * infoExample.setValue("Your New Value") + * ''' + * "Your New Value" is now the value for infoExample + * ''' + * * @param value a string containing the value to set. */ void setValue(const std::string & value); diff --git a/core/XdmfItem.hpp b/core/XdmfItem.hpp index 0e48dfafee5067b1e819f9ec5bf7d700a819a590..bc13280effb03dde9bfb03d96c4fd1fc5355d177 100644 --- a/core/XdmfItem.hpp +++ b/core/XdmfItem.hpp @@ -39,11 +39,22 @@ class XdmfVisitor; // Macro that allows children XdmfItems to be attached to a parent XdmfItem. // -- For Header File -#define XDMF_CHILDREN(ChildClass, ChildName, SearchName) \ +#define XDMF_CHILDREN(ParentClass, ChildClass, ChildName, SearchName) \ \ public: \ \ /** Get a ChildClass attached to this item by index. + Example of use: + C++ + unsigned int getIndex = 0; + //Assume that exampleItem is a shared pointer to an ParentClass object + shared_ptr exampleChild = exampleItem->get##ChildName(getIndex); + Python + getIndex = 0; + ''' + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + exampleChild = exampleItem.get##ChildName(getIndex) @param index of the ChildClass to retrieve. @return requested ChildClass. If no ChildClass##s exist at the index, a NULL pointer is returned. @@ -52,6 +63,12 @@ public: \ get##ChildName(const unsigned int index); \ \ /** Get a ChildClass attached to this item by index (const version). + Example of use: + C++ + unsigned int getIndex = 0; + //Assume that exampleItem is a shared pointer to an ParentClass object + shared_ptr exampleChild = exampleItem->get##ChildName(getIndex); + Python: does not support a constant version of this function @param index of the ChildClass to retrieve. @return requested ChildClass. If no ChildClass##s exist at the index, a NULL pointer is returned. @@ -60,6 +77,17 @@ public: \ get##ChildName(const unsigned int index) const; \ \ /** Get a ChildClass attached to this item by SearchName. + Example of use: + C++ + std::string finding##SearchName = "Find this"; + //Assume that exampleItem is a shared pointer to an ParentClass object + shared_ptr exampleChild = exampleItem->get##ChildName(finding##SearchName); + Python + finding##SearchName = "Find this" + ''' + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + exampleChild = exampleItem.get##ChildName(finding##SearchName) @param SearchName of the ChildClass to retrieve. @return requested ChildClass. If no ChildClass##s are found with the correct SearchName, a NULL pointer is returned. @@ -68,6 +96,12 @@ public: \ get##ChildName(const std::string & SearchName); \ \ /** Get a ChildClass attached to this item by SearchName (const version). + Example of use: + C++ + std::string finding##SearchName = "Find this"; + //Assume that exampleItem is a shared pointer to an ParentClass object + shared_ptr exampleChild = exampleItem->get##ChildName(finding##SearchName); + Python: does not support a constant version of this function @param SearchName of the ChildClass to retrieve. @return requested ChildClass If no ChildClass##s are found with the correct SearchName, a NULL pointer is returned. @@ -76,23 +110,65 @@ public: \ get##ChildName(const std::string & SearchName) const; \ \ /** Get the number of ChildClass##s attached to this item. + Example of use: + C++ + //Assume that exampleItem is a shared pointer to an ParentClass object + unsigned int exampleSize = exampleItem->getNumber##ChildName##s(); + Python + ''' + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + exampleSize = exampleItem.getNumber##ChildName##s() @return number of ChildClass##s attached to this item. */ \ virtual unsigned int getNumber##ChildName##s() const; \ \ /** Insert a ChildClass into to this item. + Example of use: + C++ + //Assume that exampleChild is a shared pointer to an ChildClass object + //Assume that exampleItem is a shared pointer to an ParentClass object + exampleItem->insert(exampleChild); + Python + ''' + Assume that exampleChild is a shared pointer to an ChildClass object + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + exampleItem.insert(exampleChild) @param ChildName to attach to this item. */ \ virtual void insert(const shared_ptr ChildName); \ \ /** Remove a ChildClass from this item by index. If no ChildClass##s exist at the index, nothing is removed. + Example of use: + C++ + //Assume that exampleItem is a shared pointer to an ParentClass object + unsigned int removeIndex = 0; + exampleItem->remove##ChildName(removeIndex); + Python + ''' + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + removeIndex = 0 + exampleItem.remove##ChildName(removeIndex) @param index of the ChildClass to remove. */ \ virtual void remove##ChildName(const unsigned int index); \ \ /** Remove a ChildClass from this item by SearchName. If no ChildClass##s have the correct SearchName, nothing is removed. + Example of use: + C++ + //Assume that exampleItem is a shared pointer to an ParentClass object + unsigned int remove##SearchName = "Remove this"; + exampleItem->remove##ChildName(remove##SearchName); + Python + ''' + Assume that exampleItem is a shared pointer to an ParentClass object + ''' + remove##SearchName = "Remove this" + exampleItem.remove##ChildName(remove##SearchName) @param SearchName of the ChildClass to remove. */ \ virtual void remove##ChildName(const std::string & SearchName); \ @@ -196,13 +272,29 @@ public: virtual ~XdmfItem() = 0; LOKI_DEFINE_VISITABLE_BASE(); - XDMF_CHILDREN(XdmfInformation, Information, Key); + XDMF_CHILDREN(XdmfItem, XdmfInformation, Information, Key); friend class XdmfCoreReader; /** * Get the tag for this item. This is equivalent to tags in XML * parlance. * + * Example of use: + * + * C++ + * + * //Using a shared pointer to an XdmfDomain object as an example + * shared_ptr exampleItem = XdmfDomain::New(); + * std::string exampleTag = exampleItem->getItemTag(); + * + * Python + * + * ''' + * Using a shared pointer to an XdmfDomain object as an example + * ''' + * exampleItem = XdmfDomain.New() + * exampleTag = exampleItem.getItemTag() + * * @return the tag for this XdmfItem. */ virtual std::string getItemTag() const = 0; @@ -211,6 +303,22 @@ public: * Get the key/value property pairs for this item. These are * equivalent to attributes in XML parlance. * + * Example of use: + * + * C++ + * + * //Using a shared pointer to an XdmfDomain object as an example + * shared_ptr exampleItem = XdmfDomain::New(); + * std::map propertyMap = exampleItem->getItemProperties(); + * + * Python + * + * ''' + * Using a shared pointer to an XdmfDomain object as an example + * ''' + * exampleItem = XdmfDomain.New() + * propertyMap = exampleItem.getItemProperties() + * * @return a map of key/value properties associated with this XdmfItem. */ virtual std::map getItemProperties() const = 0; @@ -218,6 +326,26 @@ public: /** * Traverse this item by passing the visitor to child items. * + * Example of use: + * + * C++ + * + * //Using a shared pointer to an XdmfDomain object as an example + * shared_ptr exampleItem = XdmfDomain::New(); + * std::string writePath = "file path here"; + * shared_ptr exampleWriter = XdmfWriter::New(writepath); + * exampleItem->traverse(exampleWriter); + * + * Python + * + * ''' + * Using a shared pointer to an XdmfDomain object as an example + * ''' + * exampleItem = XdmfDomain.New() + * writePath = "file path here" + * exampleWriter = XdmfWriter.New(writepath) + * exampleItem.traverse(exampleWriter) + * * @param visitor the visitor to pass to child items. */ virtual void traverse(const shared_ptr visitor); diff --git a/core/XdmfItemProperty.hpp b/core/XdmfItemProperty.hpp index 22dcb8e7c7e730fb1eaa1c9211462fc65488dd49..021c71cbde0aa2450fbb4093adf8beae07fd052a 100644 --- a/core/XdmfItemProperty.hpp +++ b/core/XdmfItemProperty.hpp @@ -51,6 +51,20 @@ public: * Retrieve the key/value pairs that this XdmfItemProperty contains by * inserting into the passed map. * + * Example of use: + * + * C++ + * + * //Using XdmfArrayType::Int32() as an example + * std::map propertyMap; + * XdmfArrayType::Int32()->getProperties(propertyMap); + * + * Python + * + * //Using XdmfArrayType.Int32() as an example + * propertyMap = StringMap() + * XdmfArrayType.Int32().getProperties(propertyMap) + * * @param collectedProperties a map to insert name / value pairs into. */ virtual void diff --git a/core/XdmfSystemUtils.hpp b/core/XdmfSystemUtils.hpp index d30a39f03b65542a52744baaff7b7f2dba596ea6..bec5cb5ef0971322e67adbae4f2440c4620b6ecc 100644 --- a/core/XdmfSystemUtils.hpp +++ b/core/XdmfSystemUtils.hpp @@ -41,6 +41,18 @@ class XDMFCORE_EXPORT XdmfSystemUtils { * Converts a filesystem path to an absolute real path (absolute * path with no symlinks) * + * Example of use: + * + * C++ + * + * std::string priorPath = "Path you want to convert"; + * std::string convertedPath = XdmfSystemUtils::getRealPath(priorPath); + * + * Python + * + * priorPath = "Path you want to convert" + * convertedPath = XdmfSystemUtils.getRealPath(priorPath) + * * @param path a string containing the path to convert. * * @return the equivalent real path. diff --git a/core/XdmfWriter.hpp b/core/XdmfWriter.hpp index 99e946e6ad288806b382f2de182f887f7afd6952..b17856b58203f7ba8d4e45f70008c516166628ea 100644 --- a/core/XdmfWriter.hpp +++ b/core/XdmfWriter.hpp @@ -68,6 +68,18 @@ public: * if supplied "output.xmf" the created hdf5 writer would write to * file "output.h5". * + * Example of use: + * + * C++ + * + * std::string outFile = "output file name goes here"; + * shared_ptr exampleWriter = XdmfWriter::New(outFile); + * + * Python + * + * outFile = "output file name goes here" + * exampleWriter = XdmfWriter.New(outFile) + * * @param xmlFilePath the path to the xml file to write to. * * @return the new XdmfWriter. @@ -79,6 +91,24 @@ public: * utilize the passed heavy data writer to write any heavy data to * disk. * + * Example of use: + * + * C++ + * + * std::string outFile = "output file name goes here"; + * std::string heavyFile = "heavy file name goes here"; + * bool replaceFile = true; + * shared_ptr exampleHeavyWriter = XdmfHDF5Writer::New(heavyFile, replaceFile); + * shared_ptr exampleWriter = XdmfWriter::New(outFile, exampleHeavyWriter); + * + * Python + * + * outFile = "output file name goes here" + * heavyFile = "heavy file name goes here" + * replaceFile = True + * exampleHeavyWriter = XdmfHDF5Writer.New(heavyFile, replaceFile) + * exampleWriter = XdmfWriter.New(outFile, exampleHeavyWriter) + * * @param xmlFilePath the path to the xml file to write to. * @param heavyDataWriter the heavy data writer to use when writing. * @@ -92,7 +122,22 @@ public: * write heavy data to disk using the passed heavy data writer and * will add xml output to the stream. * + * Example of use: + * + * C++ + * + * filebuf exampleBuffer; + * exampleBuffer.open("file goes here", ios::out); + * ostream exampleStream(&exampleBuffer); + * std::string heavyFile = "heavy file name goes here"; + * bool replaceFile = true; + * shared_ptr exampleHeavyWriter = XdmfHDF5Writer::New(heavyFile, replaceFile); + * shared_ptr exampleWriter = XdmfWriter::New(exampleStream, exampleHeavyWriter); + * + * Python: does not curretnly support this version of New + * * @param stream the output stream to write light data to. + * @param heavyDataWriter the heavy data writer to use when writing. * * @return the new XdmfWriter; */ @@ -105,6 +150,20 @@ public: * Get the absolute path to the XML file on disk this writer is * writing to. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * std::string examplePath = exampleWriter->getFilePath(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * examplePath = exampleWriter.getFilePath() + * * @return a std::string containing the path to the XML file on disk this * writer is writing to. */ @@ -114,6 +173,20 @@ public: * Get the heavy data writer that this XdmfWriter uses to write * heavy data to disk. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * shared_ptr exampleHeavyWriter = exampleWriter->getHeavyDataWriter(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleHeavyWriter = exampleWriter.getHeavyDataWriter() + * * @return the requested heavy data writer. */ shared_ptr getHeavyDataWriter(); @@ -122,6 +195,15 @@ public: * Get the heavy data writer that this XdmfWriter uses to write * heavy data to disk (const version). * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * shared_ptr exampleHeavyWriter = exampleWriter->getHeavyDataWriter(); + * + * Python: Does not support a contant version of this function + * * @return the requested heavy data writer. */ shared_ptr getHeavyDataWriter() const; @@ -130,6 +212,20 @@ public: * Get the number of values that this writer writes to light data * (XML) before switching to a heavy data format. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * unsigned int exampleLimit = exampleWriter->getLightDataLimit(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleLimit = exampleWriter.getLightDataLimit() + * * @return an unsigned int containing the number of values. */ unsigned int getLightDataLimit() const; @@ -137,6 +233,28 @@ public: /** * Get the Mode of operation for this writer. * + * Example of use: + * + * C++ + * + * XdmfWriter::Mode testMode = XdmfWriter::Default; + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * if (exampleWriter->getMode() == testMode) + * { + * //Do whatever is to be done if the mode is default + * } + * + * Python + * + * testMode = XdmfWriter.Default + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * if exampleWriter.getMode() == testMode: + * ''' + * Do whatever is to be done if the mode is default + * ''' + * * @return the Mode of operation for this writer. */ Mode getMode() const; @@ -144,6 +262,20 @@ public: /** * Get whether this writer is set to write xpaths. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * bool exampleTestPaths = exampleWriter->getWriteXPaths(); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleTestPaths = exampleWriter.getWriteXPaths() + * * @return bool whether this writer is set to write xpaths. */ bool getWriteXPaths() const; @@ -152,6 +284,26 @@ public: * Set the number of values that this writer writes to light data * (XML) before switching to a heavy data format. * + * Example of use: + * + * C++ + * + * unsigned int newLimit = 20; + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * exampleWriter->setLightDataLimit(newLimit); + * //The writer will now place any data with a number of values over 20 into heavy data + * + * Python + * + * newLimit = 20; + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleWriter.setLightDataLimit(newLimit) + * ''' + * The writer will now place any data with a number of values over 20 into heavy data + * ''' + * * @param numValues an unsigned int containing the number of values. */ void setLightDataLimit(const unsigned int numValues); @@ -159,6 +311,20 @@ public: /** * Set the mode of operation for this writer. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * exampleWriter->setMode(XdmfWriter::Default); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleWriter.setMode(XdmfWriter.Default) + * * @param mode the Mode of operation for this writer. */ void setMode(const Mode mode); @@ -166,6 +332,20 @@ public: /** * Set whether to write xpaths for this writer. * + * Example of use: + * + * C++ + * + * //Assume that exampleWriter is a shared pointer to a XdmfWriter object + * exampleWriter->setWriteXPaths(true); + * + * Python + * + * ''' + * Assume that exampleWriter is a shared pointer to a XdmfWriter object + * ''' + * exampleWriter.setWriteXPaths(True) + * * @param writeXPaths whether to write xpaths for this writer. */ void setWriteXPaths(const bool writeXPaths = true); @@ -173,6 +353,42 @@ public: /** * Write an XdmfArray to disk * + * Example of use: + * + * C++ + * + * //Using XdmfAttribute here, but any XdmfArray would work + * shared_ptr exampleAttribute = XdmfAttribute::New(); + * exampleAttribute->setCenter(XdmfAttributeCenter::Node()); + * exampleAttribute->setType(XdmfAttributeType::Scalar()); + * exampleAttribute->pushBack(1); + * exampleAttribute->pushBack(2); + * exampleAttribute->pushBack(3); + * exampleAttribute->pushBack(4); + * exampleAttribute->pushBack(5); + * exampleAttribute->pushBack(6); + * std::string outFile = "output file name goes here"; + * shared_ptr exampleWriter = XdmfWriter::New(outFile); + * exampleWriter->visit(exampleAttribute, exampleWriter); + * + * Python + * + * ''' + * Using XdmfAttribute here, but any XdmfArray would work + * ''' + * exampleAttribute = XdmfAttribute.New() + * exampleAttribute.setCenter(XdmfAttributeCenter.Node()) + * exampleAttribute.setType(XdmfAttributeType.Scalar()) + * exampleAttribute.pushBackAsInt32(1) + * exampleAttribute.pushBackAsInt32(2) + * exampleAttribute.pushBackAsInt32(3) + * exampleAttribute.pushBackAsInt32(4) + * exampleAttribute.pushBackAsInt32(5) + * exampleAttribute.pushBackAsInt32(6) + * outFile = "output file name goes here" + * exampleWriter = XdmfWriter.New(outFile) + * exampleWriter.visit(exampleAttribute, exampleWriter) + * * @param array an XdmfArray to write to disk. * @param visitor a smart pointer to this visitor --- aids in grid traversal. */ @@ -182,6 +398,26 @@ public: /** * Write an XdmfItem to disk * + * Example of use: + * + * C++ + * + * //Using XdmfDomain here, but any XdmfItem would work + * shared_ptr exampleDomain = XdmfDomain::New(); + * std::string outFile = "output file name goes here"; + * shared_ptr exampleWriter = XdmfWriter::New(outFile); + * exampleWriter->visit(exampleDomain, exampleWriter); + * + * Python + * + * ''' + * Using XdmfDomain here, but any XdmfItem would work + * ''' + * exampleDomain = XdmfDomain.New() + * outFile = "output file name goes here" + * exampleWriter = XdmfWriter.New(outFile) + * exampleWriter.visit(exampleDomain, exampleWriter) + * * @param item an XdmfItem to write to disk. * @param visitor a smart pointer to this visitor --- aids in grid traversal. */ diff --git a/tests/Python/FinishedXdmfExampleRead.py b/tests/Python/FinishedXdmfExampleRead.py new file mode 100644 index 0000000000000000000000000000000000000000..d9fb995cbaf29c6b32d5436222452bc417ebe864 --- /dev/null +++ b/tests/Python/FinishedXdmfExampleRead.py @@ -0,0 +1,409 @@ +from Xdmf import * + +if __name__ == "__main__": + exampleReader = XdmfReader.New() + + ''' + This is assuming that the read item is an XdmfDomain object + ''' + primaryDomain = exampleReader.read("testoutput.xmf") + outputInformation = primaryDomain.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "The Domain's tag is: " + primaryDomain.getItemTag() + + gridHolder = primaryDomain.getGridCollection(0) + + print "The Grid Collection's tag is: " + gridHolder.getItemTag() + print "The Grid Collection's name is: " + gridHolder.getName() + outputInformation = gridHolder.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + + for property in gridHolder.getItemProperties(): + print property + ": " + gridHolder.getItemProperties()[property] + + if gridHolder.getType() == XdmfGridCollectionType.Spatial(): + print "This is a spatial grid collection" + else: + print "This is not a spatial grid collection" + + i=0 + outstring = "" + while i < gridHolder.getNumberMaps(): + readMap = gridHolder.getMap(i) + outstring = outstring + "Map # " + str(i) + "\n" + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + print outstring + + print "Unstructured Grid" + ungrid = gridHolder.getUnstructuredGrid(0) + print "The Unstructured Grid's tag is: " + ungrid.getItemTag() + print "The Unstructured Grid's name is: " + ungrid.getName() + for property in ungrid.getItemProperties(): + print property + ": " + ungrid.getItemProperties()[property] + print "The Unstructured Grid's time is: " + str(ungrid.getTime().getValue()) + i=0 + outstring = "" + while i < ungrid.getNumberMaps(): + readMap = ungrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < ungrid.getNumberSets(): + readSet = ungrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + outputInformation = readSet.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < ungrid.getNumberAttributes(): + readAttribute = ungrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + i = i + 1 + + print "Unstructured Topology" + untopology = ungrid.getTopology() + print "The topology's tag: " + untopology.getItemTag() + if untopology.getType() == XdmfTopologyType.Hexahedron(): + print "This topology is a hexahedron" + else: + print "This topology is not a hexahedron" + print "Contains " + str(untopology.getNumberElements()) + " elements" + print "Contains the values: " + untopology.getValuesString() + + print "Unstructured Geometry" + ungeometry = ungrid.getGeometry() + print "The geometry's tag: " +ungeometry.getItemTag() + if ungeometry.getType() == XdmfGeometryType.XYZ(): + print "This geometry is XYZ" + else: + print "This geometry is not XYZ" + outputInformation = ungeometry.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "Contains " + str(ungeometry.getNumberPoints()) + " points" + print "Contains the values: " + ungeometry.getValuesString() + + + print "Curvilinear Grid" + curvgrid = gridHolder.getCurvilinearGrid(0) + print "The Curvilinear Grid's tag is: " + curvgrid.getItemTag() + print "The Curvilinear Grid's name is: " + curvgrid.getName() + for property in curvgrid.getItemProperties(): + print property + ": " + curvgrid.getItemProperties()[property] + outputInformation = curvgrid.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "The Curvilinear Grid's time is: " + str(curvgrid.getTime().getValue()) + i=0 + outstring = "" + while i < curvgrid.getNumberMaps(): + readMap = curvgrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < curvgrid.getNumberSets(): + readSet = curvgrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < curvgrid.getNumberAttributes(): + readAttribute = curvgrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + outputInformation = readAttribute.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readAttribute.getValuesString() + i = i + 1 + + print "Curvilinear Dimensions" + curvdimensions = curvgrid.getDimensions() + print "The dimensions' tag: " + curvdimensions.getItemTag() + print "Contains the values: " + curvdimensions.getValuesString() + + print "Curvilinear Geometry" + curvgeometry = curvgrid.getGeometry() + print "The geometry's tag: " + curvgeometry.getItemTag() + if curvgeometry.getType() == XdmfGeometryType.XYZ(): + print "This geometry is XYZ" + else: + print "This geometry is not XYZ" + outputInformation = curvgeometry.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "Contains " + str(curvgeometry.getNumberPoints()) + " points" + print "Contains the values: " + curvgeometry.getValuesString() + + + print "Rectilinear Grid" + rectgrid = gridHolder.getRectilinearGrid(0) + print "The Rectilinear Grid's tag is: " + rectgrid.getItemTag() + print "The Rectilinear Grid's name is: " + rectgrid.getName() + for property in rectgrid.getItemProperties(): + print property + ": " + rectgrid.getItemProperties()[property] + print "The Rectilinear Grid's time is: " + str(rectgrid.getTime().getValue()) + i=0 + outstring = "" + while i < rectgrid.getNumberMaps(): + readMap = rectgrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < rectgrid.getNumberSets(): + readSet = rectgrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < rectgrid.getNumberAttributes(): + readAttribute = rectgrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + outputInformation = readAttribute.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readAttribute.getValuesString() + i = i + 1 + + print "Rectilinear Dimensions" + rectdimensions = rectgrid.getDimensions() + print "The dimensions' tag: " + rectdimensions.getItemTag() + print "Contains the values: " + rectdimensions.getValuesString() + + print "Rectilinear Coordinates" + rectcoordinates = rectgrid.getCoordinates() + print "Contains the values: " + for coordinateaxes in rectcoordinates: + print coordinateaxes.getValuesString() + + print "Regular Grid" + reggrid = gridHolder.getRegularGrid(0) + print "The Regular Grid's tag is: " + reggrid.getItemTag() + print "The Regular Grid's name is: " + reggrid.getName() + for property in reggrid.getItemProperties(): + print property + ": " + reggrid.getItemProperties()[property] + print "The Regular Grid's time is: " + str(reggrid.getTime().getValue()) + i=0 + outstring = "" + while i < reggrid.getNumberMaps(): + readMap = reggrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < reggrid.getNumberSets(): + readSet = reggrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < reggrid.getNumberAttributes(): + readAttribute = reggrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + i = i + 1 + + print "Regular Brick Size" + regbricksize = reggrid.getBrickSize() + print "The brick's tag: " + regbricksize.getItemTag() + print "Contains the values: " + regbricksize.getValuesString() + + print "Regular Number of Points" + regnumpoints = reggrid.getDimensions() + print "The dimensions' tag: " + regnumpoints.getItemTag() + print "Contains the values: " + regnumpoints.getValuesString() + + print "Regular Origin" + regorigin = reggrid.getOrigin() + print "The origin's tag: " + regorigin.getItemTag() + print "Contains the values: " + regorigin.getValuesString() diff --git a/tests/Python/FinishedXdmfExampleWrite.py b/tests/Python/FinishedXdmfExampleWrite.py new file mode 100644 index 0000000000000000000000000000000000000000..1aa1f5a9e32a8a4e861b1a61617939df3fc76fd4 --- /dev/null +++ b/tests/Python/FinishedXdmfExampleWrite.py @@ -0,0 +1,195 @@ +from Xdmf import * + +if __name__ == "__main__": + primaryDomain = XdmfDomain.New() + domaininfo = XdmfInformation.New("Domain", "This is the primary data structure in Xdmf") + domaininfoinfo = XdmfInformation.New("Information", "Information can have information") + domaininfo.insert(domaininfoinfo) + primaryDomain.insert(domaininfo) + + gridHolder = XdmfGridCollection.New() + gridHolder.setType(XdmfGridCollectionType.Spatial()) + holderInfo = XdmfInformation.New("Grid Collection 1", "This is the main grid collection") + gridHolder.insert(holderInfo) + gridHolder.setName("GridCollection Example") + + + ungrid = XdmfUnstructuredGrid.New() + ungrid.setName("Unstructured Grid Example") + untime = XdmfTime.New(5.0) + untimeinfo = XdmfInformation.New("Time", "This is the time for the Unstructured Grid") + untime.insert(untimeinfo) + ungrid.setTime(untime) + unglobalID = XdmfAttribute.New() + unglobalID.setType(XdmfAttributeType.GlobalId()) + unglobalID.setCenter(XdmfAttributeCenter.Node()) + unglobalID.setName("Global Node Equivalencies") + task1globalnodes = [1, 4, 5, 7, 3, 6] + unglobalID.insertAsInt32(0, task1globalnodes) + unglobalIDinfo = XdmfInformation.New("Global Nodes", "This is the global nodes that accociate with the local nodes") + ungrid.insert(unglobalID) + unset = XdmfSet.New() + unsetinfo = XdmfInformation.New("Data Set", "This is a set of arbitrary data") + unset.insert(unsetinfo) + unset.setName("Unstructured Grid's Set") + unset.setType(XdmfSetType.Node()) + unsetattribute = XdmfAttribute.New() + unsetattribute.setType(XdmfAttributeType.Scalar()) + unsetattribute.setCenter(XdmfAttributeCenter.Node()) + unsetattribute.setName("The Set's attribute") + unsetattribdata = [1.9, 2.8, 3.7, 4.6, 5.5, 6.4, 7.3, 8.2, 9.1] + unsetattribute.insertAsFloat64(0, unsetattribdata) + unset.insert(unsetattribute) + unsetdata = [5.1, 4.2, 3.3, 2.4, 1.5] + unset.insertAsFloat64(0, unsetdata) + ungrid.insert(unset) + ungeometry = XdmfGeometry.New() + ungeometry.setType(XdmfGeometryType.XYZ()) + ungeometry.setName("Unstructured Geometry") + ungeopoints = [0.1, 0.1, 1.1, 1.1, 0.1, 1.1, 3.1, 0.1, 2.1, 0.1, 1.1, 1.1, 1.1, + 1.1, 1.1, 3.1, 2.1, 2.1, 0.1, 0.1, -1.1, 1.1, 0.1, -1.1, 3.1, + 0.1, -2.1, 0.1, 1.1, -1.1, 1.1, 1.1, -1.1, 3.1, 2.1, -2.1] + ungeometry.insertAsFloat64(0, ungeopoints) + ungeometryinfo = XdmfInformation.New("Geometry", "This is the geometry associated with the unstructured grid") + ungeometry.insert(ungeometryinfo) + ungrid.setGeometry(ungeometry) + untopology = XdmfTopology.New() + untopology.setType(XdmfTopologyType.Hexahedron()) + untopology.setName("Unstructured Topology") + untopovalues = [0, 1, 7, 6, 3, 4, 10, 9, 1, 2, 8, 7, 4, 5, 11, 10] + untopology.insertAsInt32(0, untopovalues) + untopologyinfo = XdmfInformation.New("Topology", "This is the topology associated with the unstructured grid") + ungrid.setTopology(untopology) + + + curvdimensions = XdmfArray.New() + curvdimensions.pushBackAsInt32(12) + curvdimensions.pushBackAsInt32(12) + curvdimensions.pushBackAsInt32(12) + curvgrid = XdmfCurvilinearGrid.New(curvdimensions) + curvgrid.setName("Curvilinear Grid Example") + curvgridinfo = XdmfInformation.New("Curvilinear Grid", "This is an example curvilinear grid") + curvgrid.insert(curvgridinfo) + curvtime = XdmfTime.New(5.0) + curvtimeinfo = XdmfInformation.New("Time", "The Time of the Curvilinear Grid") + curvtime.insert(curvtimeinfo) + curvgrid.setTime(curvtime) + curvglobalID = XdmfAttribute.New() + curvglobalID.setType(XdmfAttributeType.GlobalId()) + curvglobalID.setCenter(XdmfAttributeCenter.Node()) + curvglobalID.setName("Global Node Equivalencies") + task2globalnodes = [7, 3, 8, 2, 5, 1] + curvglobalID.insertAsInt32(0, task1globalnodes) + curvglobalIDinfo = XdmfInformation.New("Global Node Equivalencies", "These are the global nodes that accociate with the local nodes") + curvglobalID.insert(curvglobalIDinfo) + curvgrid.insert(curvglobalID) + curvgeometry = XdmfGeometry.New() + curvgeometry.setType(XdmfGeometryType.XYZ()) + curvgeometry.setName("Curvilinear Geometry") + curvgeopoints = [1.1, 1.1, 2.1, 2.1, 1.1, 2.1, 4.1, 1.1, 3.1, 1.1, 2.1, 2.1, 2.1, + 2.1, 2.1, 4.1, 3.1, 3.1, 1.1, 1.1, 0.1, 2.1, 1.1, 0.1, 4.1, + 1.1, -1.1, 1.1, 2.1, 0.1, 1.1, 2.1, -0.1, 4.1, 3.1, -1.1] + curvgeometry.insertAsFloat64(0, curvgeopoints) + curvgeometryinfo = XdmfInformation.New("Geometry", "The geometry of the curvilinear grid") + curvgeometry.insert(curvgeometryinfo) + curvgrid.setGeometry(curvgeometry) + + + rectXcoordinates = [1.1, 1.1, 2.1, 2.1, 1.1, 2.1, 4.1, 1.1, 3.1, 1.1, 2.1, 2.1] + rectYcoordinates = [2.1, 2.1, 2.1, 4.1, 3.1, 3.1, 1.1, 1.1, 0.1, 2.1, 1.1, 0.1] + rectZcoordinates = [4.1, 1.1, -1.1, 1.1, 2.1, 0.1, 1.1, 2.1, -0.1, 4.1, 3.1, -1.1] + rectXarray = XdmfArray.New() + rectXarray.insertAsFloat64(0, rectXcoordinates) + rectYarray = XdmfArray.New() + rectYarray.insertAsFloat64(0, rectYcoordinates) + rectZarray = XdmfArray.New() + rectZarray.insertAsFloat64(0, rectZcoordinates) + coordinatecontainer = ArrayVector() + coordinatecontainer.push_back(rectXarray) + coordinatecontainer.push_back(rectYarray) + coordinatecontainer.push_back(rectZarray) + rectgrid = XdmfRectilinearGrid.New(coordinatecontainer) + rectgrid.setName("Rectilinear Grid Example") + rectgridinfo = XdmfInformation.New("Rectilinear Grid", "This is an example of a rectilinear grid") + rectglobalID = XdmfAttribute.New() + rectglobalID.setType(XdmfAttributeType.GlobalId()) + rectglobalID.setCenter(XdmfAttributeCenter.Node()) + rectglobalID.setName("Global Node Equivalencies") + task3globalnodes = [2, 7, 9, 0, 8, 6] + rectglobalID.insertAsInt32(0, task3globalnodes) + rectglobalIDinfo = XdmfInformation.New("Global Node Equivalencies", "These are the global nodes that associate with the local nodes") + rectglobalID.insert(rectglobalIDinfo) + recttime = XdmfTime.New(5.0) + recttimeinfo = XdmfInformation.New("Time", "The time of the rectiliniear grid") + recttime.insert(recttimeinfo) + rectgrid.setTime(recttime) + rectgrid.insert(rectglobalID) + + regbrick = XdmfArray.New() + regbrickvals = [10, 10, 10] + regbrick.insertAsFloat64(0, regbrickvals) + regdimensions = XdmfArray.New() + regdimensionvals = [5, 5, 5] + regdimensions.insertAsInt32(0, regdimensionvals) + regorigin = XdmfArray.New() + regoriginvals = [0, 0, 0] + regorigin.insertAsFloat64(0, regoriginvals) + reggrid = XdmfRegularGrid.New(regbrick, regdimensions, regorigin) + reggrid.setName("Regular Grid Example") + reggridinfo = XdmfInformation.New("Regular Grid", "This is an example of a regular grid") + regtime = XdmfTime.New(5.0) + regtimeinfo = XdmfInformation.New("Time", "This is the time for the regular grid") + reggrid.setTime(regtime) + regglobalID = XdmfAttribute.New() + regglobalID.setType(XdmfAttributeType.GlobalId()) + regglobalID.setCenter(XdmfAttributeCenter.Node()) + regglobalID.setName("Global Node Equivalencies") + task4globalnodes = [3, 6, 1, 4, 2, 5, 9] + regglobalID.insertAsInt32(0, task4globalnodes) + regglobalIDinfo = XdmfInformation.New("Global Node Equivalencies", "These are the global nodes that associate with the local nodes") + reggrid.insert(regglobalID) + + nodeholder = AttributeVector() + nodeholder.push_back(unglobalID) + nodeholder.push_back(curvglobalID) + nodeholder.push_back(rectglobalID) + nodeholder.push_back(regglobalID) + mapcollection = XdmfMap.New(nodeholder) + + ungrid.insert(mapcollection[0]) + curvgrid.insert(mapcollection[1]) + rectgrid.insert(mapcollection[2]) + reggrid.insert(mapcollection[3]) + + ''' + the version of XdmfMap.New used here returns a number of maps equal to the number of attributes it was provided with. + ''' + for insertedmap in mapcollection: + gridHolder.insert(insertedmap) + + gridHolder.insert(ungrid) + gridHolder.insert(curvgrid) + gridHolder.insert(rectgrid) + gridHolder.insert(reggrid) + + secondaryHolder = XdmfGridCollection.New() + secondaryHolder.setName("Secondary grid collection") + gridHolder.insert(secondaryHolder) + ''' + grid collections can be placed inside other grid collections + ''' + + primaryDomain.insert(gridHolder) + ''' + grids can be inserted into the domain in the same way as the grid collection + ''' + primaryDomain.insert(ungrid) + primaryDomain.insert(curvgrid) + primaryDomain.insert(rectgrid) + primaryDomain.insert(reggrid) + + exampleHeavyWriter = XdmfHDF5Writer.New("testoutput.h5") + exampleWriter = XdmfWriter.New("testoutput.xmf", exampleHeavyWriter) + + + primaryDomain.accept(exampleWriter) diff --git a/tests/Python/XdmfExampleEdit.py b/tests/Python/XdmfExampleEdit.py new file mode 100644 index 0000000000000000000000000000000000000000..f84c3fd9f4965c4a0391007957fa35b97355a895 --- /dev/null +++ b/tests/Python/XdmfExampleEdit.py @@ -0,0 +1,524 @@ +from Xdmf import * + +if __name__ == "__main__": + exampleReader = XdmfReader.New() + + ''' + This is assuming that the read item is an XdmfDomain object + ''' + primaryDomain = exampleReader.read("testoutput.xmf") + outputInformation = primaryDomain.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "The Domain's tag is: " + primaryDomain.getItemTag() + + gridHolder = primaryDomain.getGridCollection(0) + + print "The Grid Collection's tag is: " + gridHolder.getItemTag() + print "The Grid Collection's name is: " + gridHolder.getName() + outputInformation = gridHolder.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + + for property in gridHolder.getItemProperties(): + print property + ": " + gridHolder.getItemProperties()[property] + + if gridHolder.getType() == XdmfGridCollectionType.Spatial(): + print "This is a spatial grid collection" + else: + print "This is not a spatial grid collection" + + i=0 + outstring = "" + while i < gridHolder.getNumberMaps(): + readMap = gridHolder.getMap(i) + outstring = outstring + "Map # " + str(i) + "\n" + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + print outstring + + print "Unstructured Grid" + ungrid = gridHolder.getUnstructuredGrid(0) + print "The Unstructured Grid's tag is: " + ungrid.getItemTag() + print "The Unstructured Grid's name is: " + ungrid.getName() + for property in ungrid.getItemProperties(): + print property + ": " + ungrid.getItemProperties()[property] + print "The Unstructured Grid's time is: " + str(ungrid.getTime().getValue()) + i=0 + outstring = "" + while i < ungrid.getNumberMaps(): + readMap = ungrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < ungrid.getNumberSets(): + readSet = ungrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + outputInformation = readSet.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < ungrid.getNumberAttributes(): + readAttribute = ungrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + i = i + 1 + + print "Unstructured Topology" + untopology = ungrid.getTopology() + print "The topology's tag: " + untopology.getItemTag() + if untopology.getType() == XdmfTopologyType.Hexahedron(): + print "This topology is a hexahedron" + else: + print "This topology is not a hexahedron" + print "Contains " + str(untopology.getNumberElements()) + " elements" + print "Contains the values: " + untopology.getValuesString() + + print "Unstructured Geometry" + ungeometry = ungrid.getGeometry() + print "The geometry's tag: " +ungeometry.getItemTag() + if ungeometry.getType() == XdmfGeometryType.XYZ(): + print "This geometry is XYZ" + else: + print "This geometry is not XYZ" + outputInformation = ungeometry.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "Contains " + str(ungeometry.getNumberPoints()) + " points" + print "Contains the values: " + ungeometry.getValuesString() + + + print "Curvilinear Grid" + curvgrid = gridHolder.getCurvilinearGrid(0) + print "The Curvilinear Grid's tag is: " + curvgrid.getItemTag() + print "The Curvilinear Grid's name is: " + curvgrid.getName() + for property in curvgrid.getItemProperties(): + print property + ": " + curvgrid.getItemProperties()[property] + outputInformation = curvgrid.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "The Curvilinear Grid's time is: " + str(curvgrid.getTime().getValue()) + outputInformation = curvgrid.getTime().getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + i=0 + outstring = "" + while i < curvgrid.getNumberMaps(): + readMap = curvgrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < curvgrid.getNumberSets(): + readSet = curvgrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < curvgrid.getNumberAttributes(): + readAttribute = curvgrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + outputInformation = readAttribute.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readAttribute.getValuesString() + i = i + 1 + + print "Curvilinear Dimensions" + curvdimensions = curvgrid.getDimensions() + print "The dimensions' tag: " + curvdimensions.getItemTag() + print "Contains the values: " + curvdimensions.getValuesString() + + print "Curvilinear Geometry" + curvgeometry = curvgrid.getGeometry() + print "The geometry's tag: " + curvgeometry.getItemTag() + if curvgeometry.getType() == XdmfGeometryType.XYZ(): + print "This geometry is XYZ" + else: + print "This geometry is not XYZ" + outputInformation = curvgeometry.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print "Contains " + str(curvgeometry.getNumberPoints()) + " points" + print "Contains the values: " + curvgeometry.getValuesString() + + + print "Rectilinear Grid" + rectgrid = gridHolder.getRectilinearGrid(0) + print "The Rectilinear Grid's tag is: " + rectgrid.getItemTag() + print "The Rectilinear Grid's name is: " + rectgrid.getName() + for property in rectgrid.getItemProperties(): + print property + ": " + rectgrid.getItemProperties()[property] + print "The Rectilinear Grid's time is: " + str(rectgrid.getTime().getValue()) + i=0 + outstring = "" + while i < rectgrid.getNumberMaps(): + readMap = rectgrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < rectgrid.getNumberSets(): + readSet = rectgrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < rectgrid.getNumberAttributes(): + readAttribute = rectgrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + outputInformation = readAttribute.getInformation(0) + print "Key: " + outputInformation.getKey() + "\nValue: " + outputInformation.getValue() + print readAttribute.getValuesString() + i = i + 1 + + print "Rectilinear Dimensions" + rectdimensions = rectgrid.getDimensions() + print "The dimensions' tag: " + rectdimensions.getItemTag() + print "Contains the values: " + rectdimensions.getValuesString() + + print "Rectilinear Coordinates" + rectcoordinates = rectgrid.getCoordinates() + print "Contains the values: " + for coordinateaxes in rectcoordinates: + print coordinateaxes.getValuesString() + + print "Regular Grid" + reggrid = gridHolder.getRegularGrid(0) + print "The Regular Grid's tag is: " + reggrid.getItemTag() + print "The Regular Grid's name is: " + reggrid.getName() + for property in reggrid.getItemProperties(): + print property + ": " + reggrid.getItemProperties()[property] + print "The Regular Grid's time is: " + str(reggrid.getTime().getValue()) + i=0 + outstring = "" + while i < reggrid.getNumberMaps(): + readMap = reggrid.getMap(i) + print "Map # " + str(i) + taskIDMap = readMap.getMap() + j = 0 + for task in taskIDMap: + nodeIDmap = taskIDMap[task] + k = 0 + for node in nodeIDmap: + remoteIDmap = nodeIDmap[node] + for remote in remoteIDmap: + outstring = outstring + "taskID: " + str(task) + "\tlocalnodeID: " + str(node) +"\tremotenodeID: " + str(remote) + "\n" + k = k + 1 + if k == nodeIDmap.size(): + break + j = j + 1 + if j == taskIDMap.size(): + break + i = i + 1 + i = 0 + print outstring + while i < reggrid.getNumberSets(): + readSet = reggrid.getSet(i) + print "Set # " + str(i) + print readSet.getName() + if readSet.getType() == XdmfSetType.Node(): + print "This set is a node" + else: + print "This set is not a node" + print readSet.getValuesString() + j=0 + while j < readSet.getNumberAttributes(): + readAttribute = readSet.getAttribute(j) + print "Set Attribute # " + str(j) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + j = j + 1 + i=i+1 + i=0 + while i < reggrid.getNumberAttributes(): + readAttribute = reggrid.getAttribute(i) + print "Attribute # " + str(i) + print readAttribute.getName() + if readAttribute.getType() == XdmfAttributeType.Scalar(): + print "This attribute is a scalar" + else: + print "This attribute is not a scalar" + if readAttribute.getCenter() == XdmfAttributeCenter.Node(): + print "This attribute is a node" + else: + print "This attrubte is not a node" + print readAttribute.getValuesString() + i = i + 1 + + print "Regular Brick Size" + regbricksize = reggrid.getBrickSize() + print "The brick's tag: " + regbricksize.getItemTag() + print "Contains the values: " + regbricksize.getValuesString() + + print "Regular Number of Points" + regnumpoints = reggrid.getDimensions() + print "The dimensions' tag: " + regnumpoints.getItemTag() + print "Contains the values: " + regnumpoints.getValuesString() + + print "Regular Origin" + regorigin = reggrid.getOrigin() + print "The origin's tag: " + regorigin.getItemTag() + print "Contains the values: " + regorigin.getValuesString() + + + + primaryDomain.getInformation(0).setKey("Edited") + primaryDomain.getInformation(0).setValue("This file is the edited version") + + unglobalIDs = ungrid.getAttribute(0) + newIDs1 = [5,2,8,7,9,1] + unglobalIDs.insertAsInt32(0, newIDs1) + + unset = ungrid.getSet(0) + newunsetdata = [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 0.23] + unset.insertAsFloat64(0, newunsetdata) + + untopology = ungrid.getTopology() + untopologydata = [int(val) for val in untopology.getValuesString().split()] + i=0 + while i > & mAttributes, std::vector > & mInformations, + std::vector > & mSets, + std::vector > & mMaps, shared_ptr mTime, shared_ptr mDomain, std::stack > & mGridCollections) @@ -74,6 +84,24 @@ namespace { } mInformations.clear(); + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) { + grid->insert(*iter); + } + + mSets.clear(); + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) { + grid->insert(*iter); + } + + mMaps.clear(); if(mTime) { grid->setTime(mTime); @@ -235,7 +263,10 @@ XdmfFortran::XdmfFortran() : mDomain(XdmfDomain::New()), mGeometry(shared_ptr()), mTime(shared_ptr()), - mTopology(shared_ptr()) + mTopology(shared_ptr()), + mBrick(shared_ptr()), + mOrigin(shared_ptr()), + mDimensions(shared_ptr()) { } @@ -297,6 +328,15 @@ XdmfFortran::addAttribute(const char * const name, XdmfError::message(XdmfError::FATAL, "Invalid attribute type"); } + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) { + currAttribute->insert(*iter); + } + mInformations.clear(); + + // insert values into attribute writeToArray(currAttribute, numValues, @@ -311,30 +351,111 @@ XdmfFortran::addAttribute(const char * const name, } void -XdmfFortran::addGrid(const char * const name) +XdmfFortran::addGrid(const char * const name, int gridType) { - const shared_ptr grid = XdmfUnstructuredGrid::New(); - grid->setName(name); + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if(mDimensions == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before adding grid."); + } + + const shared_ptr grid = XdmfCurvilinearGrid::New(mDimensions); + grid->setName(name); - if(mGeometry == NULL) { - XdmfError::message(XdmfError::FATAL, + if(mGeometry == NULL) { + XdmfError::message(XdmfError::FATAL, "Must set geometry before adding grid."); + } + + grid->setGeometry(mGeometry); + + insertElements(grid, + mAttributes, + mInformations, + mSets, + mMaps, + mTime, + mDomain, + mGridCollections); } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if(mCoordinates.empty()) { + XdmfError::message(XdmfError::FATAL, + "Must set Coordinates before adding grid."); + } + + const shared_ptr grid = XdmfRectilinearGrid::New(mCoordinates); + mCoordinates.clear(); + grid->setName(name); - if(mTopology == NULL) { - XdmfError::message(XdmfError::FATAL, - "Must set topology before adding grid."); + insertElements(grid, + mAttributes, + mInformations, + mSets, + mMaps, + mTime, + mDomain, + mGridCollections); } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + + if(mBrick == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set brick size before adding grid."); + } + + if(mDimensions == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before adding grid."); + } + + if(mOrigin == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set origin before adding grid."); + } - grid->setGeometry(mGeometry); - grid->setTopology(mTopology); + const shared_ptr grid = XdmfRegularGrid::New(mBrick, mDimensions, mOrigin); + grid->setName(name); + + insertElements(grid, + mAttributes, + mInformations, + mSets, + mMaps, + mTime, + mDomain, + mGridCollections); + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + const shared_ptr grid = XdmfUnstructuredGrid::New(); + grid->setName(name); + + if(mGeometry == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before adding grid."); + } + + if(mTopology == NULL) { + XdmfError::message(XdmfError::FATAL, + "Must set topology before adding grid."); + } - insertElements(grid, - mAttributes, - mInformations, - mTime, - mDomain, - mGridCollections); + grid->setGeometry(mGeometry); + grid->setTopology(mTopology); + + insertElements(grid, + mAttributes, + mInformations, + mSets, + mMaps, + mTime, + mDomain, + mGridCollections); + } } void @@ -359,6 +480,8 @@ XdmfFortran::addGridCollection(const char * const name, insertElements(gridCollection, mAttributes, mInformations, + mSets, + mMaps, mTime, mDomain, mGridCollections); @@ -509,7 +632,8 @@ XdmfFortran::setTopology(const int topologyType, break; case XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9: mTopology->setType(XdmfTopologyType::Quadrilateral_9()); - break; case XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10: + break; + case XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10: mTopology->setType(XdmfTopologyType::Tetrahedron_10()); break; case XDMF_TOPOLOGY_TYPE_PYRAMID_13: @@ -572,185 +696,6514 @@ XdmfFortran::setTopology(const int topologyType, return id; } -void -XdmfFortran::write(const char * const xmlFilePath, const unsigned int numValues ) + + + + + + +int +XdmfFortran::retrieveNumDomainGridCollections() { - shared_ptr writer = XdmfWriter::New(xmlFilePath); - writer->setLightDataLimit(numValues); - mDomain->accept(writer); + return mDomain->getNumberGridCollections(); } -void -XdmfFortran::writeHDF5(const char * const xmlFilePath) +int +XdmfFortran::numGridCollectionGridCollections() { - shared_ptr writer = XdmfHDF5Writer::New(xmlFilePath); - writer->setReleaseData( true ); - mDomain->accept(writer); + if (!mGridCollections.empty()) + { + return mGridCollections.top()->getNumberGridCollections(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } } -void -XdmfFortran::read(const char * const xmlFilePath) +void +XdmfFortran::retrieveDomainTag(char * returnTag, int tagLength) { - shared_ptr reader = XdmfReader::New(); - mDomain = shared_dynamic_cast(reader->read( xmlFilePath )); + char * tempTag = strdup(mDomain->getItemTag().c_str()); + memset(returnTag, 0, tagLength); + memcpy(returnTag, tempTag, strlen(tempTag)+1); + delete [] tempTag; } -// -// C++ will mangle the name based on the argument list. This tells the -// compiler not to mangle the name so we can call it from 'C' (but -// really Fortran in this case) -// -extern "C" +int +XdmfFortran::retrieveDomainNumProperties() { + return mDomain->getItemProperties().size(); +} - void - XdmfInit(long * pointer) - { - XdmfFortran * xdmfFortran = new XdmfFortran(); - *pointer = reinterpret_cast(xdmfFortran); - } +void +XdmfFortran::retrieveDomainProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (index < mDomain->getItemProperties().size()) + { + std::map::iterator walker = mDomain->getItemProperties().begin(); + for (int i = 0; i(*pointer); - delete xdmfFortran; - } +void +XdmfFortran::retrieveDomainPropertyByKey(char * key, char * value, int valueLength) +{ + std::string tempString = key; + memset(value, 0, valueLength); + if ((mDomain->getItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mDomain->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } +} - int - XdmfAddAttribute(long * pointer, - char * const name, - int * attributeCenter, - int * attributeType, - int * numValues, - int * arrayType, - void * values) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - return xdmfFortran->addAttribute(name, - *attributeCenter, - *attributeType, - *numValues, - *arrayType, - values); - } +void +XdmfFortran::removeDomainGridCollection(int index) +{ + if (mDomain->getNumberGridCollections() > index) + { + mDomain->removeGridCollection(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} - void - XdmfAddGrid(long * pointer, - char * gridName) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->addGrid(gridName); - } +void +XdmfFortran::openDomainGridCollection(int index, int openMaps, int openAttributes, int openInformation, int openSets) +{ + if (mDomain->getNumberGridCollections() > index) + { + shared_ptr openedGridCollection = mDomain->getGridCollection(index); + int i; + int n; + if (openMaps == 1) + { + n = openedGridCollection->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGridCollection->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openAttributes == 1) + { + n = openedGridCollection->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGridCollection->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openInformation == 1) + { + n = openedGridCollection->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGridCollection->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGridCollection->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGridCollection->getSet(i); + mSets.push_back(openedSet); + } + mGridCollections.push(openedGridCollection); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} - void - XdmfAddGridCollection(long * pointer, - char * name, - int * gridCollectionType) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->addGridCollection(name, - *gridCollectionType); - } +void +XdmfFortran::removeGridCollectionGridCollection(int index) +{ + if (!mGridCollections.empty()) + { + if (mGridCollections.top()->getNumberGridCollections() > index) + { + mGridCollections.top()->removeGridCollection(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} - int - XdmfAddInformation(long * pointer, - char * key, - char * value) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - return xdmfFortran->addInformation(key, value); - } +void +XdmfFortran::openGridCollectionGridCollection(int index, int openMaps, int openAttributes, int openInformation, int openSets) +{ + if (!mGridCollections.empty()) + { + if (mGridCollections.top()->getNumberGridCollections() > index) + { + shared_ptr openedGridCollection = mGridCollections.top()->getGridCollection(index); + int i; + int n; + if (openMaps == 1) + { + n = openedGridCollection->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGridCollection->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openAttributes == 1) + { + n = openedGridCollection->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGridCollection->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openInformation == 1) + { + n = openedGridCollection->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGridCollection->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGridCollection->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGridCollection->getSet(i); + mSets.push_back(openedSet); + } + mGridCollections.push(openedGridCollection); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} - void - XdmfAddPreviousAttribute(long * pointer, - int * attributeId) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->addPreviousAttribute(*attributeId); - } +void +XdmfFortran::retrieveGridCollectionTag(char * returnTag, int tagLength) +{ + if (!mGridCollections.empty()) + { + char * tempTag = strdup(mGridCollections.top()->getItemTag().c_str()); + memset(returnTag, 0, tagLength); + memcpy(returnTag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} - void - XdmfAddPreviousInformation(long * pointer, - int * informationId) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->addPreviousInformation(*informationId); - } +void +XdmfFortran::retrieveGridCollectionName(char * returnName, int nameLength) +{ + if (!mGridCollections.empty()) + { + char * tempName = strdup(mGridCollections.top()->getName().c_str()); + memset(returnName, 0, nameLength); + memcpy(returnName, tempName, strlen(tempName)+1); + delete [] tempName; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} - void - XdmfCloseGridCollection(long * pointer) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->closeGridCollection(); - } +int +XdmfFortran::retrieveGridCollectionNumProperties() +{ + if (!mGridCollections.empty()) + { + return mGridCollections.top()->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} - int - XdmfSetGeometry(long * pointer, - int * geometryType, - int * numValues, - int * arrayType, - void * pointValues) - { +void +XdmfFortran::retrieveGridCollectionProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (!mGridCollections.empty()) + { + if (index < mGridCollections.top()->getItemProperties().size()) + { + std::map::iterator walker = mGridCollections.top()->getItemProperties().begin(); + for (int i = 0; i(*pointer); - return xdmfFortran->setGeometry(*geometryType, - *numValues, - *arrayType, - pointValues); - } +void +XdmfFortran::retrieveGridCollectionPropertyByKey(char * key, char * value, int valueLength) +{ + if (!mGridCollections.empty()) + { + std::string tempString = key; + memset(value, 0, valueLength); + if ((mGridCollections.top()->getItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mGridCollections.top()->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: No grid collections are open."); + } +} + +void +XdmfFortran::openDomainGrid(int gridType, int index, int openMaps, int openAttributes, int openInformation, int openSets) +{ + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + shared_ptr openedGrid = mDomain->getCurvilinearGrid(index); + shared_ptr dataType; + mGeometry = openedGrid->getGeometry(); + mDimensions = openedGrid->getDimensions(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + shared_ptr openedGrid = mDomain->getRectilinearGrid(index); + shared_ptr dataType; + mCoordinates = openedGrid->getCoordinates(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + shared_ptr openedGrid = mDomain->getRegularGrid(index); + shared_ptr dataType; + mTime = openedGrid->getTime(); + mBrick = openedGrid->getBrickSize(); + mOrigin = openedGrid->getOrigin(); + mDimensions = openedGrid->getDimensions(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + shared_ptr openedGrid = mDomain->getUnstructuredGrid(index); + mTopology = openedGrid->getTopology(); + mGeometry = openedGrid->getGeometry(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } +} + +void +XdmfFortran::removeDomainGrid(int gridType, int index) +{ + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + mDomain->removeCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + mDomain->removeRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + mDomain->removeRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + mDomain->removeUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } +} + +void +XdmfFortran::replaceDomainGrid(int gridType, int index, char * name) +{ + int i; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + if(mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, "Must set dimensions before replacing grid."); + } + if(mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before adding grid."); + } + + shared_ptr grid = mDomain->getCurvilinearGrid(index); + grid->setName(name); + + grid->setGeometry(mGeometry); + grid->setDimensions(mDimensions); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for( i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + if(mCoordinates.empty()) + { + XdmfError::message(XdmfError::FATAL, + "Must set Coordinates before adding grid."); + } + + shared_ptr grid = mDomain->getRectilinearGrid(index); + grid->setCoordinates(mCoordinates); + mCoordinates.clear(); + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + if(mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick size before adding grid."); + } + + if(mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before adding grid."); + } + + if(mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before adding grid."); + } + + shared_ptr grid = mDomain->getRegularGrid(index); + grid->setOrigin(mOrigin); + grid->setDimensions(mDimensions); + grid->setBrickSize(mBrick); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + if(mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before adding grid."); + } + if(mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set topology before adding grid."); + } + shared_ptr grid = mDomain->getUnstructuredGrid(index); + grid->setName(name); + grid->setGeometry(mGeometry); + grid->setTopology(mTopology); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } +} + +void +XdmfFortran::retrieveDomainGridName(int gridType, int index, char * returnName, int nameLength) +{ + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + openedGrid = mDomain->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + openedGrid = mDomain->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + openedGrid = mDomain->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + openedGrid = mDomain->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + char * tempName = strdup(openedGrid->getName().c_str()); + memset(returnName, 0, nameLength); + memcpy(returnName, tempName, strlen(tempName)+1); + delete [] tempName; +} + +void +XdmfFortran::retrieveDomainGridTag(int gridType, int index, char * returnTag, int tagLength) +{ + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + openedGrid = mDomain->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + openedGrid = mDomain->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + openedGrid = mDomain->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + openedGrid = mDomain->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + char * tempTag = strdup(openedGrid->getItemTag().c_str()); + memset(returnTag, 0, tagLength); + memcpy(returnTag, tempTag, strlen(tempTag)+1); + delete [] tempTag; +} + +int +XdmfFortran::retrieveDomainGridNumProperties(int gridType, int index) +{ + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + return mDomain->getCurvilinearGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + return mDomain->getRectilinearGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + return mDomain->getRegularGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + return mDomain->getUnstructuredGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } +} + +void +XdmfFortran::retrieveDomainGridProperty(int gridType, int gridIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + openedGrid = mDomain->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + openedGrid = mDomain->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + openedGrid = mDomain->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + openedGrid = mDomain->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + if (index < openedGrid->getItemProperties().size()) + { + std::map::iterator walker = openedGrid->getItemProperties().begin(); + for (int i = 0; i openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mDomain->getNumberCurvilinearGrids()) + { + openedGrid = mDomain->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mDomain->getNumberRectilinearGrids()) + { + openedGrid = mDomain->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mDomain->getNumberRegularGrids()) + { + openedGrid = mDomain->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mDomain->getNumberUnstructuredGrids()) + { + openedGrid = mDomain->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + std::string tempString = key; + memset(value, 0, valueLength); + if ((openedGrid->getItemProperties().count(tempString))>0) + { + char * tempValue = strdup(openedGrid->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } +} + +void +XdmfFortran::openGridCollectionGrid(int gridType, int index, int openMaps, int openAttributes, int openInformation, int openSets) +{ + if (!mGridCollections.empty()) + { + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + shared_ptr openedGrid = mGridCollections.top()->getCurvilinearGrid(index); + shared_ptr dataType; + mGeometry = openedGrid->getGeometry(); + mDimensions = openedGrid->getDimensions(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + shared_ptr openedGrid = mGridCollections.top()->getRectilinearGrid(index); + shared_ptr dataType; + mCoordinates = openedGrid->getCoordinates(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + shared_ptr openedGrid = mGridCollections.top()->getRegularGrid(index); + shared_ptr dataType; + mTime = openedGrid->getTime(); + mBrick = openedGrid->getBrickSize(); + mOrigin = openedGrid->getOrigin(); + mDimensions = openedGrid->getDimensions(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + shared_ptr openedGrid = mGridCollections.top()->getUnstructuredGrid(index); + mTopology = openedGrid->getTopology(); + mGeometry = openedGrid->getGeometry(); + mTime = openedGrid->getTime(); + int i; + int n; + if (openAttributes == 1) + { + n = openedGrid->getNumberAttributes(); + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedGrid->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openMaps == 1) + { + n = openedGrid->getNumberMaps(); + shared_ptr openedMap; + for (i = 0; i < n; i++) + { + openedMap = openedGrid->getMap(i); + mMaps.push_back(openedMap); + mPreviousMaps.push_back(openedMap); + } + } + if (openInformation == 1) + { + n = openedGrid->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedGrid->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + if (openSets == 1) + { + n = openedGrid->getNumberSets(); + shared_ptr openedSet; + for (i = 0; i < n; i++) + { + openedSet = openedGrid->getSet(i); + mSets.push_back(openedSet); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +void +XdmfFortran::removeGridCollectionGrid(int gridType, int index) +{ + if (!mGridCollections.empty()) + { + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + mGridCollections.top()->removeCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + mGridCollections.top()->removeRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + mGridCollections.top()->removeRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + mGridCollections.top()->removeUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +void +XdmfFortran::replaceGridCollectionGrid(int gridType, int index, char * name) +{ + if (!mGridCollections.empty()) + { + int i; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + if(mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, "Must set dimensions before replacing grid."); + } + if(mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before adding grid."); + } + + shared_ptr grid = mGridCollections.top()->getCurvilinearGrid(index); + grid->setName(name); + + grid->setGeometry(mGeometry); + grid->setDimensions(mDimensions); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for( i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + if(mCoordinates.empty()) + { + XdmfError::message(XdmfError::FATAL, + "Must set Coordinates before adding grid."); + } + + shared_ptr grid = mGridCollections.top()->getRectilinearGrid(index); + grid->setCoordinates(mCoordinates); + mCoordinates.clear(); + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + if(mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick size before adding grid."); + } + + if(mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before adding grid."); + } + + if(mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before adding grid."); + } + + shared_ptr grid = mGridCollections.top()->getRegularGrid(index); + grid->setOrigin(mOrigin); + grid->setDimensions(mDimensions); + grid->setBrickSize(mBrick); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + if(mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before adding grid."); + } + if(mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set topology before adding grid."); + } + shared_ptr grid = mGridCollections.top()->getUnstructuredGrid(index); + grid->setName(name); + grid->setGeometry(mGeometry); + grid->setTopology(mTopology); + + for (i=grid->getNumberAttributes()-1;i>=0;i--) + { + grid->removeAttribute(0); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + grid->insert(*iter); + } + + mAttributes.clear(); + + for (i=grid->getNumberInformations()-1;i>=0;i--) + { + grid->removeInformation(0); + } + + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + grid->insert(*iter); + } + + mInformations.clear(); + + for (i=grid->getNumberSets()-1;i>=0;i--) + { + grid->removeSet(0); + } + + for(std::vector >::const_iterator iter = + mSets.begin(); + iter != mSets.end(); + ++iter) + { + grid->insert(*iter); + } + + mSets.clear(); + + for (i=grid->getNumberMaps()-1;i>=0;i--) + { + grid->removeMap(0); + } + + for(std::vector >::const_iterator iter = + mMaps.begin(); + iter != mMaps.end(); + ++iter) + { + grid->insert(*iter); + } + + mMaps.clear(); + + if(mTime) + { + grid->setTime(mTime); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +void +XdmfFortran::retrieveGridCollectionGridName(int gridType, int index, char * returnName, int nameLength) +{ + if (!mGridCollections.empty()) + { + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + openedGrid = mGridCollections.top()->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + openedGrid = mGridCollections.top()->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + openedGrid = mGridCollections.top()->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + openedGrid = mGridCollections.top()->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + char * tempName = strdup(openedGrid->getName().c_str()); + memset(returnName, 0, nameLength); + memcpy(returnName, tempName, strlen(tempName)+1); + delete [] tempName; + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +void +XdmfFortran::retrieveGridCollectionGridTag(int gridType, int index, char * returnTag, int tagLength) +{ + if (!mGridCollections.empty()) + { + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + openedGrid = mGridCollections.top()->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + openedGrid = mGridCollections.top()->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + openedGrid = mGridCollections.top()->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + openedGrid = mGridCollections.top()->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + char * tempTag = strdup(openedGrid->getItemTag().c_str()); + memset(returnTag, 0, tagLength); + memcpy(returnTag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +int +XdmfFortran::retrieveGridCollectionGridNumProperties(int gridType, int index) +{ + if (!mGridCollections.empty()) + { + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + return mGridCollections.top()->getCurvilinearGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + return mGridCollections.top()->getRectilinearGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + return mGridCollections.top()->getRegularGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + return mGridCollections.top()->getUnstructuredGrid(index)->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +void +XdmfFortran::retrieveGridCollectionGridProperty(int gridType, int gridIndex, int index, + char * key, int keyLength, char * value, int valueLength) +{ + if (!mGridCollections.empty()) + { + shared_ptr openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + openedGrid = mGridCollections.top()->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + openedGrid = mGridCollections.top()->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + openedGrid = mGridCollections.top()->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + openedGrid = mGridCollections.top()->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + if (index < openedGrid->getItemProperties().size()) + { + std::map::iterator walker = openedGrid->getItemProperties().begin(); + for (int i = 0; i openedGrid; + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + if (index < mGridCollections.top()->getNumberCurvilinearGrids()) + { + openedGrid = mGridCollections.top()->getCurvilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + if (index < mGridCollections.top()->getNumberRectilinearGrids()) + { + openedGrid = mGridCollections.top()->getRectilinearGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + if (index < mGridCollections.top()->getNumberRegularGrids()) + { + openedGrid = mGridCollections.top()->getRegularGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + if (index < mGridCollections.top()->getNumberUnstructuredGrids()) + { + openedGrid = mGridCollections.top()->getUnstructuredGrid(index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + std::string tempString = key; + memset(value, 0, valueLength); + if ((openedGrid->getItemProperties().count(tempString))>0) + { + char * tempValue = strdup(openedGrid->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +int +XdmfFortran::numDomainGrids(int gridType) +{ + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + return mDomain->getNumberCurvilinearGrids(); + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + return mDomain->getNumberRectilinearGrids(); + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + return mDomain->getNumberRegularGrids(); + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + return mDomain->getNumberUnstructuredGrids(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } +} + +int +XdmfFortran::numGridCollectionGrids(int gridType) +{ + if (!mGridCollections.empty()) + { + if (gridType == XDMF_GRID_TYPE_CURVILINEAR) + { + return mGridCollections.top()->getNumberCurvilinearGrids(); + } + else if (gridType == XDMF_GRID_TYPE_RECTILINEAR) + { + return mGridCollections.top()->getNumberRectilinearGrids(); + } + else if (gridType == XDMF_GRID_TYPE_REGULAR) + { + return mGridCollections.top()->getNumberRegularGrids(); + } + else if (gridType == XDMF_GRID_TYPE_UNSTRUCTURED) + { + return mGridCollections.top()->getNumberUnstructuredGrids(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: No Grid Collections have been loaded."); + } +} +int +XdmfFortran::retrieveGridCollectionType() +{ + if (!mGridCollections.empty()) + { + shared_ptr returnType = mGridCollections.top()->getType(); + if (returnType == XdmfGridCollectionType::Spatial()) + { + return XDMF_GRID_COLLECTION_TYPE_SPATIAL; + } + else if (returnType == XdmfGridCollectionType::Temporal()) + { + return XDMF_GRID_COLLECTION_TYPE_TEMPORAL; + } + else if (returnType == XdmfGridCollectionType::NoCollectionType()) + { + XdmfError::message(XdmfError::FATAL, + "Error: No Grid Collection Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Grid Collection Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "There is no grid collection currently loaded."); + } +} + +float +XdmfFortran::retrieveTime() +{ + return static_cast(mTime->getValue()); +} + +void +XdmfFortran::retrieveGeometryTag(char * tag, int tagLength) +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before its tag can be retrieved."); + } + else + { + char * tempTag = strdup(mGeometry->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } +} + +int +XdmfFortran::retrieveGeometryType() +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before its type can be retrieved."); + } + else + { + shared_ptr returnType = mGeometry->getType(); + if (returnType == XdmfGeometryType::XY()) + { + return XDMF_GEOMETRY_TYPE_XY; + } + else if (returnType == XdmfGeometryType::XYZ()) + { + return XDMF_GEOMETRY_TYPE_XYZ; + } + else if (returnType == XdmfGeometryType::NoGeometryType()) + { + XdmfError::message(XdmfError::FATAL, "Uninitialized geometry type"); + } + else + { + XdmfError::message(XdmfError::FATAL, "Invalid geometry type"); + } + } +} + +int +XdmfFortran::retrieveGeometryValueType() +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before its value type can be retrieved."); + } + else + { + shared_ptr dataType = mGeometry->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Geometry Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Geometry Data Type."); + } + } +} + +void +XdmfFortran::retrieveGeometryValues(void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if(mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before its values can be retrieved."); + } + else + { + if (!mGeometry->isInitialized()) + { + mGeometry->read(); + } + readFromArray(mGeometry, + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } +} + +int +XdmfFortran::retrieveGeometryNumPoints() +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before the number of points it contains can be retrieved."); + } + else + { + return mGeometry->getNumberPoints(); + } +} + +int +XdmfFortran::retrieveGeometrySize() +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before its size can be retrieved."); + } + else + { + return mGeometry->getSize(); + } +} + +void +XdmfFortran::clearPreviousGeometries() +{ + mPreviousGeometries.clear(); +} + +int +XdmfFortran::retrieveGeometryNumProperties() +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before the number of properties it contains can be retrieved."); + } + else + { + return mGeometry->getItemProperties().size(); + } +} + +void +XdmfFortran::retrieveGeometryProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mGeometry == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set geometry before the properties it contains can be retrieved."); + } + else + { + if (index < mGeometry->getItemProperties().size()) + { + std::map::iterator walker = mGeometry->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mGeometry->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } +} + +void +XdmfFortran::retrieveTopologyTag(char * tag, int tagLength) +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before its tag can be retrieved."); + } + else + { + char * tempTag = strdup(mTopology->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } +} + +int +XdmfFortran::retrieveTopologyType() +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before its type can be retrieved."); + } + else + { + shared_ptr returnType = mTopology->getType(); + if (returnType == XdmfTopologyType::Polyvertex()) + { + return XDMF_TOPOLOGY_TYPE_POLYVERTEX; + } + else if (returnType == XdmfTopologyType::Polyline(0)) + { + return XDMF_TOPOLOGY_TYPE_POLYLINE; + } + else if (returnType == XdmfTopologyType::Polygon(0)) + { + return XDMF_TOPOLOGY_TYPE_POLYGON; + } + else if (returnType == XdmfTopologyType::Triangle()) + { + return XDMF_TOPOLOGY_TYPE_TRIANGLE; + } + else if (returnType == XdmfTopologyType::Quadrilateral()) + { + return XDMF_TOPOLOGY_TYPE_QUADRILATERAL; + } + else if (returnType == XdmfTopologyType::Tetrahedron()) + { + return XDMF_TOPOLOGY_TYPE_TETRAHEDRON; + } + else if (returnType == XdmfTopologyType::Pyramid()) + { + return XDMF_TOPOLOGY_TYPE_PYRAMID; + } + else if (returnType == XdmfTopologyType::Wedge()) + { + return XDMF_TOPOLOGY_TYPE_WEDGE; + } + else if (returnType == XdmfTopologyType::Hexahedron()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON; + } + else if (returnType == XdmfTopologyType::Edge_3()) + { + return XDMF_TOPOLOGY_TYPE_EDGE_3; + } + else if (returnType == XdmfTopologyType::Triangle_6()) + { + return XDMF_TOPOLOGY_TYPE_TRIANGLE_6; + } + else if (returnType == XdmfTopologyType::Quadrilateral_8()) + { + return XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8; + } + else if (returnType == XdmfTopologyType::Quadrilateral_9()) + { + return XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9; + } + else if (returnType == XdmfTopologyType::Tetrahedron_10()) + { + return XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10; + } + else if (returnType == XdmfTopologyType::Pyramid_13()) + { + return XDMF_TOPOLOGY_TYPE_PYRAMID_13; + } + else if (returnType == XdmfTopologyType::Wedge_15()) + { + return XDMF_TOPOLOGY_TYPE_WEDGE_15; + } + else if (returnType == XdmfTopologyType::Wedge_18()) + { + return XDMF_TOPOLOGY_TYPE_WEDGE_18; + } + else if (returnType == XdmfTopologyType::Hexahedron_20()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20; + } + else if (returnType == XdmfTopologyType::Hexahedron_24()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24; + } + else if (returnType == XdmfTopologyType::Hexahedron_27()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27; + } + else if (returnType == XdmfTopologyType::Hexahedron_64()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64; + } + else if (returnType == XdmfTopologyType::Hexahedron_125()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125; + } + else if (returnType == XdmfTopologyType::Hexahedron_216()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216; + } + else if (returnType == XdmfTopologyType::Hexahedron_343()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343; + } + else if (returnType == XdmfTopologyType::Hexahedron_512()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512; + } + else if (returnType == XdmfTopologyType::Hexahedron_729()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729; + } + else if (returnType == XdmfTopologyType::Hexahedron_1000()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000; + } + else if (returnType == XdmfTopologyType::Hexahedron_1331()) + { + return XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331; + } + else if (returnType == XdmfTopologyType::Mixed()) + { + return XDMF_TOPOLOGY_TYPE_MIXED; + } + else if (returnType == XdmfTopologyType::NoTopologyType()) + { + XdmfError::message(XdmfError::FATAL, "Uninitialized topology type."); + } + else + { + XdmfError::message(XdmfError::FATAL, "Invalid topology type."); + } + } +} + +int +XdmfFortran::retrieveTopologyValueType() +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before its value type can be retrieved."); + } + else + { + shared_ptr dataType = mTopology->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Topology Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Topology Data Type."); + } + } +} + +void +XdmfFortran::retrieveTopologyValues(void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if(mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set topology before its values can be retrieved."); + } + else + { + if (!mTopology->isInitialized()) + { + mTopology->read(); + } + readFromArray(mTopology, + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } +} + +int +XdmfFortran::retrieveTopologyNumElements() +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before the number of Elements it contains can be retrieved."); + } + else + { + return mTopology->getNumberElements(); + } +} + +int +XdmfFortran::retrieveTopologySize() +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before its size can be retrieved."); + } + else + { + return mTopology->getSize(); + } +} + +void +XdmfFortran::clearPreviousTopologies() +{ + mPreviousTopologies.clear(); +} + +int +XdmfFortran::retrieveTopologyNumProperties() +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before the number of properties it contains can be retrieved."); + } + else + { + return mTopology->getItemProperties().size(); + } +} + +void +XdmfFortran::retrieveTopologyProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mTopology == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Topology before the properties it contains can be retrieved."); + } + else + { + if (index < mTopology->getItemProperties().size()) + { + std::map::iterator walker = mTopology->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mTopology->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } +} + +int +XdmfFortran::setDimensions(int numValues, int arrayType, void * pointValues) +{ + mDimensions = XdmfArray::New(); + + // insert dimension values into array + writeToArray(mDimensions, numValues, arrayType, pointValues); + + int id = mPreviousDimensions.size(); + mPreviousDimensions.push_back(mDimensions); + return id; +} + +void +XdmfFortran::openPreviousDimensions(int index) +{ + if (mPreviousDimensions.size()>index) + { + mDimensions = mPreviousDimensions[index]; + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of range."); + } +} + +void +XdmfFortran::clearPreviousDimensions() +{ + mPreviousDimensions.clear(); +} + +void +XdmfFortran::retrieveDimensionsTag(char * tag, int tagLength) +{ + if (mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before its tag can be retrieved."); + } + else + { + char * tempTag = strdup(mDimensions->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } +} + +int +XdmfFortran::retrieveDimensionsValueType() +{ + if (mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before its value type can be retrieved."); + } + else + { + shared_ptr dataType = mDimensions->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Dimension Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Dimension Data Type."); + } + } +} + +void +XdmfFortran::retrieveDimensionsValues(void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if(mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before its values can be retrieved."); + } + else + { + if (!mDimensions->isInitialized()) + { + mDimensions->read(); + } + readFromArray(mDimensions, + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } +} + +int +XdmfFortran::retrieveDimensionsSize() +{ + if (mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Dimensions before its size can be retrieved."); + } + else + { + return mDimensions->getSize(); + } +} + +int +XdmfFortran::retrieveDimensionsNumProperties() +{ + if (mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before the number of properties it contains can be retrieved."); + } + else + { + return mDimensions->getItemProperties().size(); + } +} + +void +XdmfFortran::retrieveDimensionsProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mDimensions == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set dimensions before the properties it contains can be retrieved."); + } + else + { + if (index < mDimensions->getItemProperties().size()) + { + std::map::iterator walker = mDimensions->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mDimensions->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } +} + +int +XdmfFortran::setOrigin(int numValues, int arrayType, void * pointValues) +{ + mOrigin = XdmfArray::New(); + + // insert origin values into array + writeToArray(mOrigin, numValues, arrayType, pointValues); + + int id = mPreviousOrigins.size(); + mPreviousOrigins.push_back(mOrigin); + return id; +} + +void +XdmfFortran::setPreviousOrigin(int index) +{ + if (index < mPreviousOrigins.size()) + { + mOrigin = mPreviousOrigins[index]; + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of bounds."); + } +} + +void +XdmfFortran::clearPreviousOrigins() +{ + mPreviousOrigins.clear(); +} + +void +XdmfFortran::retrieveOriginTag(char * tag, int tagLength) +{ + if (mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before its tag can be retrieved."); + } + else + { + char * tempTag = strdup(mOrigin->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } +} + +int +XdmfFortran::retrieveOriginValueType() +{ + if (mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before its value type can be retrieved."); + } + else + { + shared_ptr dataType = mOrigin->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Origin Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Origin Data Type."); + } + } +} + +void +XdmfFortran::retrieveOriginValues(void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if(mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before its values can be retrieved."); + } + else + { + if (!mOrigin->isInitialized()) + { + mOrigin->read(); + } + readFromArray(mOrigin, + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } +} + +int +XdmfFortran::retrieveOriginSize() +{ + if (mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before its size can be retrieved."); + } + else + { + return mOrigin->getSize(); + } +} + +int +XdmfFortran::retrieveOriginNumProperties() +{ + if (mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set origin before the number of properties it contains can be retrieved."); + } + else + { + return mOrigin->getItemProperties().size(); + } +} + +void +XdmfFortran::retrieveOriginProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mOrigin == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Origin before the properties it contains can be retrieved."); + } + else + { + if (index < mOrigin->getItemProperties().size()) + { + std::map::iterator walker = mOrigin->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mOrigin->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } +} + +int +XdmfFortran::setBrick(int numValues, int arrayType, void * pointValues) +{ + mBrick = XdmfArray::New(); + + // insert brick values into array + writeToArray(mBrick, numValues, arrayType, pointValues); + + int id = mPreviousBricks.size(); + mPreviousBricks.push_back(mBrick); + return id; +} + +void +XdmfFortran::setPreviousBrick(int index) +{ + if (index < mPreviousBricks.size()) + { + mBrick = mPreviousBricks[index]; + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of bounds."); + } +} + +void +XdmfFortran::clearPreviousBricks() +{ + mPreviousBricks.clear(); +} + +void +XdmfFortran::retrieveBrickTag(char * tag, int tagLength) +{ + if (mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set Brick before its tag can be retrieved."); + } + else + { + char * tempTag = strdup(mBrick->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } +} + +int +XdmfFortran::retrieveBrickValueType() +{ + if (mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick before its value type can be retrieved."); + } + else + { + shared_ptr dataType = mBrick->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Brick Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Brick Data Type."); + } + } +} + +void +XdmfFortran::retrieveBrickValues(void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if(mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick before its values can be retrieved."); + } + else + { + if (!mBrick->isInitialized()) + { + mBrick->read(); + } + readFromArray(mBrick, + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } +} + +int +XdmfFortran::retrieveBrickSize() +{ + if (mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick before its size can be retrieved."); + } + else + { + return mBrick->getSize(); + } +} + +int +XdmfFortran::retrieveBrickNumProperties() +{ + if (mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick before the number of properties it contains can be retrieved."); + } + else + { + return mBrick->getItemProperties().size(); + } +} + +void +XdmfFortran::retrieveBrickProperty(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mBrick == NULL) + { + XdmfError::message(XdmfError::FATAL, + "Must set brick before the properties it contains can be retrieved."); + } + else + { + if (index < mBrick->getItemProperties().size()) + { + std::map::iterator walker = mBrick->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mBrick->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } +} + +void +XdmfFortran::addMap(char * name) +{ + shared_ptr addedMap = XdmfMap::New(); + addedMap->setName(name); + mMaps.push_back(addedMap); +} + +int +XdmfFortran::retrieveNumMaps() +{ + return mMaps.size(); +} + +void +XdmfFortran::clearMaps() +{ + mMaps.clear(); +} + +void +XdmfFortran::retrieveMapTag(int index, char * tag, int tagLength) +{ + if (index < mMaps.size()) + { + char * tempTag = strdup(mMaps[index]->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::addRemoteNodeID(int index, int localNodeID, int remoteTaskID, int remoteLocalNodeID) +{ + mMaps[index]->insert(remoteTaskID, localNodeID, remoteLocalNodeID); +} + +void +XdmfFortran::retrieveRemoteNodeIDs(int index, int localNodeID, int remoteTaskID, int * remoteNodeIDs) +{ + if (mMaps.size()>index) + { + if (mMaps[index]->getRemoteNodeIds(remoteTaskID).count(localNodeID)>0) + { + std::set returnSet = mMaps[index]->getRemoteNodeIds(remoteTaskID)[localNodeID]; + std::set::iterator walker; + int i = 0; + for (walker = returnSet.begin(); walker != returnSet.end();walker++) + { + remoteNodeIDs[i] = *walker; + i++; + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "The map does not contain a remote ID for the requested node."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of Range."); + } +} + +int +XdmfFortran::retrieveNumRemoteNodeIDs(int index, int localNodeID, int remoteTaskID) +{ + if (mMaps.size()getRemoteNodeIds(remoteTaskID).count(localNodeID)>0) + { + return mMaps[index]->getRemoteNodeIds(remoteTaskID)[localNodeID].size(); + } + else + { + return 0; + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of Range."); + } +} + +int +XdmfFortran::storeMap(int index) +{ + if (index < mMaps.size()) + { + int id = mPreviousMaps.size(); + mPreviousMaps.push_back(mMaps[index]); + return id; + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of Range."); + } +} + +void +XdmfFortran::addPreviousMap(int index) +{ + if (index < mPreviousMaps.size()) + { + mMaps.push_back(mPreviousMaps[index]); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of range."); + } +} + +void +XdmfFortran::clearPreviousMaps() +{ + mPreviousMaps.clear(); +} + +void +XdmfFortran::removeMap(int index) +{ + if (index < mMaps.size()) + { + mMaps.erase(mMaps.begin()+index); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveMapNumProperties(int index) +{ + if (index < mMaps.size()) + { + return mMaps[index]->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveMapProperty(int mapIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + if (mapIndex < mMaps.size()) + { + if (index < mMaps[index]->getItemProperties().size()) + { + std::map::iterator walker = mMaps[index]->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mMaps[index]->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, + "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveNumAttributes() +{ + return mAttributes.size(); +} + +void +XdmfFortran::clearAttributes() +{ + mAttributes.clear(); +} + +void +XdmfFortran::retrieveAttributeTag(int index, char * tag, int tagLength) +{ + if (index < mAttributes.size()) + { + char * tempTag = strdup(mAttributes[index]->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveAttributeName(int index, char * name, int nameLength) +{ + if (index < mAttributes.size()) + { + char * tempName = strdup(mAttributes[index]->getName().c_str()); + memset(name, 0, nameLength); + memcpy(name, tempName, strlen(tempName)+1); + delete [] tempName; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveAttributeValueType(int index) +{ + if (index < mAttributes.size()) + { + shared_ptr dataType = mAttributes[index]->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Attribute Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Attribute Data Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveAttributeValues(int index, void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if (index < mAttributes.size()) + { + if (!mAttributes[index]->isInitialized()) + { + mAttributes[index]->read(); + } + readFromArray(mAttributes[index], + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::removeAttribute(int index) +{ + if (index < mAttributes.size()) + { + mAttributes.erase(mAttributes.begin()+index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::replaceAttribute(int index, char * name, int attributeCenter, int attributeType, int numValues, int arrayType, void * values) +{ + if (index < mAttributes.size()) + { + shared_ptr currAttribute = XdmfAttribute::New(); + currAttribute->setName(name); + switch(attributeCenter) + { + case XDMF_ATTRIBUTE_CENTER_GRID: + currAttribute->setCenter(XdmfAttributeCenter::Grid()); + break; + case XDMF_ATTRIBUTE_CENTER_CELL: + currAttribute->setCenter(XdmfAttributeCenter::Cell()); + break; + case XDMF_ATTRIBUTE_CENTER_FACE: + currAttribute->setCenter(XdmfAttributeCenter::Face()); + break; + case XDMF_ATTRIBUTE_CENTER_EDGE: + currAttribute->setCenter(XdmfAttributeCenter::Edge()); + break; + case XDMF_ATTRIBUTE_CENTER_NODE: + currAttribute->setCenter(XdmfAttributeCenter::Node()); + break; + default: + XdmfError::message(XdmfError::FATAL, "Invalid attribute center"); + } + + switch(attributeType) + { + case XDMF_ATTRIBUTE_TYPE_SCALAR: + currAttribute->setType(XdmfAttributeType::Scalar()); + break; + case XDMF_ATTRIBUTE_TYPE_VECTOR: + currAttribute->setType(XdmfAttributeType::Vector()); + break; + case XDMF_ATTRIBUTE_TYPE_TENSOR: + currAttribute->setType(XdmfAttributeType::Tensor()); + break; + case XDMF_ATTRIBUTE_TYPE_MATRIX: + currAttribute->setType(XdmfAttributeType::Matrix()); + break; + case XDMF_ATTRIBUTE_TYPE_TENSOR6: + currAttribute->setType(XdmfAttributeType::Tensor6()); + break; + case XDMF_ATTRIBUTE_TYPE_GLOBALID: + currAttribute->setType(XdmfAttributeType::GlobalId()); + break; + default: + XdmfError::message(XdmfError::FATAL, "Invalid attribute type"); + } + + writeToArray(currAttribute, numValues, arrayType, values); + mAttributes[index] = currAttribute; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::openAttribute(int index) +{ + if (index < mAttributes.size()) + { + int i; + shared_ptr openedAttribute = mAttributes[index]; + int n = openedAttribute->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedAttribute->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveAttributeSize(int index) +{ + if (index < mAttributes.size()) + { + return mAttributes[index]->getSize(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveAttributeType(int index) +{ + if (index < mAttributes.size()) + { + shared_ptr returnType = mAttributes[index]->getType(); + if (returnType == XdmfAttributeType::Scalar()) + { + return XDMF_ATTRIBUTE_TYPE_SCALAR; + } + else if (returnType == XdmfAttributeType::Vector()) + { + return XDMF_ATTRIBUTE_TYPE_VECTOR; + } + else if (returnType == XdmfAttributeType::Tensor()) + { + return XDMF_ATTRIBUTE_TYPE_TENSOR; + } + else if (returnType == XdmfAttributeType::Matrix()) + { + return XDMF_ATTRIBUTE_TYPE_MATRIX; + } + else if (returnType == XdmfAttributeType::Tensor6()) + { + return XDMF_ATTRIBUTE_TYPE_TENSOR6; + } + else if (returnType == XdmfAttributeType::GlobalId()) + { + return XDMF_ATTRIBUTE_TYPE_GLOBALID; + } + else + { + return XDMF_ATTRIBUTE_TYPE_NOTYPE; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveAttributeCenter(int index) +{ + if (index < mAttributes.size()) + { + shared_ptr returnCenter = mAttributes[index]->getCenter(); + if (returnCenter == XdmfAttributeCenter::Grid()) + { + return XDMF_ATTRIBUTE_CENTER_GRID; + } + else if (returnCenter == XdmfAttributeCenter::Cell()) + { + return XDMF_ATTRIBUTE_CENTER_CELL; + } + else if (returnCenter == XdmfAttributeCenter::Face()) + { + return XDMF_ATTRIBUTE_CENTER_FACE; + } + else if (returnCenter == XdmfAttributeCenter::Edge()) + { + return XDMF_ATTRIBUTE_CENTER_EDGE; + } + else if (returnCenter == XdmfAttributeCenter::Node()) + { + return XDMF_ATTRIBUTE_CENTER_NODE; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid Attribute Center."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::clearPreviousAttributes() +{ + mPreviousAttributes.clear(); +} + +int +XdmfFortran::retrieveAttributeNumProperties(int index) +{ + if (index < mAttributes.size()) + { + return mAttributes[index]->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveAttributeProperty(int attributeIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + if (attributeIndex < mAttributes.size()) + { + if (index < mAttributes[attributeIndex]->getItemProperties().size()) + { + std::map::iterator walker = mAttributes[attributeIndex]->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mAttributes[index]->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::addCoordinate(char * name, int numValues, int arrayType, void * values) +{ + shared_ptr currArray = XdmfArray::New(); + currArray->setName(name); + + writeToArray(currArray, numValues, arrayType, values); + + mCoordinates.push_back(currArray); + + const int id = mPreviousCoordinates.size(); + mPreviousCoordinates.push_back(currArray); + return id; +} + +void +XdmfFortran::addPreviousCoordinate(int index) +{ + if (index < mPreviousCoordinates.size()) + { + mCoordinates.push_back(mPreviousCoordinates[index]); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::clearPreviousCoordinates() +{ + mPreviousCoordinates.clear(); +} + +int +XdmfFortran::retrieveNumCoordinates() +{ + return mCoordinates.size(); +} + +void +XdmfFortran::retrieveCoordinateTag(int index, char * tag, int tagLength) +{ + if (index < mCoordinates.size()) + { + char * tempTag = strdup(mCoordinates[index]->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveCoordinateName(int index, char * name, int nameLength) +{ + if (index < mCoordinates.size()) + { + char * tempName = strdup(mCoordinates[index]->getName().c_str()); + memset(name, 0, nameLength); + memcpy(name, tempName, strlen(tempName)+1); + delete [] tempName; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveCoordinateValueType(int index) +{ + if (index < mCoordinates.size()) + { + shared_ptr dataType = mCoordinates[index]->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Coordinate Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Coordinate Data Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveCoordinateValues(int index, void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if (index < mCoordinates.size()) + { + if (!mCoordinates[index]->isInitialized()) + { + mCoordinates[index]->read(); + } + readFromArray(mCoordinates[index], + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::removeCoordinate(int index) +{ + if (index < mCoordinates.size()) + { + mCoordinates.erase(mCoordinates.begin()+index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::replaceCoordinate(int index, char * name, int numValues, int arrayType, void * values) +{ + if (index < mCoordinates.size()) + { + shared_ptr currArray = XdmfArray::New(); + currArray->setName(name); + writeToArray(currArray, numValues, arrayType, values); + mCoordinates[index] = currArray; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveCoordinateSize(int index) +{ + if (index < mCoordinates.size()) + { + return mCoordinates[index]->getSize(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::clearCoordinates() +{ + mCoordinates.clear(); +} + +int +XdmfFortran::retrieveCoordinateNumProperties(int index) +{ + if (index < mCoordinates.size()) + { + return mCoordinates[index]->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveCoordinateProperty(int coordinateIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + if (coordinateIndex < mCoordinates.size()) + { + if (index < mCoordinates[coordinateIndex]->getItemProperties().size()) + { + std::map::iterator walker = mCoordinates[coordinateIndex]->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mCoordinates[index]->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::addSet(char * name, int newSetType, void * values, int numValues, int arrayType) +{ + const shared_ptr newSet = XdmfSet::New(); + newSet->setName(name); + + switch (newSetType) + { + case XDMF_SET_TYPE_NODE: + newSet->setType(XdmfSetType::Node()); + break; + case XDMF_SET_TYPE_CELL: + newSet->setType(XdmfSetType::Cell()); + break; + case XDMF_SET_TYPE_FACE: + newSet->setType(XdmfSetType::Face()); + break; + case XDMF_SET_TYPE_EDGE: + newSet->setType(XdmfSetType::Edge()); + break; + default: + XdmfError::message(XdmfError::FATAL, + "Invalid set type."); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + newSet->insert(*iter); + } + mAttributes.clear(); + + if (!mInformations.empty()) + { + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + newSet->insert(*iter); + } + mInformations.clear(); + } + + writeToArray(newSet, numValues, arrayType, values); + + mSets.push_back(newSet); + int id = mPreviousSets.size(); + mPreviousSets.push_back(newSet); + return id; +} + +void +XdmfFortran::clearSets() +{ + mSets.clear(); +} + +void +XdmfFortran::addPreviousSet(int index) +{ + if (index < mPreviousSets.size()) + { + mSets.push_back(mPreviousSets[index]); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::clearPreviousSets() +{ + mPreviousSets.clear(); +} + +void +XdmfFortran::retrieveSetTag(int index, char * tag, int tagLength) +{ + if (index < mSets.size()) + { + char * tempTag = strdup(mSets[index]->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveSetName(int index, char * name, int nameLength) +{ + if (index < mSets.size()) + { + char * tempName = strdup(mSets[index]->getName().c_str()); + memset(name, 0, nameLength); + memcpy(name, tempName, strlen(tempName)+1); + delete [] tempName; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveNumSets() +{ + return mSets.size(); +} + +int +XdmfFortran::retrieveSetSize(int index) +{ + if (index < mSets.size()) + { + return mSets[index]->getSize(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveSetValueType(int index) +{ + if (index < mSets.size()) + { + shared_ptr dataType = mSets[index]->getArrayType(); + if (dataType == XdmfArrayType::Int8()) + { + return XDMF_ARRAY_TYPE_INT8; + } + else if (dataType == XdmfArrayType::Int16()) + { + return XDMF_ARRAY_TYPE_INT16; + } + else if (dataType == XdmfArrayType::Int32()) + { + return XDMF_ARRAY_TYPE_INT32; + } + else if (dataType == XdmfArrayType::Int64()) + { + return XDMF_ARRAY_TYPE_INT64; + } + else if (dataType == XdmfArrayType::UInt8()) + { + return XDMF_ARRAY_TYPE_UINT8; + } + else if (dataType == XdmfArrayType::UInt16()) + { + return XDMF_ARRAY_TYPE_UINT16; + } + else if (dataType == XdmfArrayType::UInt32()) + { + return XDMF_ARRAY_TYPE_UINT32; + } + else if (dataType == XdmfArrayType::Float32()) + { + return XDMF_ARRAY_TYPE_FLOAT32; + } + else if (dataType == XdmfArrayType::Float64()) + { + return XDMF_ARRAY_TYPE_FLOAT64; + } + else if (dataType == XdmfArrayType::Uninitialized()) + { + XdmfError::message(XdmfError::FATAL, + "Uninitialized Set Data Type."); + } + else + { + XdmfError::message(XdmfError::FATAL, + "Invalid Set Data Type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveSetValues(int index, void * values, int dataType, int numberRead, int startIndex, int arrayStride, int valueStride) +{ + if (index < mSets.size()) + { + if (!mSets[index]->isInitialized()) + { + mSets[index]->read(); + } + readFromArray(mSets[index], + dataType, + values, + numberRead, + startIndex, + arrayStride, + valueStride); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveSetType(int index) +{ + if (index < mSets.size()) + { + shared_ptr returnType = mSets[index]->getType(); + if (returnType == XdmfSetType::Node()) + { + return XDMF_SET_TYPE_NODE; + } + else if (returnType == XdmfSetType::Cell()) + { + return XDMF_SET_TYPE_CELL; + } + else if (returnType == XdmfSetType::Face()) + { + return XDMF_SET_TYPE_FACE; + } + else if (returnType == XdmfSetType::Edge()) + { + return XDMF_SET_TYPE_EDGE; + } + else if (returnType == XdmfSetType::NoSetType()) + { + XdmfError::message(XdmfError::FATAL, "Error: Uninitialized set type."); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Invalid set type."); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::openSet(int index, int openAttribute, int openInformation) +{ + if (index < mSets.size()) + { + shared_ptr openedSet = mSets[index]; + int i; + int n; + n = openedSet->getNumberAttributes(); + if (openAttribute == 1) + { + shared_ptr openedAttribute; + for (i = 0; i < n; i++) + { + openedAttribute = openedSet->getAttribute(i); + mAttributes.push_back(openedAttribute); + mPreviousAttributes.push_back(openedAttribute); + } + } + if (openInformation == 1) + { + n = openedSet->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = openedSet->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::removeSet(int index) +{ + if (index < mSets.size()) + { + mSets.erase(mSets.begin()+index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::replaceSet(int index, char * name, int newSetType, void * values, int numValues, int arrayType) +{ + const shared_ptr newSet = XdmfSet::New(); + newSet->setName(name); + + switch (newSetType) + { + case XDMF_SET_TYPE_NODE: + newSet->setType(XdmfSetType::Node()); + break; + case XDMF_SET_TYPE_CELL: + newSet->setType(XdmfSetType::Cell()); + break; + case XDMF_SET_TYPE_FACE: + newSet->setType(XdmfSetType::Face()); + break; + case XDMF_SET_TYPE_EDGE: + newSet->setType(XdmfSetType::Edge()); + break; + default: + XdmfError::message(XdmfError::FATAL, + "Invalid set type."); + } + + for(std::vector >::const_iterator iter = + mAttributes.begin(); + iter != mAttributes.end(); + ++iter) + { + newSet->insert(*iter); + } + mAttributes.clear(); + + if (!mInformations.empty()) + { + for(std::vector >::const_iterator iter = + mInformations.begin(); + iter != mInformations.end(); + ++iter) + { + newSet->insert(*iter); + } + mInformations.clear(); + } + + writeToArray(newSet, numValues, arrayType, values); + + mSets[index] = newSet; +} + +int +XdmfFortran::retrieveSetNumProperties(int index) +{ + if (index < mSets.size()) + { + return mSets[index]->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveSetProperty(int setIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + if (setIndex < mSets.size()) + { + if (index < mSets[setIndex]->getItemProperties().size()) + { + std::map::iterator walker = mSets[setIndex]->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mSets[index]->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +int +XdmfFortran::retrieveNumInformation() +{ + return mInformations.size(); +} + +void +XdmfFortran::clearInformations() +{ + mInformations.clear(); +} + +void +XdmfFortran::retrieveInformationTag(int index, char * tag, int tagLength) +{ + if (index < mInformations.size()) + { + char * tempTag = strdup(mInformations[index]->getItemTag().c_str()); + memset(tag, 0, tagLength); + memcpy(tag, tempTag, strlen(tempTag)+1); + delete [] tempTag; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveInformation(int index, char * key, int keyLength, char * value, int valueLength) +{ + if (index < mInformations.size()) + { + char * tempKey = strdup(mInformations[index]->getKey().c_str()); + char * tempValue = strdup(mInformations[index]->getValue().c_str()); + memset(key, 0, keyLength); + memset(value, 0, valueLength); + memcpy(key, tempKey, strlen(tempKey)+1); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempKey; + delete [] tempValue; + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::replaceInformation(int index, char * key, char * value) +{ + if (index < mInformations.size()) + { + mInformations[index]->setKey(key); + mInformations[index]->setValue(value); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::removeInformation(int index) +{ + if (index < mInformations.size()) + { + mInformations.erase(mInformations.begin()+index); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::openInformation(int index) +{ + if (index < mInformations.size()) + { + shared_ptr sourceInformation = mInformations[index]; + int i; + int n = sourceInformation->getNumberInformations(); + shared_ptr openedInformation; + for (i = 0; i < n; i++) + { + openedInformation = sourceInformation->getInformation(i); + mInformations.push_back(openedInformation); + mPreviousInformations.push_back(openedInformation); + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveInformationByKey(char * key, char * value, int valueLength) +{ + int i; + int found = 0; + std::string searchString(key); + char * tempValue; + for (i=0;igetKey()) + { + found = 1; + tempValue = strdup(mInformations[i]->getValue().c_str()); + memset(value, 0, valueLength); + memcpy(value, tempValue, strlen(tempValue)+1); + i = mInformations.size(); + delete [] tempValue; + } + } + if (found == 0) + { + XdmfError::message(XdmfError::FATAL, "Error: Item with specifed key does not exist."); + } +} + +void +XdmfFortran::replaceInformationByKey(char * key, char * value) +{ + int i; + int found = 0; + std::string searchString(key); + for (i=0;igetKey()) + { + mInformations[i]->setValue(value); + i = mInformations.size(); + found = 1; + } + } + if (found == 0) + { + XdmfError::message(XdmfError::FATAL, "Error: Item with specifed key does not exist."); + } +} + +void +XdmfFortran::removeInformationByKey(char * key) +{ + int i; + int found = 0; + std::string searchString(key); + for (i=0;igetKey()) + { + mInformations.erase(mInformations.begin()+i); + i = mInformations.size(); + found = 1; + } + } + if (found == 0) + { + XdmfError::message(XdmfError::FATAL, "Error: Item with specifed key does not exist."); + } +} + +void +XdmfFortran::clearPreviousInformation() +{ + mPreviousInformations.clear(); +} + +int +XdmfFortran::retrieveInformationNumProperties(int index) +{ + if (index < mInformations.size()) + { + return mInformations[index]->getItemProperties().size(); + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + +void +XdmfFortran::retrieveInformationProperty(int informationIndex, int index, char * key, int keyLength, char * value, int valueLength) +{ + if (informationIndex < mInformations.size()) + { + if (index < mInformations[informationIndex]->getItemProperties().size()) + { + std::map::iterator walker = mInformations[informationIndex]->getItemProperties().begin(); + for (int i = 0; igetItemProperties().count(tempString))>0) + { + char * tempValue = strdup(mInformations[index]->getItemProperties()[tempString].c_str()); + memcpy(value, tempValue, strlen(tempValue)+1); + delete [] tempValue; + } + } + else + { + XdmfError::message(XdmfError::FATAL, "Error: Index out of range."); + } +} + + +void +XdmfFortran::clearPrevious() +{ + mPreviousTopologies.clear(); + mPreviousGeometries.clear(); + mPreviousAttributes.clear(); + mPreviousMaps.clear(); + mPreviousSets.clear(); + mPreviousDimensions.clear(); + mPreviousOrigins.clear(); + mPreviousBricks.clear(); + mPreviousCoordinates.clear(); +} + + + + + +void +XdmfFortran::write(const char * const xmlFilePath) +{ + shared_ptr writer = XdmfWriter::New(xmlFilePath); + mDomain->accept(writer); +} + +void +XdmfFortran::writeHDF5(const char * const xmlFilePath) +{ + shared_ptr writer = XdmfHDF5Writer::New(xmlFilePath); + writer->setReleaseData( true ); + mDomain->accept(writer); +} + +void +XdmfFortran::read(const char * const xmlFilePath) +{ + shared_ptr reader = XdmfReader::New(); + mDomain = shared_dynamic_cast(reader->read( xmlFilePath )); +} + +// +// C++ will mangle the name based on the argument list. This tells the +// compiler not to mangle the name so we can call it from 'C' (but +// really Fortran in this case) +// +extern "C" +{ + void + XdmfInit(long * pointer) + { + XdmfFortran * xdmfFortran = new XdmfFortran(); + *pointer = reinterpret_cast(xdmfFortran); + } + + void + XdmfClose(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + delete xdmfFortran; + } + + int + XdmfAddAttribute(long * pointer, + char * const name, + int * attributeCenter, + int * attributeType, + int * numValues, + int * arrayType, + void * values) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->addAttribute(name, + *attributeCenter, + *attributeType, + *numValues, + *arrayType, + values); + } + + void + XdmfAddGrid(long * pointer, + char * gridName, + int * gridType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addGrid(gridName, *gridType); + } + + void + XdmfAddGridCollection(long * pointer, + char * name, + int * gridCollectionType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addGridCollection(name, + *gridCollectionType); + } + + int + XdmfAddInformation(long * pointer, + char * key, + char * value) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->addInformation(key, value); + } + + void + XdmfAddPreviousAttribute(long * pointer, + int * attributeId) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addPreviousAttribute(*attributeId); + } + + void + XdmfAddPreviousInformation(long * pointer, + int * informationId) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addPreviousInformation(*informationId); + } + + void + XdmfCloseGridCollection(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->closeGridCollection(); + } + + int + XdmfSetGeometry(long * pointer, + int * geometryType, + int * numValues, + int * arrayType, + void * pointValues) + { + + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->setGeometry(*geometryType, + *numValues, + *arrayType, + pointValues); + } + + void + XdmfSetPreviousGeometry(long * pointer, + int * geometryId) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->setPreviousGeometry(*geometryId); + } + + void + XdmfSetPreviousTopology(long * pointer, + int * topologyId) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->setPreviousTopology(*topologyId); + } + + void + XdmfSetTime(long * pointer, + double * time) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->setTime(*time); + } + + int + XdmfSetTopology(long * pointer, + int * topologyType, + int * numValues, + int * arrayType, + void * connectivityValues) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->setTopology(*topologyType, + *numValues, + *arrayType, + connectivityValues); + } + + + + + void + XdmfRetrieveNumDomainGridCollections(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumDomainGridCollections(); + } + + void + XdmfRetrieveNumGridCollectionGridCollections(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->numGridCollectionGridCollections(); + } + + void + XdmfRetrieveDomainTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainTag(tag, *tagLength); + } + + void + XdmfRetrieveDomainNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveDomainNumProperties(); + } + + void + XdmfRetrieveDomainProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveDomainPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainPropertyByKey(key, value, *valueLength); + } + + void + XdmfOpenDomainGridCollection(long * pointer, int * index, int * openMaps, int * openAttributes, int * openInformation, int * openSets) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openDomainGridCollection(*index, *openMaps, *openAttributes, *openInformation, *openSets); + } + + void + XdmfRemoveDomainGridCollection(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeDomainGridCollection(*index); + } + + void + XdmfOpenGridCollectionGridCollection(long * pointer, int * index, int * openMaps, int * openAttributes, int * openInformation, int * openSets) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openGridCollectionGridCollection(*index, *openMaps, *openAttributes, *openInformation, *openSets); + } + + void + XdmfRemoveGridCollectionGridCollection(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeGridCollectionGridCollection(*index); + } + + void + XdmfRetrieveGridCollectionTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionTag(tag, *tagLength); + } + + void + XdmfRetrieveGridCollectionNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveGridCollectionNumProperties(); + } + + void + XdmfRetrieveGridCollectionProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveGridCollectionPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionPropertyByKey(key, value, *valueLength); + } + + void + XdmfRetrieveGridCollectionNumGrids(long * pointer, int * gridType, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->numGridCollectionGrids(*gridType); + } + + void + XdmfRetrieveDomainNumGrids(long * pointer, int * gridType, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->numDomainGrids(*gridType); + } + + void + XdmfOpenDomainGrid(long * pointer, int * gridType, int * index, int * openMaps, int * openAttributes, int * openInformation, int * openSets) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openDomainGrid(*gridType, *index, *openMaps, *openAttributes, *openInformation, *openSets); + } + + void + XdmfRemoveDomainGrid(long * pointer, int * gridType, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeDomainGrid(*gridType, *index); + } + + void + XdmfReplaceDomainGrid(long * pointer, int * gridType, int * index, char * name) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceDomainGrid(*gridType, *index, name); + } + + void + XdmfRetrieveDomainGridTag(long * pointer, int * gridType, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainGridTag(*gridType, *index, tag, *tagLength); + } + + void + XdmfRetrieveDomainGridName(long * pointer, int * gridType, int * index, char * name, int * nameLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainGridName(*gridType, *index, name, *nameLength); + } + + void + XdmfRetrieveDomainGridNumProperties(long * pointer, int * gridType, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveDomainGridNumProperties(*gridType, *index); + } + + void + XdmfRetrieveDomainGridProperty(long * pointer, int * gridType, int * gridIndex, int * index, + char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainGridProperty(*gridType, *gridIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveDomainGridPropertyByKey(long * pointer, int * gridType, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDomainGridPropertyByKey(*gridType, *index, key, value, *valueLength); + } + + void + XdmfOpenGridCollectionGrid(long * pointer, int * gridType, int * index, + int * openMaps, int * openAttributes, int * openInformation, int * openSets) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openGridCollectionGrid(*gridType, *index, *openMaps, *openAttributes, *openInformation, *openSets); + } + + void + XdmfRemoveGridCollectionGrid(long * pointer, int * gridType, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeGridCollectionGrid(*gridType, *index); + } + + void + XdmfReplaceGridCollectionGrid(long * pointer, int * gridType, int * index, char * name) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceGridCollectionGrid(*gridType, *index, name); + } + + void + XdmfRetrieveGridCollectionGridTag(long * pointer, int * gridType, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionGridTag(*gridType, *index, tag, *tagLength); + } + + void + XdmfRetrieveGridCollectionGridName(long * pointer, int * gridType, int * index, char * name, int * nameLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionGridName(*gridType, *index, name, *nameLength); + } + + void + XdmfRetrieveGridCollectionGridNumProperties(long * pointer,int * gridType, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveGridCollectionGridNumProperties(*gridType, *index); + } + + void + XdmfRetrieveGridCollectionGridProperty(long * pointer, int * gridType, int * gridIndex, int * index, + char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionGridProperty(*gridType, *gridIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveGridCollectionGridPropertyByKey(long * pointer, int * gridType, int *index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGridCollectionGridPropertyByKey(*gridType, *index, key, value, *valueLength); + } + + void + XdmfRetrieveGridCollectionType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveGridCollectionType(); + } + + void + XdmfRetrieveTime(long * pointer, double * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveTime(); + } + + void + XdmfRetrieveTopologyTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveTopologyTag(tag, *tagLength); + } + + void + XdmfRetrieveTopologyValues(long * pointer, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveTopologyValues(values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveTopologyType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveTopologyType(); + } + + void + XdmfRetrieveTopologyValueType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveTopologyValueType(); + } + + void + XdmfRetrieveTopologyNumElements(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveTopologyNumElements(); + } + + void + XdmfRetrieveTopologySize(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveTopologySize(); + } + + void + XdmfClearPreviousTopologies(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousTopologies(); + } + + void + XdmfRetrieveTopologyNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveTopologyNumProperties(); + } + + void + XdmfRetrieveTopologyProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveTopologyProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveTopologyPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveTopologyPropertyByKey(key, value, *valueLength); + } + + void + XdmfRetrieveGeometryTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGeometryTag(tag, *tagLength); + } + + void + XdmfRetrieveGeometryValues(long * pointer, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGeometryValues(values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveGeometryType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveGeometryType(); + } + + void + XdmfRetrieveGeometryValueType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveGeometryValueType(); + } + + void + XdmfRetrieveGeometryNumPoints(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveGeometryNumPoints(); + } + + void + XdmfRetrieveGeometrySize(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveGeometrySize(); + } + + void + XdmfClearPreviousGeometries(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousGeometries(); + } + + void + XdmfRetrieveGeometryNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveGeometryNumProperties(); + } + + void + XdmfRetrieveGeometryProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGeometryProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveGeometryPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveGeometryPropertyByKey(key, value, *valueLength); + } + + int + XdmfSetDimensions(long * pointer, int * numValues, int * arrayType, void * pointValues) + { + + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->setDimensions(*numValues, *arrayType, pointValues); + } + + void + XdmfOpenPreviousDimensions(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openPreviousDimensions(*index); + } + + void + XdmfClearPreviousDimensions(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousDimensions(); + } + + void + XdmfRetrieveDimensionsTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDimensionsTag(tag, *tagLength); + } + + void + XdmfRetrieveDimensionsValues(long * pointer, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDimensionsValues(values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveDimensionsValueType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveDimensionsValueType(); + } + + void + XdmfRetrieveDimensionsSize(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveDimensionsSize(); + } + + void + XdmfRetrieveDimensionsNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveDimensionsNumProperties(); + } + + void + XdmfRetrieveDimensionsProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDimensionsProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveDimensionsPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveDimensionsPropertyByKey(key, value, *valueLength); + } + + int + XdmfSetOrigin(long * pointer, int * numValues, int * arrayType, void * pointValues) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->setOrigin(*numValues, *arrayType, pointValues); + } + + void + XdmfSetPreviousOrigin(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->setPreviousOrigin(*index); + } + + void + XdmfClearPreviousOrigins(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousOrigins(); + } + + void + XdmfRetrieveOriginTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveOriginTag(tag, *tagLength); + } + + void + XdmfRetrieveOriginValues(long * pointer, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveOriginValues(values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveOriginValueType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveOriginValueType(); + } + + void + XdmfRetrieveOriginSize(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveOriginSize(); + } + + void + XdmfRetrieveOriginNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveOriginNumProperties(); + } + + void + XdmfRetrieveOriginProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveOriginProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveOriginPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveOriginPropertyByKey(key, value, *valueLength); + } + + int + XdmfSetBrick(long * pointer, int * numValues, int * arrayType, void * pointValues) + { + + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->setBrick(*numValues, *arrayType, pointValues); + } + + void + XdmfSetPreviousBrick(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->setPreviousBrick(*index); + } + + void + XdmfClearPreviousBricks(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousBricks(); + } + + void + XdmfRetrieveBrickTag(long * pointer, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveBrickTag(tag, *tagLength); + } + + void + XdmfRetrieveBrickValues(long * pointer, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveBrickValues(values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveBrickValueType(long * pointer, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveBrickValueType(); + } + + void + XdmfRetrieveBrickSize(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveBrickSize(); + } + + void + XdmfRetrieveBrickNumProperties(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveBrickNumProperties(); + } + + void + XdmfRetrieveBrickProperty(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveBrickProperty(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveBrickPropertyByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveBrickPropertyByKey(key, value, *valueLength); + } + + void + XdmfAddMap(long * pointer, char * name) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addMap(name); + } + + void + XdmfRetrieveNumMaps(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumMaps(); + } + + void + XdmfRetrieveMapTag(long * pointer, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveMapTag(*index, tag, *tagLength); + } + + void + XdmfAddRemoteNodeID(long * pointer, int * index, int * localNodeID, int * remoteTaskID, int * remoteLocalNodeID) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addRemoteNodeID(*index, *localNodeID, *remoteTaskID, *remoteLocalNodeID); + } + + void + XdmfRetrieveRemoteNodeIDs(long * pointer, int * index, int * localNodeID, int * remoteTaskID, int * remoteLocalNodeIDs) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveRemoteNodeIDs(*index, *localNodeID, *remoteTaskID, remoteLocalNodeIDs); + } + + void + XdmfRetrieveNumRemoteNodeIDs(long * pointer, int * index, int * localNodeID, int * remoteTaskID, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumRemoteNodeIDs(*index, *localNodeID, *remoteTaskID); + } + + void + XdmfClearMaps(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearMaps(); + } + + void + XdmfRemoveMap(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeMap(*index); + } + + int + XdmfStoreMap(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->storeMap(*index); + } + + void + XdmfAddPreviousMap(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addPreviousMap(*index); + } + + void + XdmfClearPreviousMaps(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousMaps(); + } + + void + XdmfRetrieveMapNumProperties(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveMapNumProperties(*index); + } + + void + XdmfRetrieveMapProperty(long * pointer, int * mapIndex, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveMapProperty(*mapIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveMapPropertyByKey(long * pointer, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveMapPropertyByKey(*index, key, value, *valueLength); + } + + void + XdmfClearAttributes(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearAttributes(); + } + + void + XdmfRetrieveNumAttributes(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumAttributes(); + } + + void + XdmfReplaceAttribute(long * pointer, int * index, char * name, int * attributeCenter, + int * attributeType, int * numValues, int * arrayType, void * values) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceAttribute(*index, name, *attributeCenter, *attributeType, *numValues, *arrayType, values); + } + + void + XdmfRemoveAttribute(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeAttribute(*index); + } + + void + XdmfOpenAttribute(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openAttribute(*index); + } + + void + XdmfRetrieveAttributeTag(long * pointer, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveAttributeTag(*index, tag, *tagLength); + } + + void + XdmfRetrieveAttributeName(long * pointer, int * index, char * name, int * nameLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveAttributeName(*index, name, *nameLength); + } + + void + XdmfRetrieveAttributeValues(long * pointer, int * index, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveAttributeValues(*index, values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveAttributeType(long * pointer, int * index, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveAttributeType(*index); + } + + void + XdmfRetrieveAttributeCenter(long * pointer, int * index, int * returnCenter) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnCenter = xdmfFortran->retrieveAttributeCenter(*index); + } + + void + XdmfRetrieveAttributeValueType(long * pointer, int * index, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveAttributeValueType(*index); + } + + void + XdmfRetrieveAttributeSize(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveAttributeSize(*index); + } + + void + XdmfClearPreviousAttributes(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousAttributes(); + } + + void + XdmfRetrieveAttributeNumProperties(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveAttributeNumProperties(*index); + } + + void + XdmfRetrieveAttributeProperty(long * pointer, int * attributeIndex, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveAttributeProperty(*attributeIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveAttributePropertyByKey(long * pointer, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveAttributePropertyByKey(*index, key, value, *valueLength); + } + + void + XdmfRetrieveNumCoordinates(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumCoordinates(); + } + + int + XdmfAddCoordinate(long * pointer, char * name, int * numValues, int * arrayType, void * values) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->addCoordinate(name, *numValues, *arrayType, values); + } + + void + XdmfAddPreviousCoordinate(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addPreviousCoordinate(*index); + } + + void + XdmfClearPreviousCoordinates(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousCoordinates(); + } + + void + XdmfReplaceCoordinate(long * pointer, int * index, char * name, int * numValues, int * arrayType, void * values) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceCoordinate(*index, name, *numValues, *arrayType, values); + } + + void + XdmfRemoveCoordinate(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeCoordinate(*index); + } + + void + XdmfRetrieveCoordinateTag(long * pointer, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveCoordinateTag(*index, tag, *tagLength); + } + + void + XdmfRetrieveCooridnateName(long * pointer, int * index, char * name, int * nameLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveCoordinateName(*index, name, *nameLength); + } + + void + XdmfRetrieveCoordinateValues(long * pointer, int * index, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveCoordinateValues(*index, values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfRetrieveCoordinateValueType(long * pointer, int * index, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveCoordinateValueType(*index); + } + + void + XdmfRetrieveCoordinateSize(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveCoordinateSize(*index); + } + + void + XdmfClearCoordinates(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearCoordinates(); + } + + void + XdmfRetrieveCoordinateNumProperties(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveCoordinateNumProperties(*index); + } + + void + XdmfRetrieveCoordinateProperty(long * pointer, int * coordinateIndex, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveCoordinateProperty(*coordinateIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveCoordinatePropertyByKey(long * pointer, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveCoordinatePropertyByKey(*index, key, value, *valueLength); + } + + void + XdmfRetrieveSetTag(long * pointer, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveSetTag(*index, tag, *tagLength); + } + + void + XdmfRetrieveSetName(long * pointer, int * index, char * name, int * nameLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveSetTag(*index, name, *nameLength); + } + + void + XdmfRetrieveSetType(long * pointer, int * index, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveSetType(*index); + } + + int + XdmfAddSet(long * pointer, char * name, int * newSetType, char * values, int * numValues, int * arrayType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + return xdmfFortran->addSet(name, *newSetType, values, *numValues, *arrayType); + } + + void + XdmfAddPreviousSet(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->addPreviousSet(*index); + } + + void + XdmfClearPreviousSets(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousSets(); + } + + void + XdmfClearSets(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearSets(); + } + + void + XdmfRetrieveNumSets(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumSets(); + } + + void + XdmfRetrieveSetSize(long * pointer, int * total, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveSetSize(*index); + } + + void + XdmfRetrieveSetValueType(long * pointer, int * index, int * returnType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *returnType = xdmfFortran->retrieveSetValueType(*index); + } + + void + XdmfRetrieveSetValues(long * pointer, int * index, void * values, int * dataType, + int * numberRead, int * startIndex, int * arrayStride, int * valueStride) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveSetValues(*index, values, *dataType, *numberRead, *startIndex, *arrayStride, *valueStride); + } + + void + XdmfOpenSet(long * pointer, int * index, int * openAttributes, int * openInformation) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openSet(*index, *openAttributes, *openInformation); + } + + void + XdmfRemoveSet(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeSet(*index); + } + + void + XdmfReplaceSet(long * pointer, int * index, char * name, int * newSetType, char * values, int * numValues, int * arrayType) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceSet(*index, name, *newSetType, values, *numValues, *arrayType); + } + + void + XdmfRetrieveSetNumProperties(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveSetNumProperties(*index); + } + + void + XdmfRetrieveSetProperty(long * pointer, int * setIndex, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveSetProperty(*setIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveSetPropertyByKey(long * pointer, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveSetPropertyByKey(*index, key, value, *valueLength); + } + + void + XdmfRetrieveNumInformation(long * pointer, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveNumInformation(); + } + + void + XdmfRetrieveInformationTag(long * pointer, int * index, char * tag, int * tagLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveInformationTag(*index, tag, *tagLength); + } + + void + XdmfRetrieveInformation(long * pointer, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveInformation(*index, key, *keyLength, value, *valueLength); + } + + void + XdmfRemoveInformation(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeInformation(*index); + } + + void + XdmfReplaceInformation(long * pointer, int * index, char * key, char * value) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceInformation(*index, key, value); + } + + void + XdmfOpenInformation(long * pointer, int * index) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->openInformation(*index); + } + + void + XdmfRetrieveInformationByKey(long * pointer, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveInformationByKey(key, value, *valueLength); + } + + void + XdmfRemoveInformationByKey(long * pointer, char * key) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->removeInformationByKey(key); + } + + void + XdmfReplaceInformationByKey(long * pointer, char * key, char * value) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->replaceInformationByKey(key, value); + } + + void + XdmfClearPreviousInformation(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPreviousInformation(); + } + + void + XdmfClearInformations(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearInformations(); + } + + void + XdmfRetrieveInformationNumProperties(long * pointer, int * index, int * total) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + *total = xdmfFortran->retrieveInformationNumProperties(*index); + } + + void + XdmfRetrieveInformationProperty(long * pointer, int * informationIndex, int * index, char * key, int * keyLength, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveInformationProperty(*informationIndex, *index, key, *keyLength, value, *valueLength); + } + + void + XdmfRetrieveInformationPropertyByKey(long * pointer, int * index, char * key, char * value, int * valueLength) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->retrieveInformationPropertyByKey(*index, key, value, *valueLength); + } + + void + XdmfClearPrevious(long * pointer) + { + XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); + xdmfFortran->clearPrevious(); + } - void - XdmfSetPreviousGeometry(long * pointer, - int * geometryId) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->setPreviousGeometry(*geometryId); - } - void - XdmfSetPreviousTopology(long * pointer, - int * topologyId) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->setPreviousTopology(*topologyId); - } - void - XdmfSetTime(long * pointer, - double * time) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->setTime(*time); - } - int - XdmfSetTopology(long * pointer, - int * topologyType, - int * numValues, - int * arrayType, - void * connectivityValues) - { - XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - return xdmfFortran->setTopology(*topologyType, - *numValues, - *arrayType, - connectivityValues); - } void XdmfWrite(long * pointer, - char * xmlFilePath, - const unsigned int * numValues) + char * xmlFilePath) { XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); - xdmfFortran->write(xmlFilePath, *numValues); + xdmfFortran->write(xmlFilePath); } void XdmfWriteHDF5(long * pointer, - char * xmlFilePath ) + char * xmlFilePath) { XdmfFortran * xdmfFortran = reinterpret_cast(*pointer); xdmfFortran->writeHDF5(xmlFilePath); diff --git a/utils/XdmfFortran.hpp b/utils/XdmfFortran.hpp index 569834b445951d618b1d05bd89766514fc17bcbf..d4f5a9ff475ae84aa6cc9091f39dc2b9f2d3940b 100644 --- a/utils/XdmfFortran.hpp +++ b/utils/XdmfFortran.hpp @@ -33,6 +33,12 @@ class XdmfGridCollection; class XdmfInformation; class XdmfTime; class XdmfTopology; +class XdmfArray; +class XdmfMap; +class XdmfSet; +class XdmfCurvilinearGrid; +class XdmfRectilinearGrid; +class XdmfRegularGrid; class XdmfUnstructuredGrid; //Includes @@ -119,7 +125,24 @@ class XdmfUnstructuredGrid; #define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 527 #define XDMF_TOPOLOGY_TYPE_MIXED 528 -// This works with g77. Different compilers require different +/** + * Set Type + */ +#define XDMF_SET_TYPE_NODE 601 +#define XDMF_SET_TYPE_CELL 602 +#define XDMF_SET_TYPE_FACE 603 +#define XDMF_SET_TYPE_EDGE 604 + +/** + * Grid Type + */ +#define XDMF_GRID_TYPE_CURVILINEAR 701 +#define XDMF_GRID_TYPE_RECTILINEAR 702 +#define XDMF_GRID_TYPE_REGULAR 703 +#define XDMF_GRID_TYPE_UNSTRUCTURED 704 + + +// This works with g77 and gfortran. Different compilers require different // name mangling. #if !defined(WIN32) #define XdmfInit xdmfinit_ @@ -139,6 +162,175 @@ class XdmfUnstructuredGrid; #define XdmfWrite xdmfwrite_ #define XdmfRead xdmfread_ #define XdmfWriteHDF5 xdmfwritehdf5_ + + + +#define XdmfRetrieveNumDomainGridCollections xdmfretrievenumdomaingridcollections_ +#define XdmfRetrieveNumGridCollectionGridCollections xdmfretrievenumgridcollectiongridcollections_ +#define XdmfRetrieveDomainTag xdmfretrievedomaintag_ +#define XdmfRetrieveDomainNumProperties xdmfretrievedomainnumproperties_ +#define XdmfRetrieveDomainProperty xdmfretrievedomainproperty_ +#define XdmfRetrieveDomainPropertyByKey xdmfretrievedomainpropertybykey_ +#define XdmfOpenDomainGridCollection xdmfopendomaingridcollection_ +#define XdmfRemoveDomainGridCollection xdmfremovedomaingridcollection_ +#define XdmfOpenGridCollectionGridCollection xdmfopengridcollectiongridcollection_ +#define XdmfRemoveGridCollectionGridCollection xdmfremovegricollectiongridcollection_ +#define XdmfRetrieveGridCollectionTag xdmfretrievegridcollectiontag_ +#define XdmfRetrieveGridCollectionNumProperties xdmfretrievegridcollectionnumproperties_ +#define XdmfRetrieveGridCollectionProperty xdmfretrievegridcollectionproperty_ +#define XdmfRetrieveGridCollectionPropertyByKey xdmfretrievegridcollectionpropertybykey_ +#define XdmfRetrieveGridCollectionNumGrids xdmfretrievegridcollectionnumgrids_ +#define XdmfRetrieveDomainNumGrids xdmfretrievedomainnumgrids_ +#define XdmfOpenDomainGrid xdmfopendomaingrid_ +#define XdmfRemoveDomainGrid xdmfremovedomaingrid_ +#define XdmfReplaceDomainGrid xdmfreplacedomaingrid_ +#define XdmfRetrieveDomainGridTag xdmfretrievedomaingridtag_ +#define XdmfRetrieveDomainGridName xdmfretrievedomaingridname_ +#define XdmfRetrieveDomainGridNumProperties xdmfretrievedomaingridnumproperties_ +#define XdmfRetrieveDomainGridProperty xdmfretrievedomaingridproperty_ +#define XdmfRetrieveDomainGridPropertyByKey xdmfretrievedomaingridpropertybykey_ +#define XdmfOpenGridCollectionGrid xdmfopengridcollectiongrid_ +#define XdmfRemoveGridCollectionGrid xdmfremovegridcollectiongrid_ +#define XdmfReplaceGridCollectionGrid xdmfreplacegridcollectiongrid_ +#define XdmfRetrieveGridCollectionGridTag xdmfretrievegridcollectiongridtag_ +#define XdmfRetrieveGridCollectionGridName xdmfretrievegridcollectiongridname_ +#define XdmfRetrieveGridCollectionGridNumProperties xdmfretrievegridcollectiongridnumproperties_ +#define XdmfRetrieveGridCollectionGridProperty xdmfretrievegridcollectiongridproperty_ +#define XdmfRetrieveGridCollectionGridPropertyByKey xdmfretrievegridcollectiongridpropertybykey_ +#define XdmfRetrieveGridCollectionType xdmfretrievegridcollectiontype_ +#define XdmfRetrieveTime xdmfretrievetime_ +#define XdmfRetrieveTopologyTag xdmfretrievetopologytag_ +#define XdmfRetrieveTopologyType xdmfretrievetopologytype_ +#define XdmfRetrieveTopologyValueType xdmfretrievetopologyvaluetype_ +#define XdmfRetrieveTopologyValues xdmfretrievetopologyvalues_ +#define XdmfRetrieveTopologyNumElements xdmfretrievetopologynumelements_ +#define XdmfRetrieveTopologySize xdmfretrievetopologysize_ +#define XdmfClearPreviousTopologies xdmfclearprevioustopologies_ +#define XdmfRetrieveTopologyNumProperties xdmfretrievetopologynumproperties_ +#define XdmfRetrieveTopologyProperty xdmfretrievetopologyproperty_ +#define XdmfRetrieveTopologyPropertyByKey xdmfretrievetopologypropertybykey_ +#define XdmfRetrieveGeometryTag xdmfretrievegeometrytag_ +#define XdmfRetrieveGeometryType xdmfretrievegeometrytype_ +#define XdmfRetrieveGeometryValues xdmfretrievegeometryvalues_ +#define XdmfRetrieveGeometryValueType xdmfretrievegeometryvaluetype_ +#define XdmfRetrieveGeometryNumPoints xdmfretrievegeometrynumpoints_ +#define XdmfRetrieveGeometrySize xdmfretrievegeometrysize_ +#define XdmfClearPreviousGeometries xdmfclearpreviousgeometries_ +#define XdmfRetrieveGeometryNumProperties xdmfretrievegeometrynumproperties_ +#define XdmfRetrieveGeometryProperty xdmfretrievegeometryproperty_ +#define XdmfRetrieveGeometryPropertyByKey xdmfretrievegeometrypropertybykey_ +#define XdmfSetDimensions xdmfsetdimensions_ +#define XdmfOpenPreviousDimensions xdmfopenpreviousdimensions_ +#define XdmfClearPreviousDimensions xdmfclearpreviousdimensions_ +#define XdmfRetrieveDimensionsTag xdmfretrievedimensionstag_ +#define XdmfRetrieveDimensionsType xdmfretrievedimensionstype_ +#define XdmfRetrieveDimensionsValueType xdmfretrievedimensionsvaluetype_ +#define XdmfRetrieveDimensionsValues xdmfretrievedimensionsvalues_ +#define XdmfRetrieveDimensionsNumElements xdmfretrievedimensionsnumelements_ +#define XdmfRetrieveDimensionsSize xdmfretrievedimensionssize_ +#define XdmfRetrieveDimensionsNumProperties xdmfretrievedimensionsnumproperties_ +#define XdmfRetrieveDimensionsProperty xdmfretrievedimensionsproperty_ +#define XdmfRetrieveDimensionsPropertyByKey xdmfretrievedimensionspropertybykey_ +#define XdmfSetOrigin xdmfsetorigin_ +#define XdmfSetPreviousOrigin xdmfsetpreviousorigin_ +#define XdmfClearPreviousOrigins xdmfclearpreviousorigins_ +#define XdmfRetrieveOriginTag xdmfretrieveorigintag_ +#define XdmfRetrieveOriginType xdmfretrieveorigintype_ +#define XdmfRetrieveOriginValueType xdmfretrieveoriginvaluetype_ +#define XdmfRetrieveOriginValues xdmfretrieveoriginvalues_ +#define XdmfRetrieveOriginNumElements xdmfretrieveoriginnumelements_ +#define XdmfRetrieveOriginSize xdmfretrieveoriginsize_ +#define XdmfRetrieveOriginNumProperties xdmfretrieveoriginnumproperties_ +#define XdmfRetrieveOriginProperty xdmfretrieveoriginproperty_ +#define XdmfRetrieveOriginPropertyByKey xdmfretrieveoriginpropertybykey_ +#define XdmfSetBrick xdmfsetbrick_ +#define XdmfSetPreviousBrick xdmfsetpreviousbrick_ +#define XdmfClearPreviousBricks xdmfclearpreviousbricks_ +#define XdmfRetrieveBrickTag xdmfretrievebricktag_ +#define XdmfRetrieveBrickType xdmfretrievebricktype_ +#define XdmfRetrieveBrickValueType xdmfretrievebrickvaluetype_ +#define XdmfRetrieveBrickValues xdmfretrievebrickvalues_ +#define XdmfRetrieveBrickNumElements xdmfretrievebricknumelements_ +#define XdmfRetrieveBrickSize xdmfretrievebricksize_ +#define XdmfRetrieveBrickNumProperties xdmfretrievebricknumproperties_ +#define XdmfRetrieveBrickProperty xdmfretrievebrickproperty_ +#define XdmfRetrieveBrickPropertyByKey xdmfretrievebrickpropertybykey_ +#define XdmfAddMap xdmfaddmap_ +#define XdmfRetrieveNumMaps xdmfretrievenummaps_ +#define XdmfAddRemoteNodeID xdmfaddremotenodeid_ +#define XdmfRetrieveRemoteNodeIDs xdmfretrieveremotenodeids_ +#define XdmfRetrieveNumRemoteNodeIDs xdmfretrievenumremotenodeids_ +#define XdmfRemoveMap xdmfremovemap_ +#define XdmfClearMaps xdmfclearmaps_ +#define XdmfStoreMap xdmfstoremap_ +#define XdmfAddPreviousMap xdmfaddpreviousmap_ +#define XdmfClearPreviousMaps xdmfclearpreviousmaps_ +#define XdmfRetrieveMapNumProperties xdmfretrievemapnumproperties_ +#define XdmfRetrieveMapProperty xdmfretrievemapproperty_ +#define XdmfRetrieveMapPropertyByKey xdmfretrievemappropertybykey_ +#define XdmfRetrieveNumAttributes xdmfretrievenumattributes_ +#define XdmfClearAttributes xdmfclearattributes_ +#define XdmfRemoveAttribute xdmfremoveattribute_ +#define XdmfReplaceAttribute xdmfreplaceattribute_ +#define XdmfOpenAttribute xdmfopenattribute_ +#define XdmfRetrieveAttributeTag xdmfretrieveattributetag_ +#define XdmfRetrieveAttributeName xdmfretrieveattributename_ +#define XdmfRetrieveAttributeType xdmfretrieveattributetype_ +#define XdmfRetrieveAttributeCenter xdmfretrieveattributecenter_ +#define XdmfRetrieveAttributeValues xdmfretrieveattributevalues_ +#define XdmfRetrieveAttributeValueType xdmfretrieveattributevaluetype_ +#define XdmfRetrieveAttributeSize xdmfretrieveattributesize_ +#define XdmfClearPreviousAttributes xdmfclearpreviousattributes_ +#define XdmfRetrieveAttributeNumProperties xdmfretrieveattributenumproperties_ +#define XdmfRetrieveAttributeProperty xdmfretrieveattributeproperty_ +#define XdmfRetrieveAttributePropertyByKey xdmfretrieveattributepropertybykey_ +#define XdmfAddCoordinate xdmfaddcoordinate_ +#define XdmfAddPreviousCoordinate xdmfaddpreviouscoordinate_ +#define XdmfClearPreviousCoordinates xdmfclearpreviouscoordinates_ +#define XdmfRetrieveNumCoordinates xdmfretrievenumcoordinates_ +#define XdmfRemoveCoordinate xdmfremovecoordinate_ +#define XdmfReplaceCoordinate xdmfreplacecoordinate_ +#define XdmfRetrieveCoordinateTag xdmfretrievecoordinatetag_ +#define XdmfRetrieveCoordinateName xdmfretrievecoordinatename_ +#define XdmfRetrieveCoordinateValues xdmfretrievecoordinatevalues_ +#define XdmfRetrieveCoordinateValueType xdmfretrievecoordinatevaluetype_ +#define XdmfRetrieveCoordinateSize xdmfretrievecoordinatesize_ +#define XdmfClearCoordinates xdmfclearcoordinates_ +#define XdmfRetrieveCoordinateNumProperties xdmfretrievecoordinatenumproperties_ +#define XdmfRetrieveCoordinateProperty xdmfretrievecoordinateproperty_ +#define XdmfRetrieveCoordinatePropertyByKey xdmfretrievecoordinatepropertybykey_ +#define XdmfRetrieveSetTag xdmfretrievesettag_ +#define XdmfRetrieveSetName xdmfretrievesetname_ +#define XdmfRetrieveSetType xdmfretrievesettype_ +#define XdmfAddSet xdmfaddset_ +#define XdmfAddPreviousSet xdmfaddpreviousset_ +#define XdmfClearPreviousSets xdmfclearprevioussets_ +#define XdmfClearSets xdmfclearsets_ +#define XdmfRetrieveNumSets xdmfretrievenumsets_ +#define XdmfRetrieveSetSize xdmfretrievesetsize_ +#define XdmfRetrieveSetValues xdmfretrievesetvalues_ +#define XdmfRetrieveSetValueType xdmfretrievesetvaluetype_ +#define XdmfOpenSet xdmfopenet_ +#define XdmfRemoveSet xdmfremoveset_ +#define XdmfReplaceSet xdmfreplaceset_ +#define XdmfRetrieveSetNumProperties xdmfretrievesetnumproperties_ +#define XdmfRetrieveSetProperty xdmfretrievesetproperty_ +#define XdmfRetrieveSetPropertyByKey xdmfretrievesetpropertybykey_ +#define XdmfRetrieveNumInformation xdmfretrievenuminformation_ +#define XdmfRetrieveInformationTag xdmfretrieveinformationtag_ +#define XdmfClearInformations xdmfclearinformations_ +#define XdmfRetrieveInformation xdmfretrieveinformation_ +#define XdmfRemoveInformation xdmfremoveinformation_ +#define XdmfReplaceInformation xdmfreplaceinformation_ +#define XdmfOpenInformation xdmfopeninformation_ +#define XdmfRetrieveInformationByKey xdmfretrieveinformationbykey_ +#define XdmfRemoveInformationByKey xdmfremoveinformationbykey_ +#define XdmfReplaceInformationByKey xdmfreplaceinformationbykey_ +#define XdmfClearPreviousInformation xdmfclearpreviousinformation_ +#define XdmfRetrieveInformationNumProperties xdmfretrieveinformationnumproperties_ +#define XdmfRetrieveInformationProperty xdmfretrieveinformationproperty_ +#define XdmfRetrieveInformationPropertyByKey xdmfretrieveinformationpropertybykey_ +#define XdmfClearPrevious xdmfclearprevious_ #endif /** @@ -184,14 +376,19 @@ public: * Add grid to domain or collection. Inserts geometry, topology, * attributes, and informations into grid. If no geometry or * topology is set, an error is generated. + * The top of parentAttributes, parentInformations, and parentSets + * are placed in mAttributes, mInformations, and mSets * * @param name of the grid. + * @param gridType the type of the grid represented as an integer Ex: XDMF_GRID_TYPE_UNSTRUCTURED */ - void addGrid(const char * const name); + void addGrid(const char * const name, int gridType); /** * Add grid collection to domain or collection. Inserts attributes * and informations into collection. + * The top of parentAttributes, parentInformations, and parentSets + * are placed in mAttributes, mInformations, and mSets * * @param name of the collection. * @param gridCollectionType the grid collection type. @@ -295,46 +492,1735 @@ public: const int arrayType, const void * const connectivityValues); + + + + /** - * Write constructed file to disk. + * Returns the number of grid collections currently + * contained in the domain * - * @param xmlFilePath the path to the xml file to write to. - * @param numValues the number of values to write to light data - * before switching to heavy data. + * @return The number of grid collections */ - void write(const char * const xmlFilePath, const unsigned int numValues); + int retrieveNumDomainGridCollections(); - /** - * Write HDF5 heavy data to disk and release + /** + * Returns the number of grid collections currently + * contained in the grid collection on top of mGridCollections * - * @param xmlFilePath the path to the xml file to write to. + * @return The number of grid collections */ - void writeHDF5(const char * const xmlFilePath); + int numGridCollectionGridCollections(); - /** - * Read xml file and make it the domain + /** + * Fills the provided character pointer with the value of the Domain's tag * - * @param xmlFilePath the path to the xml file to read. + * @param tag the pointer to the point where the string will be written + * @param tagLength the size of the array assigned at the tag pointer */ - void read(const char * const xmlFilePath); + void retrieveDomainTag(char * tag, int tagLength); + /** + * Returns the number of properties contained within the domain. + * + * @return the number of properties that the domain has. + */ + int retrieveDomainNumProperties(); -private: - - shared_ptr mDomain; - shared_ptr mGeometry; - shared_ptr mTime; - shared_ptr mTopology; + /** + * Fills the key and length from the property at the index specified. + * Since this refers to a map it is not completely reliable that the values will + * stay at the same indexes when new values are added. + * Using retrieve by key is more reliable. + * + * Throws an error if the index is out of bounds + * + * @param index The index of the property to fill from + * @param key The pointer to the location where the key will be written + * @param keyLength The size of the array assigned to the key pointer + * @param value The pointer to the location where the value will be written + * @param valueLength The size of the array assigned to the value pointer + */ + void retrieveDomainProperty(int index, char * key, int keyLength, char * value, int valueLength); - std::vector > mAttributes; - std::stack > mGridCollections; - std::vector > mInformations; + /** + * Searches the properties of the domain for one with the specified key. + * Stores the value found at a provided pointer. + * + * Throws an error if the key does not match any values + * + * @param key A pointer to the key being searched for + * @param value A pointer to the location where the value will be written + * @param valueLength The size of the Array assigned to the value pointer + */ + void retrieveDomainPropertyByKey(char * key, char * value, int valueLength); - std::vector > mPreviousAttributes; - std::vector > mPreviousGeometries; - std::vector > mPreviousInformations; - std::vector > mPreviousTopologies; + /** + * Makes the specified grid collection owned by the domain accessable + * by adding it to mGridCollections. + * Pushes the previous contents of mAttributes, mInformations, and mSets + * onto parentAttributes, parentInformations, and parentSets + * + * Returns an error if the index is out of bounds + * + * @param index the index of the grid collection in the domain that is to be opened + * @param openMaps set to 1 to open maps + * @param openAttributes set to 1 to open attributes + * @param openInformation set to 1 to open information + * @param openSets set to 1 to open sets + */ + void openDomainGridCollection(int index, int openMaps, int openAttributes, int openInformation, int openSets); + + /** + * Removes the specifed grid collection from mDomain's grid collections + * + * Throws an error if the index is out of bounds + * + * @param index The index of the grid collection to be removed + */ + void removeDomainGridCollection(int index); + + /** + * Makes the specified grid collection owned by the grid collection on top of mGridCollections + * accessable by adding it to mGridCollections. + * Pushes the previous contents of mAttributes, mInformations, and mSets + * onto parentAttributes, parentInformations, and parentSets + * + * Returns an error if the index is out of bounds + * + * @param index the index of the grid collection in the domain that is to be opened + * @param openMaps set to 1 to open maps + * @param openAttributes set to 1 to open attributes + * @param openInformation set to 1 to open information + * @param openSets set to 1 to open sets + */ + void openGridCollectionGridCollection(int index, int openMaps, int openAttributes, int openInformation, int openSets); + + /** + * Removes the specifed grid collection from the + * grid collections owned by the grid collection on top of mGridCollections + * + * Throws an error if the index is out of bounds + * + * @param index The index of the grid collection to be removed + */ + void removeGridCollectionGridCollection(int index); + + /** + * Fills the provided character pointer with the value of the name of the grid collection on top of mGridCollections + * + * @param name the pointer to the point where the string will be written + * @param nameLength the size of the array assigned at the name pointer + */ + void retrieveGridCollectionName(char * name, int nameLength); + + /** + * Fills the provided character pointer with the value of the tag of the grid collection on top of mGridCollections + * + * @param tag the pointer to the point where the string will be written + * @param tagLength the size of the array assigned at the tag pointer + */ + void retrieveGridCollectionTag(char * tag, int tagLength); + + /** + * Returns the number of properties contained within the grid collection on top of mGridCollections. + * + * @return the number of properties that the grid collection has. + */ + int retrieveGridCollectionNumProperties(); + + /** + * Fills the key and length from the property at the index specified. + * Since this refers to a map it is not completely reliable that the values will + * stay at the same indexes when new values are added. + * Using retrieve by key is more reliable. + * + * Throws an error if the index is out of bounds + * + * @param index The index of the property to fill from + * @param key The pointer to the location where the key will be written + * @param keyLength The size of the array assigned to the key pointer + * @param value The pointer to the location where the value will be written + * @param valueLength The size of the array assigned to the value pointer + */ + void retrieveGridCollectionProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Searches the properties of the Grid Collection on top of mGridCollections for one with the specified key. + * Stores the value found at a provided pointer. + * + * Throws an error if the key does not match any values + * + * @param key A pointer to the key being searched for + * @param value A pointer to the location where the value will be written + * @param valueLength The size of the Array assigned to the value pointer + */ + void retrieveGridCollectionPropertyByKey(char * key, char * value, int valueLength); + + /** + * Opens a grid of the specified type from the domain by + * placing its topography, geometry, time, etc.. + * into the appropriate containers + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + * @param openMaps set to 1 to open maps + * @param openAttributes set to 1 to open attributes + * @param openInformation set to 1 to open information + * @param openSets set to 1 to open sets + */ + void openDomainGrid(int gridType, int index, int openMaps, int openAttributes, int openInformation, int openSets); + + /** + * Removes a grid of the specified type from the domain + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + */ + void removeDomainGrid(int gridType, int index); + + /** + * Replaces a grid of the specified type from the domain by + * placing the appropriate data into the specified grid + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + * @param name a pointer to the name of the grid replacing the indicated grid + */ + void replaceDomainGrid(int gridType, int index, char * name); + + /** + * Retrieves the name of the specified grid and places it at the locaiton provided. + * + * Returns an error if the index is out of bounds + * + * @param gridType The of the specified grid represented as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param name The pointer to where the string will be written + * @param nameLength The size of the array assigned to the name pointer + */ + void retrieveDomainGridName(int gridType, int index, char * name, int nameLength); + + /** + * Retrieves the tag of the specified grid and places it at the location provided. + * + * Returns an error if the index is out of bounds + * + * @param gridType The of the specified grid represented as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param tag The pointer to the point where the string will be written + * @param tagLength The size of the array assigned at the tag pointer + */ + void retrieveDomainGridTag(int gridType, int index, char * tag, int tagLength); + + /** + * Retrieves the number of properties that the specified grid has. + * + * Returns an error if the index is out of bounds + * + * @param gridType The of the specified grid represented as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * + * @return The number of properties that thte grid has. + */ + int retrieveDomainGridNumProperties(int gridType, int index); + + /** + * Retrieves the key and value of the property at the specified index + * in the properties of the grid at the specified index. + * + * Since the properties are stored in a map the location of individual pairs are mutable. + * Use retrieve by key for more oonsistent results. + * + * Returns an error if the index is out of bounds + * + * @param gridType The of the specified grid represented as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param gridIndex The index of the specified grid + * @param index The index of the property to fill from + * @param key The pointer to the location where the key will be written + * @param keyLength The size of the array assigned to the key pointer + * @param value The pointer to the location where the value will be written + * @param valueLength The size of the array assigned to the value pointer + */ + void retrieveDomainGridProperty(int gridType, int gridIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Searches for the property that corresponds with the supplied key + * in the properties of the grid at the specified index. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param gridType The of the specified grid represented as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param key A pointer to the key being searched for + * @param value A pointer to the location where the value will be written + * @param valueLength The size of the Array assigned to the value pointer + */ + void retrieveDomainGridPropertyByKey(int gridType, int index, char * key, char * value, int valueLength); + + /** + * Opens a grid of the specified type from the grid collection + * on top of mGridCollections by placing its + * topography, geometry, time, etc.. into the appropriate + * containers + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + * @param openMaps set to 1 to open maps + * @param openAttributes set to 1 to open attributes + * @param openInformation set to 1 to open information + * @param openSets set to 1 to open sets + */ + void openGridCollectionGrid(int gridType, int index, int openMaps, int openAttributes, int openInformation, int openSets); + + /** + * Removes a grid of the specified type from the grid collection + * on top of mGridCollections + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + */ + void removeGridCollectionGrid(int gridType, int index); + + /** + * Replaces a grid of the specified type from the grid collection + * on top of mGridCollections by placing the appropriate data into it + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index the index of the grid to be opened + * @param name a pointer to the name of the grid to be replacing the specified one + */ + void replaceGridCollectionGrid(int gridType, int index, char * name); + + /** + * Retrieves the name of the specified grid and places it at the locaiton provided. + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param name The pointer to where the string will be written + * @param nameLength The size of the array assigned to the name pointer + */ + void retrieveGridCollectionGridName(int gridType, int index, char * name, int nameLength); + + /** + * Retrieves the tag of the specified grid and places it at the location provided. + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param tag The pointer to the point where the string will be written + * @param tagLength The size of the array assigned at the tag pointer + */ + void retrieveGridCollectionGridTag(int gridType, int index, char * tag, int tagLength); + + /** + * Retrieves the number of properties that the specified grid has. + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * + * @return The number of properties that thte grid has. + */ + int retrieveGridCollectionGridNumProperties(int gridType, int index); + + /** + * Retrieves the key and value of the property at the specified index + * in the properties of the grid at the specified index. + * + * Since the properties are stored in a map the location of individual pairs are mutable. + * Use retrieve by key for more oonsistent results. + * + * Returns an error if the index is out of bounds + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param GridIndex The index of the specified grid + * @param index The index of the property to fill from + * @param key The pointer to the location where the key will be written + * @param keyLength The size of the array assigned to the key pointer + * @param value The pointer to the location where the value will be written + * @param valueLength The size of the array assigned to the value pointer + */ + void retrieveGridCollectionGridProperty(int gridType, int gridIndex, int index, + char * key, int keyLength, char * value, int valueLength); + + /** + * Searches for the property that corresponds with the supplied key + * in the properties of the grid at the specified index. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param gridType the type of the grid expressed as an integer, Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * @param index The index of the specified grid + * @param key A pointer to the key being searched for + * @param value A pointer to the location where the value will be written + * @param valueLength The size of the Array assigned to the value pointer + */ + void retrieveGridCollectionGridPropertyByKey(int gridType, int index, char * key, char * value, int valueLength); + + /** + * Returns the number of grids of a specified type that the domain contains + * + * @param gridType The specified type of grid as an integer. Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * + * @return The number of grids + */ + int numDomainGrids(int gridType); + + /** + * Returns the number of grids of a specified type that + * the top grid collection in mGridCollections contains + * + * Returns an error if there are no grid collections in mGridCollections + * + * @param gridType The specified type of grid as an integer. Ex: XDMF_GRID_TYPE_UNSTRUCTURED + * + * @return The number of grids + */ + int numGridCollectionGrids(int gridType); + + /** + * Returns the type of the grid collection on top of the mGridCollections stack + * + * @return the grid collection's type, EX: XDMF_GRID_COLLECTION_TYPE_TEMPORAL + */ + int retrieveGridCollectionType(); + + /** + * Returns the time stored in mTime + * + * @return the value of mTime as a float + */ + float retrieveTime(); + + /** + * Retrieves the Geometry's tag and stores it into the provided pointer + * + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveGeometryTag(char * tag, int tagLength); + + /** + * Returns the geometry's type as an integer. + * + * Returns an error if it doesn't recognize the type or if the geometry isn't set + * + * @return the geometry's type, EX: XDMF_GEOMETRY_TYPE_XY + */ + int retrieveGeometryType(); + + /** + * Returns the geometry's datatype as an integer. + * + * Returns an error if it doesn't recognize the type or if the geometry isn't set + * + * @return the geometry's type, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveGeometryValueType(); + + /** + * Returns a pointer to the array of values contained in the geometry + * + * Returns an error if the geometry is not set + * + * @param values a void pointer to the array to recieve the geometry's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveGeometryValues(void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * returns the number of points contained within the geometry + * + * @return the number of points + */ + int retrieveGeometryNumPoints(); + + /** + * returns the size of the geometry + * + * @return the size + */ + int retrieveGeometrySize(); + + /** + * Clears mPreviousGeometries. Use to reduce memory load. + */ + void clearPreviousGeometries(); + + /** + * Returns the number of properties currently stored in the geometry. + * + * @return the number of properties associated with the geometry + */ + int retrieveGeometryNumProperties(); + + /** + * Retrieves the key and value of the property at the specifed index of the Geometry + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveGeometryProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the geometry when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveGeometryPropertyByKey(char * key, char * value, int valueLength); + + /** + * Retrieves the topology's tag and stores it into the provided pointer + * + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveTopologyTag(char * tag, int tagLength); + + /** + * Returns the topology's type as an integer. + * + * Returns an error if it doesn't recognize the type or if the topology isn't set + * + * @return the topology's type, EX: XDMF_TOPOLOGY_TYPE_POLYVERTEX + */ + int retrieveTopologyType(); + + /** + * Returns the topology's datatype as an integer. + * + * Returns an error if it doesn't recognize the type or if the topology isn't set + * + * @return the topology's type, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveTopologyValueType(); + + /** + * Returns a pointer to the array of values contained in the topology + * + * Returns an error if the topology is not set + * + * @param values a void pointer to the array to recieve the topology's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveTopologyValues(void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * returns the number of elements contained within the topology + * + * @return the number of elements + */ + int retrieveTopologyNumElements(); + + /** + * returns the size of the topology + * + * @return the size + */ + int retrieveTopologySize(); + /** + * Clears mPreviousTopologies. Use to reduce memory load. + */ + void clearPreviousTopologies(); + + /** + * Returns the number of properties currently stored in the topology. + * + * @return the number of properties associated with the topology + */ + int retrieveTopologyNumProperties(); + + /** + * Retrieves the key and value of the property at the specifed index of the Topology + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveTopologyProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the topology when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveTopologyPropertyByKey(char * key, char * value, int valueLength); + + /** + * Set the dimensions that will be added to the next grid. + * + * @param numValues number of point values to copy. + * @param arrayType type of point values. + * @param pointValues array of point values. + * + * @return int providing id to fortran if reusing. + */ + int setDimensions(int numValues, const int arrayType, void * pointValues); + + /** + * Replaces mDimensions with the specified dimensions from mPreviousDimensions + * + * Returns an error if the index is out of range + * + * @param index The index of the specified dimension + */ + void openPreviousDimensions(int index); + + /** + * Clears mPreviousDimensions. Use to reduce memory load. + */ + void clearPreviousDimensions(); + + /** + * Retrieves the dimensions' tag and stores it into the provided pointer + * + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveDimensionsTag(char * tag, int tagLength); + + /** + * Returns the dimensions' datatype as an integer. + * + * Returns an error if it doesn't recognize the type or if the dimension isn't set + * + * @return the dimensions' type, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveDimensionsValueType(); + + /** + * Returns a pointer to the array of values contained in the dimensions + * + * Returns an error if the dimensions are not set + * + * @param values a void pointer to the array to recieve the geometry's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveDimensionsValues(void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * returns the size of the dimensions + * + * @return the size + */ + int retrieveDimensionsSize(); + + /** + * Returns the number of properties currently stored in the dimensions. + * + * @return the number of properties associated with the dimensions + */ + int retrieveDimensionsNumProperties(); + + /** + * Retrieves the key and value of the property at the specifed index of the dimensions + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveDimensionsProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the dimensions when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveDimensionsPropertyByKey(char * key, char * value, int valueLength); + + /** + * Set the origin that will be added to the next grid. + * + * @param numValues number of point values to copy. + * @param arrayType type of point values. + * @param pointValues array of point values. + * + * @return int providing id to fortran if reusing. + */ + int setOrigin(int numValues, const int arrayType, void * pointValues); + + /** + * Sets mOrigin to a specified origin in mPreviousOrigins + * + * @param index The index of the specified origin + */ + void setPreviousOrigin(int index); + + /** + * Clears mPreviousOrigins. Use to reduce memory load. + */ + void clearPreviousOrigins(); + + /** + * Retrieves the origin's tag and stores it into the provided pointer + * + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveOriginTag(char * tag, int tagLength); + + /** + * Returns the origin's datatype as an integer. + * + * Returns an error if it doesn't recognize the type or if the origin isn't set + * + * @return the origin's type, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveOriginValueType(); + + /** + * Returns a pointer to the array of values contained in the origin + * + * Returns an error if the origin is not set + * + * @param values a void pointer to the array to recieve the geometry's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveOriginValues(void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * returns the size of the origin + * + * @return the size + */ + int retrieveOriginSize(); + + /** + * Returns the number of properties currently stored in the origin. + * + * @return the number of properties associated with the origin + */ + int retrieveOriginNumProperties(); + + /** + * Retrieves the key and value of the property at the specifed index of the origin + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveOriginProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the origin when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveOriginPropertyByKey(char * key, char * value, int valueLength); + + /** + * Set the brick size that will be added to the next grid. + * + * @param numValues number of point values to copy. + * @param arrayType type of point values. + * @param pointValues array of point values. + * + * @return int providing id to fortran if reusing. + */ + int setBrick(int numValues, const int arrayType, void * pointValues); + + /** + * Sets the brick size to a specified brick size stored in mPreviousBricks + * + * @param index The index of the specifed brick size + */ + void setPreviousBrick(int index); + + /** + * Clears mPreviousBricks. Use to reduce memory load. + */ + void clearPreviousBricks(); + + /** + * Retrieves the Geometry's tag and stores it into the provided pointer + * + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveBrickTag(char * tag, int tagLength); + + /** + * Returns the brick's datatype as an integer. + * + * Returns an error if it doesn't recognize the type or if the brick isn't set + * + * @return the brick's type, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveBrickValueType(); + + /** + * Returns a pointer to the array of values contained in the brick + * + * Returns an error if the brick is not set + * + * @param values a void pointer to the array to recieve the brick's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveBrickValues(void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * returns the size of the brick size + * + * @return the size + */ + int retrieveBrickSize(); + + /** + * Returns the number of properties currently stored in the brick size. + * + * @return the number of properties associated with the brick + */ + int retrieveBrickNumProperties(); + + /** + * Retrieves the key and value of the property at the specifed index of the brick size + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveBrickProperty(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the brick size when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveBrickPropertyByKey(char * key, char * value, int valueLength); + + /** + * Pushes a blank map onto mMaps. + * + * @param name A pointer to the name of the map to be added + */ + void addMap(char * name); + + /** + * Returns the number of maps stored in mMaps + * + * @return The number of maps + */ + int retrieveNumMaps(); + + /** + * Retrieves the specified map's tag and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the map whose tag is being retrieved + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveMapTag(int index, char * tag, int tagLength); + + /** + * Adds id dependancies to the specified map in mMaps + * + * @param index The index of the map for the data to be added to + * @param localNodeID The ID of the local node + * @param remoteTaskID The task ID to be associated with the local node + * @param remoteLocalNodeID The remote local node to be associated with the local node and task id + */ + void addRemoteNodeID(int index, int localNodeID, int remoteTaskID, int remoteLocalNodeID); + + /** + * Gets the remote local ids associated with the provided local node and task from a specified map in mMaps + * + * @param index The index of the map which the data is to be retrieved from + * @param localNodeID The ID of the local node whose remote local node is to be found + * @param remoteTaskID The ID of the task whose remote local node is to be found + * @param remoteNodeID A pointer to the location where the remote local IDs will be returned to + */ + void retrieveRemoteNodeIDs(int index, int localNodeID, int remoteTaskID, int * remoteNodeIDs); + + /** + * Gets the number of remote local ids associated with the provided local node and task from a specified map in mMaps + * + * @param index The index of the map which the data is to be retrieved from + * @param localNodeID The ID of the local node whose number of associated remote local nodes is to be found + * @param remoteTaskID The ID of the task whose number of associated remote local nodes is to be found + * + * @return The number of remote node ids associated with the supplied IDs + */ + int retrieveNumRemoteNodeIDs(int index, int localNodeID, int remoteTaskID); + + /** + * Clears mMaps of all added maps. + */ + void clearMaps(); + + /** + * Removes the specified map from mMaps. + * + * @param index The index of the map to be removed. + */ + void removeMap(int index); + + /** + * Stores specified mMap in mPreviousMaps. + * + * Gives an error if the index is out of bounds + * + * @param index The index of the specified map in mMaps + * + * @return The id of the corresponding map in mPreviousMaps + */ + int storeMap(int index); + + /** + * Replaces the current mMap with one specified from mPreviousMaps. + * + * Gives an error if the index is out of range. + * + * @param index The index of the specified map + */ + void addPreviousMap(int index); + + /** + * Clears mPreviousMaps. Use to reduce memory load. + */ + void clearPreviousMaps(); + + /** + * Returns the number of properties currently stored in the specified map in mMaps. + * + * @param index The index of the specified map + * + * @return the number of properties associated with the map + */ + int retrieveMapNumProperties(int index); + + /** + * Retrieves the key and value of the property at the specifed index of the specified map in mMaps + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param mapIndex The index of the specified map + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveMapProperty(int mapIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of the specified map when given its key. + * + * Returns an error if the key has no matching value + * + * @param index The index of the specified map + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveMapPropertyByKey(int index, char * key, char * value, int valueLength); + + /** + * Returns the number of attributes currently loaded. + * + * @return the number of attributes in mAttributes + */ + int retrieveNumAttributes(); + + /** + * Removes the attribute at the supplied index from mAttributes + * + * Returns an error if the index is out of bounds + * + * @param index The index of the Attribute to be removed + */ + void removeAttribute(int index); + + /** + * Replaces the specified attribute in mAttributes with one made using the supplied components + * + * Returns an error if the index is out of bounds + * + * @param index The index of the Attribute to be replaced + * @param name A pointer to the name of the new attribute + * @param attributeCenter An integer representation of the center of the new attribute Ex:XDMF_ATTRIBUTE_CENTER_NODE + * @param attributeType An integer representation of the type of the new attribute Ex:XDMF_ATTRIBUTE_TYPE_SCALAR + * @param numValues The number of values contained at the array located at the supplied void pointer + * @param arrayType An integer representation of the type of data contained within the array Ex:XDMF_ARRAY_TYPE_INT32 + * @param values A pointer to the location of the values that will be used to fill the new attribute + */ + void replaceAttribute(int index, char * name, int attributeCenter, int attributeType, int numValues, int arrayType, void * values); + + /** + * Opens the specified attribute by placing the information it contains in mInformations + * + * @param index The index of the specified information + */ + void openAttribute(int index); + + /** + * Retrieves the specified Attribute's tag and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the attribute whose tag is being retrieved + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveAttributeTag(int index, char * tag, int tagLength); + + /** + * Retrieves the specified Attribute's name and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the attribute whose name is being retrieved + * @param name The location where the name will be stored + * @param nameLength The size fo the array at the provided pointer + */ + void retrieveAttributeName(int index, char * name, int nameLength); + + /** + * Clears mAttributes of all added attributes + */ + void clearAttributes(); + + /** + * Returns a pointer the values of a specified attribute + * + * Returns an error if the index is out of bounds + * + * @param index the index that the specified Attribute exists at + * @param values a void pointer to the array to recieve the attribute's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the attribute's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveAttributeValues(int index, void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * Returns the datatype of the specified attribute as an integer. + * + * Returns an error if the index is out of bounds + * + * @param index the index to the attribute + * + * @return the type of the specified attribute as an integer, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveAttributeValueType(int index); + + /** + * Returns the number of values in the specified Attribute + * + * Returns an error if the index is out of bounds + * + * @param index the index to the attribute + * + * @return the number of values contained in the specified attribute + */ + int retrieveAttributeSize(int index); + + /** + * Returns the type of the specified attribute as an integer. + * + * Returns an error if the index is out of bounds + * + * @param index the index to the attribute + * + * @return the type of the specified attribute as an integer, EX: XDMF_ATTRIBUTE_TYPE_SCALAR + */ + int retrieveAttributeType(int index); + + /** + * Returns the center of the specified attribute as an integer. + * + * Returns an error if the index is out of bounds + * + * @param index the index to the attribute + * + * @return the center of the specified attribute as an integer, EX: XDMF_ATTRIBUTE_CENTER_NODE + */ + int retrieveAttributeCenter(int index); + + /** + * Clears mPreviousAttributes. Use to reduce memory load. + */ + void clearPreviousAttributes(); + + /** + * Returns the number of properties currently stored in the specified attribute. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the attribute whose number of properties is being retrieved + * + * @return the number of properties associated with the specified attribute + */ + int retrieveAttributeNumProperties(int index); + + /** + * Retrieves the key and value of the property at the specifed index of the specified attribute + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param attributeIndex The index of the attribute that is being retrieved + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveAttributeProperty(int attributeIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of a specified attribute when given its key. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param index The index of the attribute whose property is being retrieved + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength The size of the value variable + */ + void retrieveAttributePropertyByKey(int index, char * key, char * value, int valueLength); + + /** + * Returns the number of coordinates currently loaded. + * + * @return the number of coordinates in mCoordinates + */ + int retrieveNumCoordinates(); + + /** + * Removes the coordinate at the supplied index from mCoordinates + * + * Returns an error if the index is out of bounds + * + * @param index The index of the Coordinate to be removed + */ + void removeCoordinate(int index); + + /** + * Add an coordinate that will be inserted into the next grid or grid + * collection. + * + * @param name of the coordinate. + * @param numValues number of coordinate values to copy. + * @param arrayType type of coordinate values. + * @param values array of coordinate values. + * + * @return int providing id to fortran if reusing. + */ + int addCoordinate(char * name, int numValues, int arrayType, void * values); + + /** + * Adds a specified coordinate from mPreviousCoordinates to mCoordinates + * + * @param index The index of the specified coordinate + */ + void addPreviousCoordinate(int index); + + /** + * Clears mPreviousCoordinates. Use to reduce memory load. + */ + void clearPreviousCoordinates(); + + /** + * Replaces the specified coordinate in mCoordinates with one made using the supplied components + * + * Returns an error if the index is out of bounds + * + * @param index The index of the coordinate to be replaced + * @param name A pointer to the name of the new coordinate + * @param numValues The number of values contained at the array located at the supplied void pointer + * @param arrayType An integer representation of the type of data contained within the array Ex:XDMF_ARRAY_TYPE_INT32 + * @param values A pointer to the location of the values that will be used to fill the new coordinate + */ + void replaceCoordinate(int index, char * name, int numValues, int arrayType, void * values); + + /** + * Retrieves the specified Coordinate's tag and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the coordinate whose tag is being retrieved + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveCoordinateTag(int index, char * tag, int tagLength); + + /** + * Retrieves the specified Coordinate's name and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the coordinate whose name is being retrieved + * @param name The location where the name will be stored + * @param nameLength The size fo the array at the provided pointer + */ + void retrieveCoordinateName(int index, char * name, int nameLength); + + /** + * Returns a pointer the values of a specified coordinate + * + * Returns an error if the index is out of bounds + * + * @param index the index that the specified coordinate exists at + * @param values a void pointer to the array to recieve the coordinate's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the coordinate's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveCoordinateValues(int index, void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * Returns the datatype of the specified coordinate as an integer. + * + * Returns an error if the index is out of bounds + * + * @param index the index to the coordinate + * + * @return the type of the specified coordinate as an integer, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveCoordinateValueType(int index); + + /** + * Returns the number of values in the specified coordinate + * + * Returns an error if the index is out of bounds + * + * @param index the index to the coordinate + * + * @return the number of values contained in the specified coordinate + */ + int retrieveCoordinateSize(int index); + + /** + * Clears mCoordinates of all added coordiantes. + */ + void clearCoordinates(); + + /** + * Returns the number of properties currently stored in the specified coordinate. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the coordinate whose number of properties is being retrieved + * + * @return the number of properties associated with the specified coordinate + */ + int retrieveCoordinateNumProperties(int index); + + /** + * Retrieves the key and value of the property at the specifed index of the specified coordinate + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param coordinateIndex The index of the coordinate that is being retrieved + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveCoordinateProperty(int coordinateIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of a specified coordinate when given its key. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param index The index of the coordinate whose property is being retrieved + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength The size of the value variable + */ + void retrieveCoordinatePropertyByKey(int index, char * key, char * value, int valueLength); + + /** + * Retrieves the specified set's tag and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the set whose tag is being retrieved + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveSetTag(int index, char * tag, int tagLength); + + /** + * Retrieves the specified set's name and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the set whose name is being retrieved + * @param name The location where the name will be stored + * @param nameLength The size fo the array at the provided pointer + */ + void retrieveSetName(int index, char * name, int nameLength); + + /** + * Retrievest the type of the specified set + * + * Returns an error if the index is out of bounds + * + * @param index The index of the specified set + * + * @return The set's type as an integer Ex. XDMF_SET_TYPE_NODE + */ + int retrieveSetType(int index); + + /** + * Adds a set to mSets that contains the current contents to mInformations and mAttributes. + * Then the top of parentAttributes and parentInformations + * are placed in mAttributes and mInformations + * + * @param name A pointer to the location of the name for the set + * @param newSetType The integer equivalent to the set type of the added set Ex: XDMF_SET_TYPE_NODE + * @param values A pointer to the location where the values to be placed in the set will are stored + * @param numValues The amount of values in the array at the provided pointer + * @param arrayType The integer representation of the datatype of the values Ex: XDMF_ARRAY_TYPE_INT32 + * + * @return An ID that can be used to recall the set from mPreviousSets + */ + int addSet(char * name, int newSetType, void * values, int numValues, int arrayType); + + /** + * Adds the specifed set from mPreviousSets into mSets. + * + * @param index The index of the set in mPreviousSets to be added + */ + void addPreviousSet(int index); + + /** + * Clears mPreviousSets. Use to reduce memory load. + */ + void clearPreviousSets(); + + /** + * Clears mSets of all added Sets + */ + void clearSets(); + + /** + * Returns the number of sets in mSets + * + * @return The number of sets + */ + int retrieveNumSets(); + + /** + * Returns the number of values in the specified set + * + * Returns an error if the index is out of bounds + * + * @param index the index to the set + * + * @return the number of values contained in the specified set + */ + int retrieveSetSize(int index); + + /** + * Returns a pointer the values of a specified set + * + * Returns an error if the index is out of bounds + * + * @param index the index that the specified set exists at + * @param values a void pointer to the array to recieve the set's values + * @param dataType an integer corresponding to the datatype that the data will be stored in + * @param numberRead the number of values read into the values array + * @param startIndex the place to start reading from the set's array + * @param arrayStride the distance between values read (1 reads all values, 2 reads every other, ect..) + * @param valueStride the distance between the places that the read values are placed in the supplied array + */ + void retrieveSetValues(int index, void * values, int dataType, + int numberRead, int startIndex, int arrayStride, int valueStride); + + /** + * Returns the datatype of the specified set as an integer. + * + * Returns an error if the index is out of bounds + * + * @param index the index of the Set + * + * @return the type of the specified Set's values as an integer, EX: XDMF_ARRAY_TYPE_INT8 + */ + int retrieveSetValueType(int index); + + /** + * Opens the set at the specified index by placing its attributes and information + * in mAttributes and mInformations. Pushes the previous contents of those two containers + * into parentAttributes and parentInformations. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the specified set + * @param openAttributes set to 1 to open attributes + * @param openInformation set to 1 to open information + */ + void openSet(int index, int openAttributes, int openInformation); + + /** + * Removes the specified set from mSets. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the set to be removed + */ + void removeSet(int index); + + /** + * Replaces a specified set in mSets with a set that contains + * the current contents to mInformations and mAttributes. + * Then the top of parentAttributes and parentInformations + * are placed in mAttributes and mInformations + * + * Returns an error if the index is out of bounds + * + * @param index The index of the set to be replaced + * @param name A pointer to the location of the name for the set + * @param newSetType The integer equivalent to the set type of the added set Ex: XDMF_SET_TYPE_NODE + * @param values A pointer to the location where the values to be placed in the set will are stored + * @param numValues The amount of values in the array at the provided pointer + * @param arrayType The integer representation of the datatype of the values Ex: XDMF_ARRAY_TYPE_INT32 + */ + void replaceSet(int index, char * name, int newSetType, void * values, int numValues, int arrayType); + + /** + * Returns the number of properties currently stored in the specified set. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the set whose number of properties is being retrieved + * + * @return the number of properties associated with the specified set + */ + int retrieveSetNumProperties(int index); + + /** + * Retrieves the key and value of the property at the specifed index of the specified set + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param setIndex The index of the set that is being retrieved + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveSetProperty(int setIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of a specified set when given its key. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param index The index of the set whose property is being retrieved + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveSetPropertyByKey(int index, char * key, char * value, int valueLength); + + /** + * Returns the number of information currently stored in mInformations. + * + * @return the number of information contained within mInformations + */ + int retrieveNumInformation(); + + /** + * Retrieves the specified information's tag and stores it into the provided pointer + * + * Returns an error if the index is out of bounds + * + * @param index The index of the information whose tag is being retrieved + * @param tag The location where the tag will be stored + * @param tagLength The size fo the array at the provided pointer + */ + void retrieveInformationTag(int index, char * tag, int tagLength); + + /** + * Retrieves the key and value of the Information at the specifed index + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the information will be stored + * @param valueLength the size of the value variable + */ + void retrieveInformation(int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Removes the information at the specified index. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the information to be removed + */ + void removeInformation(int index); + + /** + * Replaces the key and value of the information at the specified index + * + * Returns an error if the index is out of bounds + * + * @param index The index of the information to be changed + * @param key A pointer to the new key + * @param value A pointer to the new value + */ + void replaceInformation(int index, char * key, char * value); + + /** + * Opens the specified information by placing the information it contains in mInformations + * + * @param index The index of the information to be opened + */ + void openInformation(int index); + + /** + * Retrieves the value of a specified information when given its key. + * + * Returns an error if the key has no matching value + * + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the information will be stored + * @param valueLength the size of the value variable + */ + void retrieveInformationByKey(char * key, char * value, int valueLength); + + /** + * Removes the information with the specified key + * + * Returns an error if the key does not match an information + * + * @param key A pointer to the value of the key being searched for + */ + void removeInformationByKey(char * key); + + /** + * Replaces the value of the information with the specified key + * + * Returns an error if the key does not match a value + * + * @param key A pointer to the value of the key being searched for + * @param value A pointer to the value that will be placed into the information + */ + void replaceInformationByKey(char * key, char * value); + + /** + * Clears mPreviousInformations. Use to reduce memory load. + */ + void clearPreviousInformation(); + + /** + * Clears mInformations of all added information. + */ + void clearInformations(); + + /** + * Returns the number of properties currently stored in the specified information. + * + * Returns an error if the index is out of bounds + * + * @param index The index of the information whose number of properties is being retrieved + * + * @return the number of properties associated with the specified information + */ + int retrieveInformationNumProperties(int index); + + /** + * Retrieves the key and value of the property at the specifed index of the specified information + * and modifies the values at the provided pointers + * + * Returns an error if the index is out of bounds + * + * @param informationIndex The index of the information that is being retrieved + * @param index The index of the property that is being retrieved + * @param key A pointer to the location where the key value will be stored + * @param keyLength the size of the key variable + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveInformationProperty(int informationIndex, int index, char * key, int keyLength, char * value, int valueLength); + + /** + * Retrieves the value of a property of a specified information when given its key. + * + * Returns an error if the index is out of bounds + * Returns an error if the key has no matching value + * + * @param index The index of the information whose property is being retrieved + * @param key A pointer to the value of the key that is being searched for + * @param value A pointer to the location where the value of the property will be stored + * @param valueLength the size of the value variable + */ + void retrieveInformationPropertyByKey(int index, char * key, char * value, int valueLength); + + /** + * clears all of the mPrevious vectors. Used to reduce memory load. + */ + void clearPrevious(); + + + + + + + + /** + * Write constructed file to disk. + * + * @param xmlFilePath the path to the xml file to write to. + */ + void write(const char * const xmlFilePath); + + /** + * Write HDF5 heavy data to disk and release + * + * @param xmlFilePath the path to the xml file to write to. + */ + void writeHDF5(const char * const xmlFilePath); + + /** + * Read xml file and make it the domain. Replaces current domain. + * + * @param xmlFilePath the path to the xml file to read. + */ + void read(const char * const xmlFilePath); + + +private: + + shared_ptr mDomain; + shared_ptr mGeometry; + shared_ptr mTime; + shared_ptr mTopology; + shared_ptr mDimensions; + shared_ptr mOrigin; + shared_ptr mBrick; + + std::vector > mAttributes; + std::vector > mCoordinates; + std::stack > mGridCollections; + std::vector > mInformations; + std::vector > mSets; + std::vector > mMaps; + + std::vector > mPreviousAttributes; + std::vector > mPreviousGeometries; + std::vector > mPreviousInformations; + std::vector > mPreviousSets; + std::vector > mPreviousTopologies; + std::vector > mPreviousDimensions; + std::vector > mPreviousOrigins; + std::vector > mPreviousBricks; + std::vector > mPreviousCoordinates; + std::vector > mPreviousMaps; }; diff --git a/utils/XdmfPartitioner.hpp b/utils/XdmfPartitioner.hpp index bd656dc511ca84d2ff50adda89106c99f738736c..fcb80967222c9110fdfba4836f649ff112153276 100644 --- a/utils/XdmfPartitioner.hpp +++ b/utils/XdmfPartitioner.hpp @@ -80,7 +80,6 @@ public: * * @param gridToPartition an XdmfGridUnstructured to partition. * @param numberOfPartitions the number of pieces to partition the grid into. - * @param metisScheme which metis partitioning scheme to use. * @param heavyDataWriter an XdmfHDF5Writer to write the partitioned mesh to. * If no heavyDataWriter is specified, all partitioned data will remain in * memory. diff --git a/utils/tests/Fortran/EditTestXdmfFortran.f90 b/utils/tests/Fortran/EditTestXdmfFortran.f90 new file mode 100644 index 0000000000000000000000000000000000000000..f25c3fbfc40c7546d8de6545cadaf70c9c25d9b3 --- /dev/null +++ b/utils/tests/Fortran/EditTestXdmfFortran.f90 @@ -0,0 +1,333 @@ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! +!! AUTHOR: Andrew Burns (andrew.j.burns2@us.army.mil) +!! +!! Read the first hexahedron from the file generated by the +!! OutputTestXdmfFortran program, then print the results for comparison. +!! +!! Link against the XdmfUtils library to compile. +!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +PROGRAM XdmfFortranExample + + IMPLICIT NONE + INCLUDE 'Xdmf.f' + + INTEGER*8 obj + character*256 infilename, outfilename, itemName, itemKey, itemValue, itemTag + REAL*4 myPointsOutput(36) + INTEGER myConnectionsOutput(16) + INTEGER myMappedNodes(3), myDimensions(3) + REAL*8 myCellAttributeOutput(4), myNodeAttributeOutput(12), mySetOutput(12), myTestTime, myBrick(3), myOrigin(3) + INTEGER numContained, typeHolder + + + infilename = 'my_output.xmf'//CHAR(0) + + outfilename = 'edited_output.xmf'//CHAR(0) + + CALL XDMFINIT(obj) + CALL XDMFREAD(obj, infilename) + + PRINT *, 'Load From: ', TRIM(infilename) + PRINT *, 'Domain Properties' + CALL XDMFRETRIEVEDOMAINNUMPROPERTIES(obj, numContained) + PRINT *, 'number of Properties: ', numContained + CALL XDMFRETRIEVEDOMAINTAG(obj, itemTag, 256) + PRINT *, 'Domain Tag: ', itemTag + CALL XDMFRETRIEVENUMDOMAINGRIDCOLLECTIONS(obj, numContained) + PRINT *, 'Number of Grid Collections: ', numContained + CALL XDMFOPENDOMAINGRIDCOLLECTION(obj, 0, 1, 1, 1, 1) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEGRIDCOLLECTIONNUMGRIDS(obj, XDMF_GRID_TYPE_UNSTRUCTURED, numContained) + PRINT *, 'Number of Grids contained in the Grid Collection: ', numContained + CALL XDMFOPENGRIDCOLLECTIONGRID(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 1, 1, 1, 1) + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDNAME(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemName, 256) + PRINT *, "Grid Name: ", itemName + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDTAG(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemTag, 256) + PRINT *, "Grid Tag: ", itemTag + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDNUMPROPERTIES(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, numContained) + PRINT *, "Number of Properties: ", numContained + PRINT *, "Grid Properties: " + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDPROPERTY(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDPROPERTYBYKEY(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETIME(obj, myTestTime) + PRINT *, 'Grid Time: ', myTestTime + CALL XDMFRETRIEVEGRIDCOLLECTIONTYPE(obj, typeHolder) + PRINT *, 'Grid Collection Type: ', typeHolder + CALL XDMFRETRIEVENUMATTRIBUTES(obj, numContained) + PRINT *, 'Number of Grid Attributes: ', numContained + PRINT *, 'Map' + CALL XDMFRETRIEVEMAPNUMPROPERTIES(obj, 0, numContained) + PRINT *, 'Number of Properties: ', numContained + CALL XDMFRETRIEVEMAPPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEMAPPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEREMOTENODEIDS(obj, 0, 3, 1, myMappedNodes) + PRINT *, 'Nodes: ', myMappedNodes +!!!! Unstructured and Curvilinear only + PRINT *, 'Geometry' + CALL XDMFRETRIEVEGEOMETRYNUMPROPERTIES(obj, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEGEOMETRYPROPERTY(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGEOMETRYPROPERTYBYKEY(obj, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGEOMETRYTAG(obj, itemTag, 256) + PRINT *, 'Geometry Tag: ', itemTag + CALL XDMFRETRIEVEGEOMETRYTYPE(obj, typeHolder) + PRINT *, 'Geometry Type: ', typeHolder + CALL XDMFRETRIEVEGEOMETRYVALUETYPE(obj, typeHolder) + PRINT *, 'Geometry Value Type: ', typeHolder + CALL XDMFRETRIEVEGEOMETRYSIZE(obj, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEGEOMETRYNUMPOINTS(obj, numContained) + PRINT *, 'Geometry Number of Points: ', numContained + CALL XDMFRETRIEVEGEOMETRYVALUES(obj, myPointsOutput, XDMF_ARRAY_TYPE_FLOAT32, 36, 0, 1, 1) + PRINT 1, myPointsOutput +1 FORMAT (' ', 3F5.1, '\n ', 3F5.1, '\n ', 3F5.1, '\n') +!!!! / Unstructured and Curvilinear Grid only +!!!! Unstructured Grid only + PRINT *, 'Topology' + CALL XDMFRETRIEVETOPOLOGYNUMPROPERTIES(obj, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVETOPOLOGYPROPERTY(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETOPOLOGYPROPERTYBYKEY(obj, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETOPOLOGYTAG(obj, itemTag, 256) + PRINT *, 'Topology Tag: ', itemTag + CALL XDMFRETRIEVETOPOLOGYTYPE(obj, typeHolder) + PRINT *, 'Topology Type: ', typeHolder + CALL XDMFRETRIEVETOPOLOGYVALUETYPE(obj, typeHolder) + PRINT *, 'Topology Value Type: ', typeHolder + CALL XDMFRETRIEVETOPOLOGYSIZE(obj, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVETOPOLOGYNUMELEMENTS(obj, numContained) + PRINT *, 'Topology Number of elements: ', numContained + CALL XDMFRETRIEVETOPOLOGYVALUES(obj, myConnectionsOutput, XDMF_ARRAY_TYPE_INT32, 16, 0, 1, 1) + PRINT 2, myConnectionsOutput +2 FORMAT (' ', 8I3) +!!!! /Unstructured Grid Only +!!!! Curvilinear and Regular only +!! PRINT *, 'Dimensions' +!! CALL XDMFRETRIEVEDIMENSIONSNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEDIMENSIONSPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEDIMENSIONSPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEDIMENSIONSTAG(obj, itemTag, 256) +!! PRINT *, "Dimension Tag: ", itemTag +!! CALL XDMFRETRIEVEDIMENSIONSVALUETYPE(obj, typeHolder) +!! PRINT *, "Dimension Value Type: ", typeHolder +!! CALL XDMFRETRIEVEDIMENSIONSSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEDIMENSIONSVALUES(obj, myDimensions, XDMF_ARRAY_TYPE_INT32, 3, 0, 1, 1) +!! PRINT *, myDimensions +!!!! /Curvilinear and Regular only +!!!! Rectilinear Only +!! PRINT *, 'Coordinates' +!! CALL XDMFRETRIEVENUMCOORDINATES(obj, numContained) +!! PRINT *, 'Number of Coordinates: ', numContained +!! CALL XDMFRETRIEVECOORDINATEVALUETYPE(obj, 0, typeHolder) +!! PRINT *, 'Coordinate Value Type', typeHolder +!! CALL XDMFRETRIEVECOORDINATENUMPROPERTIES(obj, 0, numContained) +!! PRINT *, 'Number of Properties', numContained +!! CALL XDMFRETRIEVECOORDINATEPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) +!! PRINT *, 'Key: ', itemKey +!! PRINT *, 'Value: ', itemValue +!! CALL XDMFRETRIEVECOORDINATEPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) +!! PRINT *, 'Value: ', itemValue +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 0, numContained) +!! PRINT *, 'Size of Coordinate 0', numContained +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 1, numContained) +!! PRINT *, 'Size of Coordinate 1', numContained +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 2, numContained) +!! PRINT *, 'Size of Coordinate 2', numContained +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(1), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(13), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(25), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! PRINT 1, myPointsOutput +!!!! /Rectilinear Only +!!!! Regular Grid Only +!! Brick and Origin +!! PRINT *, 'Brick' +!! CALL XDMFRETRIEVEBRICKNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEBRICKPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEBRICKPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEBRICKTAG(obj, itemTag, 256) +!! PRINT *, "Brick Tag: ", itemTag +!! CALL XDMFRETRIEVEBRICKVALUETYPE(obj, typeHolder) +!! PRINT *, "Brick Value Type: ", typeHolder +!! CALL XDMFRETRIEVEBRICKSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEBRICKVALUES(obj, myBrick, XDMF_ARRAY_TYPE_FLOAT64, 3, 0, 1, 1) +!! PRINT *, myBrick +!! PRINT *, 'Origin' +!! CALL XDMFRETRIEVEORIGINNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEORIGINPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEORIGINPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEORIGINTAG(obj, itemTag, 256) +!! PRINT *, "Origin Tag: ", itemTag +!! CALL XDMFRETRIEVEORIGINVALUETYPE(obj, typeHolder) +!! PRINT *, "Origin Value Type: ", typeHolder +!! CALL XDMFRETRIEVEORIGINSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEORIGINVALUES(obj, myOrigin, XDMF_ARRAY_TYPE_FLOAT64, 3, 0, 1, 1) +!! PRINT *, myOrigin +!!!! /Regular Grid Only + CALL XDMFRETRIEVENUMSETS(obj, numContained) + PRINT *, '\nNumber of Sets:', numContained + PRINT *, '\nSet 0' + CALL XDMFRETRIEVESETNUMPROPERTIES(obj, 0, numContained) + PRINT *, 'Number of Properties: ', numContained + CALL XDMFRETRIEVESETPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVESETPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVESETTYPE(obj, 0, typeHolder) + PRINT *, 'Set Type: ', typeHolder + CALL XDMFRETRIEVESETVALUETYPE(obj, 0, typeHolder) + PRINT *, 'Set Value Type: ', typeHolder + CALL XDMFRETRIEVESETNAME(obj, 0, itemName, 256) + PRINT *, 'Set Name: ', itemName + CALL XDMFRETRIEVESETTAG(obj, 0, itemTag, 256) + PRINT *, 'Set Tag: ', itemTag + CALL XDMFRETRIEVESETVALUES(obj, 0, mySetOutput, XDMF_ARRAY_TYPE_FLOAT64, 12, 0, 1, 1) + PRINT 3, mySetOutput + PRINT *, '\nAttribute 0' + CALL XDMFRETRIEVEATTRIBUTENAME(obj, 0, itemName, 256) + PRINT *, 'Attribute Name: ', itemName + CALL XDMFRETRIEVEATTRIBUTENUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEATTRIBUTEPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTEPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTETAG(obj, 0, itemTag, 256) + PRINT *, 'Attribute Tag: ', itemTag + CALL XDMFRETRIEVEATTRIBUTETYPE(obj, 0, typeHolder) + PRINT *, 'Attribute Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTECENTER(obj, 0, typeHolder) + PRINT *, 'Attribute Center: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTEVALUETYPE(obj, 0, typeHolder) + PRINT *, 'Attribute Value Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTESIZE(obj, 0, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEATTRIBUTEVALUES(obj, 0, myNodeAttributeOutput, XDMF_ARRAY_TYPE_FLOAT64, 12, 0, 1, 1) + PRINT 3, myNodeAttributeOutput +3 FORMAT (' ', 3F6.1) + CALL XDMFOPENATTRIBUTE(obj, 0) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid and Attribute 0: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 1, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Value: ', itemValue + PRINT *, '\nAttribute 1' + CALL XDMFRETRIEVEATTRIBUTENUMPROPERTIES(obj, 1, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEATTRIBUTEPROPERTY(obj, 1, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTEPROPERTYBYKEY(obj, 1, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTENAME(obj, 1, itemName, 256) + PRINT *, 'Attribute Name: ', itemName + CALL XDMFRETRIEVEATTRIBUTETAG(obj, 1, itemTag, 256) + PRINT *, 'Attribute Tag: ', itemTag + CALL XDMFRETRIEVEATTRIBUTETYPE(obj, 1, typeHolder) + PRINT *, 'Attribute Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTECENTER(obj, 1, typeHolder) + PRINT *, 'Attribute Center: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTEVALUETYPE(obj, 1, typeHolder) + PRINT *, 'Attribute Value Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTESIZE(obj, 1, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEATTRIBUTEVALUES(obj, 1, myCellAttributeOutput, XDMF_ARRAY_TYPE_FLOAT64, 4, 0, 1, 1) + PRINT 4, myCellAttributeOutput +4 FORMAT (' ', F6.1) + CALL XDMFOPENATTRIBUTE(obj, 1) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid and Attribute 0: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + + + + CALL XDMFCLEARINFORMATIONS(obj) + CALL XDMFCLEARATTRIBUTES(obj) + CALL XDMFREPLACESET(obj, 0, 'EditedSet'//CHAR(0), XDMF_SET_TYPE_NODE, mySetOutput, 12, XDMF_ARRAY_TYPE_FLOAT64) + PRINT *, 'Set Edited' + CALL XDMFOPENGRIDCOLLECTIONGRID(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 0, 1, 0, 0) + CALL XDMFREPLACEATTRIBUTE(obj, 1, 'Edited Attribute'//CHAR(0), XDMF_ATTRIBUTE_CENTER_NODE, XDMF_ATTRIBUTE_TYPE_SCALAR, & + 4, XDMF_ARRAY_TYPE_FLOAT64, myNodeAttributeOutput) + CALL XDMFOPENGRIDCOLLECTIONGRID(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 0, 0, 1, 0) + CALL XDMFREPLACEINFORMATION(obj, 0, 'Edited Key'//CHAR(0), 'Edited Value'//CHAR(0)) + CALL XDMFREPLACEGRIDCOLLECTIONGRID(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 'Edited Grid'//CHAR(0)) + PRINT *, 'Grid Replaced' + CALL XDMFWRITE(obj, outfilename) + CALL XDMFCLOSE(obj) + +END PROGRAM XdmfFortranExample diff --git a/utils/tests/Fortran/OutputTestXdmfFortran.f90 b/utils/tests/Fortran/OutputTestXdmfFortran.f90 new file mode 100644 index 0000000000000000000000000000000000000000..11818a72a3e0c751f9c5c145acfae2ee923feab3 --- /dev/null +++ b/utils/tests/Fortran/OutputTestXdmfFortran.f90 @@ -0,0 +1,168 @@ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! +!! AUTHOR: Kenneth Leiter (kenneth.leiter@arl.army.mil) +!! +!! Use the Xdmf Fortran Bindings to write out a simple mesh consisting of +!! two hexahedrons. Link against the XdmfUtils library to compile. +!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +PROGRAM XdmfFortranExample + + IMPLICIT NONE + INCLUDE 'Xdmf.f' + + INTEGER*8 obj + character*256 filename + REAL*4 myPoints(3,3,4) + INTEGER myConnections(8,2), myDimensions(3) + REAL*8 myCellAttribute(2), myNodeAttribute(3,4), mySmallerNode(3,2), myTime, myOrigin(3), myBrick(3) + INTEGER nodeAttributeId, nodeSmallAttributeId, cellAttributeId, testSetID, testMapID, tempID + + filename = 'my_output.xmf'//CHAR(0) + + myPoints(1,1,1) = 0 + myPoints(2,1,1) = 0 + myPoints(3,1,1) = 1 + myPoints(1,2,1) = 1 + myPoints(2,2,1) = 0 + myPoints(3,2,1) = 1 + myPoints(1,3,1) = 3 + myPoints(2,3,1) = 0 + myPoints(3,3,1) = 2 + myPoints(1,1,2) = 0 + myPoints(2,1,2) = 1 + myPoints(3,1,2) = 1 + myPoints(1,2,2) = 1 + myPoints(2,2,2) = 1 + myPoints(3,2,2) = 1 + myPoints(1,3,2) = 3 + myPoints(2,3,2) = 2 + myPoints(3,3,2) = 2 + myPoints(1,1,3) = 0 + myPoints(2,1,3) = 0 + myPoints(3,1,3) = -1 + myPoints(1,2,3) = 1 + myPoints(2,2,3) = 0 + myPoints(3,2,3) = -1 + myPoints(1,3,3) = 3 + myPoints(2,3,3) = 0 + myPoints(3,3,3) = -2 + myPoints(1,1,4) = 0 + myPoints(2,1,4) = 1 + myPoints(3,1,4) = -1 + myPoints(1,2,4) = 1 + myPoints(2,2,4) = 1 + myPoints(3,2,4) = -1 + myPoints(1,3,4) = 3 + myPoints(2,3,4) = 2 + myPoints(3,3,4) = -2 + + myConnections(1,1) = 0 + myConnections(2,1) = 1 + myConnections(3,1) = 7 + myConnections(4,1) = 6 + myConnections(5,1) = 3 + myConnections(6,1) = 4 + myConnections(7,1) = 10 + myConnections(8,1) = 9 + myConnections(1,2) = 1 + myConnections(2,2) = 2 + myConnections(3,2) = 8 + myConnections(4,2) = 7 + myConnections(5,2) = 4 + myConnections(6,2) = 5 + myConnections(7,2) = 11 + myConnections(8,2) = 10 + + myNodeAttribute(1,1) = 100 + myNodeAttribute(1,2) = 300 + myNodeAttribute(1,3) = 300 + myNodeAttribute(1,4) = 500 + myNodeAttribute(2,1) = 200 + myNodeAttribute(2,2) = 400 + myNodeAttribute(2,3) = 400 + myNodeAttribute(2,4) = 600 + myNodeAttribute(3,1) = 300 + myNodeAttribute(3,2) = 500 + myNodeAttribute(3,3) = 500 + myNodeAttribute(3,4) = 700 + + myCellAttribute(1) = 100 + myCellAttribute(2) = 200 + + myDimensions(1) = 12 + myDimensions(2) = 12 + myDimensions(3) = 12 + + myOrigin(1) = 0 + myOrigin(2) = 0 + myOrigin(3) = 0 + + myBrick(1) = 12 + myBrick(2) = 12 + myBrick(3) = 12 + + myTime = 1.0 + + CALL XDMFINIT(obj, filename) + tempID = XDMFADDINFORMATION(obj, 'GridCollection1'//CHAR(0), 'This is Grid collection 1'//CHAR(0)) + CALL XDMFADDGRIDCOLLECTION(obj, "Temporal"//CHAR(0), & + XDMF_GRID_COLLECTION_TYPE_TEMPORAL) + CALL XDMFADDMAP(obj, "TestMap"//CHAR(0)) + CALL XDMFADDREMOTENODEID(obj, 0, 1, 2, 3) + CALL XDMFADDREMOTENODEID(obj, 0, 1, 2, 4) + CALL XDMFADDREMOTENODEID(obj, 0, 1, 3, 3) + CALL XDMFADDREMOTENODEID(obj, 0, 1, 3, 5) + testMapID = XDMFSTOREMAP(obj, 0) + CALL XDMFADDREMOTENODEID(obj, 0, 1, 3, 8) + CALL XDMFSETTIME(obj, myTime) +!! Unstructured Only + tempID = XDMFSETTOPOLOGY(obj, XDMF_TOPOLOGY_TYPE_HEXAHEDRON, 16, & + XDMF_ARRAY_TYPE_INT32, myConnections) +!! /Unstructured Only +!! Curvilinear and Rectilinear Only + tempID = XDMFSETDIMENSIONS(obj, 3, XDMF_ARRAY_TYPE_INT32, myDimensions) +!! /Curvilinear and Rectilinear Only +!! Unstructured and Curvilinear Only + tempID = XDMFSETGEOMETRY(obj, XDMF_GEOMETRY_TYPE_XYZ, 36, & + XDMF_ARRAY_TYPE_FLOAT32, myPoints) +!! /Unstructured and Curvilinear Only +!! Rectilinear Only + tempID = XDMFADDCOORDINATE(obj, "XCoordinates"//CHAR(0), 12, XDMF_ARRAY_TYPE_FLOAT32, myPoints(1,1,1)) + tempID = XDMFADDCOORDINATE(obj, "YCoordinates"//CHAR(0), 12, XDMF_ARRAY_TYPE_FLOAT32, myPoints(1,2,2)) + tempID = XDMFADDCOORDINATE(obj, "ZCoordinates"//CHAR(0), 12, XDMF_ARRAY_TYPE_FLOAT32, myPoints(1,3,3)) +!! /Rectilinear Only +!! Regular Only + tempID = XDMFSETORIGIN(obj, 3, XDMF_ARRAY_TYPE_FLOAT64, myOrigin) + tempID = XDMFSETBRICK(obj, 3, XDMF_ARRAY_TYPE_FLOAT64, myBrick) +!! /Regular Only + testSetID = XDMFADDSET(obj, 'TestSet'//CHAR(0), XDMF_SET_TYPE_NODE, myNodeAttribute, 12, XDMF_ARRAY_TYPE_FLOAT64) + tempID = XDMFADDINFORMATION(obj, 'Attrib1'//CHAR(0), 'This is Attribute 1'//CHAR(0)) + nodeAttributeId = XDMFADDATTRIBUTE(obj, 'NodeValues'//CHAR(0), & + XDMF_ATTRIBUTE_CENTER_NODE, XDMF_ATTRIBUTE_TYPE_SCALAR, 12, & + XDMF_ARRAY_TYPE_FLOAT64, myNodeAttribute) + CALL XDMFRETRIEVEATTRIBUTEVALUES(obj, 0, mySmallerNode, XDMF_ARRAY_TYPE_FLOAT64, 6, 0, 1, 1) + tempID = XDMFADDINFORMATION(obj, 'Attrib2'//CHAR(0), 'This is Attribute 2'//CHAR(0)) + cellAttributeId = XDMFADDATTRIBUTE(obj, 'CellValues'//CHAR(0), & + XDMF_ATTRIBUTE_CENTER_CELL, XDMF_ATTRIBUTE_TYPE_SCALAR, 2, & + XDMF_ARRAY_TYPE_FLOAT64, myCellAttribute) + nodeSmallAttributeId = XDMFADDATTRIBUTE(obj, 'SmallNodeValues'//CHAR(0), & + XDMF_ATTRIBUTE_CENTER_NODE, XDMF_ATTRIBUTE_TYPE_SCALAR, 6, & + XDMF_ARRAY_TYPE_FLOAT64, mySmallerNode) + tempID = XDMFADDINFORMATION(obj, 'Grid1'//CHAR(0), 'This is Grid 1'//CHAR(0)) + CALL XDMFADDGRID(obj, 'TestGrid'//CHAR(0), XDMF_GRID_TYPE_UNSTRUCTURED) + myTime = 2.0 + + CALL XDMFSETTIME(obj, myTime) + CALL XDMFADDPREVIOUSATTRIBUTE(obj, cellAttributeId) + CALL XDMFADDPREVIOUSMAP(obj, testMapID) + CALL XDMFADDPREVIOUSSET(obj, testSetID) + CALL XDMFADDPREVIOUSATTRIBUTE(obj, nodeAttributeId) + CALL XDMFADDGRID(obj, 'Identical'//CHAR(0), XDMF_GRID_TYPE_UNSTRUCTURED) + CALL XDMFCLOSEGRIDCOLLECTION(obj) +!! CALL XDMFWRITEHDF5(obj, 'my_output.h5'//CHAR(0)) + CALL XDMFWRITE(obj, filename) + CALL XDMFCLOSE(obj) + +END PROGRAM XdmfFortranExample diff --git a/utils/tests/Fortran/TestXdmfFortran.f90 b/utils/tests/Fortran/TestXdmfFortran.f90 index 3f7da860d9fd5f475e31b11ded304e4f5725597a..d03b7931372d68a1f9ce5cc81003ebccf2ef8f94 100644 --- a/utils/tests/Fortran/TestXdmfFortran.f90 +++ b/utils/tests/Fortran/TestXdmfFortran.f90 @@ -1,9 +1,11 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! -!! AUTHOR: Kenneth Leiter (kenneth.leiter@arl.army.mil) +!! AUTHOR: Andrew Burns (andrew.j.burns2@us.army.mil) !! -!! Use the Xdmf Fortran Bindings to write out a simple mesh consisting of -!! two hexahedrons. Link against the XdmfUtils library to compile. +!! Read the first hexahedron from the file generated by the +!! OutputTestXdmfFortran program, then print the results for comparison. +!! +!! Link against the XdmfUtils library to compile. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -13,111 +15,304 @@ PROGRAM XdmfFortranExample INCLUDE 'Xdmf.f' INTEGER*8 obj - character*256 filename - REAL*4 myPoints(3,3,4) - INTEGER myConnections(8,2) - REAL*8 myCellAttribute(2), myNodeAttribute(3,4), myTime - INTEGER nodeAttributeId, cellAttributeId, xdmfaddattribute + character*256 infilename, itemName, itemKey, itemValue, itemTag + REAL*4 myPointsOutput(36) + INTEGER myConnectionsOutput(16) + INTEGER myMappedNodes(3), myDimensions(3) + REAL*8 myCellAttributeOutput(4), myNodeAttributeOutput(12), mySetOutput(12), myTestTime, myBrick(3), myOrigin(3) + INTEGER numContained, typeHolder - filename = 'my_output'//CHAR(0) - myPoints(1,1,1) = 0 - myPoints(2,1,1) = 0 - myPoints(3,1,1) = 1 - myPoints(1,2,1) = 1 - myPoints(2,2,1) = 0 - myPoints(3,2,1) = 1 - myPoints(1,3,1) = 3 - myPoints(2,3,1) = 0 - myPoints(3,3,1) = 2 - myPoints(1,1,2) = 0 - myPoints(2,1,2) = 1 - myPoints(3,1,2) = 1 - myPoints(1,2,2) = 1 - myPoints(2,2,2) = 1 - myPoints(3,2,2) = 1 - myPoints(1,3,2) = 3 - myPoints(2,3,2) = 2 - myPoints(3,3,2) = 2 - myPoints(1,1,3) = 0 - myPoints(2,1,3) = 0 - myPoints(3,1,3) = -1 - myPoints(1,2,3) = 1 - myPoints(2,2,3) = 0 - myPoints(3,2,3) = -1 - myPoints(1,3,3) = 3 - myPoints(2,3,3) = 0 - myPoints(3,3,3) = -2 - myPoints(1,1,4) = 0 - myPoints(2,1,4) = 1 - myPoints(3,1,4) = -1 - myPoints(1,2,4) = 1 - myPoints(2,2,4) = 1 - myPoints(3,2,4) = -1 - myPoints(1,3,4) = 3 - myPoints(2,3,4) = 2 - myPoints(3,3,4) = -2 + infilename = 'my_output.xmf'//CHAR(0) - myConnections(1,1) = 0 - myConnections(2,1) = 1 - myConnections(3,1) = 7 - myConnections(4,1) = 6 - myConnections(5,1) = 3 - myConnections(6,1) = 4 - myConnections(7,1) = 10 - myConnections(8,1) = 9 - myConnections(1,2) = 1 - myConnections(2,2) = 2 - myConnections(3,2) = 8 - myConnections(4,2) = 7 - myConnections(5,2) = 4 - myConnections(6,2) = 5 - myConnections(7,2) = 11 - myConnections(8,2) = 10 - - myNodeAttribute(1,1) = 100 - myNodeAttribute(1,2) = 300 - myNodeAttribute(1,3) = 300 - myNodeAttribute(1,4) = 500 - myNodeAttribute(2,1) = 200 - myNodeAttribute(2,2) = 400 - myNodeAttribute(2,3) = 400 - myNodeAttribute(2,4) = 600 - myNodeAttribute(3,1) = 300 - myNodeAttribute(3,2) = 500 - myNodeAttribute(3,3) = 500 - myNodeAttribute(3,4) = 700 - - myCellAttribute(1) = 100 - myCellAttribute(2) = 200 - - myTime = 1.0 + CALL XDMFINIT(obj) + CALL XDMFREAD(obj, infilename) - CALL XDMFINIT(obj, filename) - CALL XDMFADDGRIDCOLLECTION(obj, "Temporal"//CHAR(0), & - XDMF_GRID_COLLECTION_TYPE_TEMPORAL) - CALL XDMFSETTIME(obj, myTime) - CALL XDMFSETTOPOLOGY(obj, XDMF_TOPOLOGY_TYPE_HEXAHEDRON, 16, & - XDMF_ARRAY_TYPE_INT32, myConnections) - CALL XDMFSETGEOMETRY(obj, XDMF_GEOMETRY_TYPE_XYZ, 36, & - XDMF_ARRAY_TYPE_FLOAT32, myPoints) - nodeAttributeId = XDMFADDATTRIBUTE(obj, 'NodeValues'//CHAR(0), & - XDMF_ATTRIBUTE_CENTER_NODE, XDMF_ATTRIBUTE_TYPE_SCALAR, 12, & - XDMF_ARRAY_TYPE_FLOAT64, myNodeAttribute) - cellAttributeId = XDMFADDATTRIBUTE(obj, 'CellValues'//CHAR(0), & - XDMF_ATTRIBUTE_CENTER_CELL, XDMF_ATTRIBUTE_TYPE_SCALAR, 2, & - XDMF_ARRAY_TYPE_FLOAT64, myCellAttribute) - CALL XDMFADDINFORMATION(obj, 'Key'//CHAR(0), 'Value'//CHAR(0)) - CALL XDMFADDGRID(obj, 'TestGrid'//CHAR(0)) + PRINT *, 'Load From: ', TRIM(infilename) + PRINT *, 'Domain Properties' + CALL XDMFRETRIEVEDOMAINNUMPROPERTIES(obj, numContained) + PRINT *, 'number of Properties: ', numContained + CALL XDMFRETRIEVEDOMAINTAG(obj, itemTag, 256) + PRINT *, 'Domain Tag: ', itemTag + CALL XDMFRETRIEVENUMDOMAINGRIDCOLLECTIONS(obj, numContained) + PRINT *, 'Number of Grid Collections: ', numContained + CALL XDMFOPENDOMAINGRIDCOLLECTION(obj, 0, 1, 1, 1, 1) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEGRIDCOLLECTIONNUMGRIDS(obj, XDMF_GRID_TYPE_UNSTRUCTURED, numContained) + PRINT *, 'Number of Grids contained in the Grid Collection: ', numContained + CALL XDMFOPENGRIDCOLLECTIONGRID(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 1, 1, 1, 1) + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDNAME(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemName, 256) + PRINT *, "Grid Name: ", itemName + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDTAG(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemTag, 256) + PRINT *, "Grid Tag: ", itemTag + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDNUMPROPERTIES(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, numContained) + PRINT *, "Number of Properties: ", numContained + PRINT *, "Grid Properties: " + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDPROPERTY(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGRIDCOLLECTIONGRIDPROPERTYBYKEY(obj, XDMF_GRID_TYPE_UNSTRUCTURED, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETIME(obj, myTestTime) + PRINT *, 'Grid Time: ', myTestTime + CALL XDMFRETRIEVEGRIDCOLLECTIONTYPE(obj, typeHolder) + PRINT *, 'Grid Collection Type: ', typeHolder + CALL XDMFRETRIEVENUMATTRIBUTES(obj, numContained) + PRINT *, 'Number of Grid Attributes: ', numContained + PRINT *, 'Map' + CALL XDMFRETRIEVEMAPNUMPROPERTIES(obj, 0, numContained) + PRINT *, 'Number of Properties: ', numContained + CALL XDMFRETRIEVEMAPPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEMAPPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEREMOTENODEIDS(obj, 0, 3, 1, myMappedNodes) + PRINT *, 'Nodes: ', myMappedNodes +!!!! Unstructured and Curvilinear only + PRINT *, 'Geometry' + CALL XDMFRETRIEVEGEOMETRYNUMPROPERTIES(obj, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEGEOMETRYPROPERTY(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGEOMETRYPROPERTYBYKEY(obj, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEGEOMETRYTAG(obj, itemTag, 256) + PRINT *, 'Geometry Tag: ', itemTag + CALL XDMFRETRIEVEGEOMETRYTYPE(obj, typeHolder) + PRINT *, 'Geometry Type: ', typeHolder + CALL XDMFRETRIEVEGEOMETRYVALUETYPE(obj, typeHolder) + PRINT *, 'Geometry Value Type: ', typeHolder + CALL XDMFRETRIEVEGEOMETRYSIZE(obj, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEGEOMETRYNUMPOINTS(obj, numContained) + PRINT *, 'Geometry Number of Points: ', numContained + CALL XDMFRETRIEVEGEOMETRYVALUES(obj, myPointsOutput, XDMF_ARRAY_TYPE_FLOAT32, 36, 0, 1, 1) + PRINT 1, myPointsOutput +1 FORMAT (' ', 3F5.1, '\n ', 3F5.1, '\n ', 3F5.1, '\n') +!!!! / Unstructured and Curvilinear Grid only +!!!! Unstructured Grid only + PRINT *, 'Topology' + CALL XDMFRETRIEVETOPOLOGYNUMPROPERTIES(obj, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVETOPOLOGYPROPERTY(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETOPOLOGYPROPERTYBYKEY(obj, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVETOPOLOGYTAG(obj, itemTag, 256) + PRINT *, 'Topology Tag: ', itemTag + CALL XDMFRETRIEVETOPOLOGYTYPE(obj, typeHolder) + PRINT *, 'Topology Type: ', typeHolder + CALL XDMFRETRIEVETOPOLOGYVALUETYPE(obj, typeHolder) + PRINT *, 'Topology Value Type: ', typeHolder + CALL XDMFRETRIEVETOPOLOGYSIZE(obj, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVETOPOLOGYNUMELEMENTS(obj, numContained) + PRINT *, 'Topology Number of elements: ', numContained + CALL XDMFRETRIEVETOPOLOGYVALUES(obj, myConnectionsOutput, XDMF_ARRAY_TYPE_INT32, 16, 0, 1, 1) + PRINT 2, myConnectionsOutput +2 FORMAT (' ', 8I3) +!!!! /Unstructured Grid Only +!!!! Curvilinear and Regular only +!! PRINT *, 'Dimensions' +!! CALL XDMFRETRIEVEDIMENSIONSNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEDIMENSIONSPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEDIMENSIONSPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEDIMENSIONSTAG(obj, itemTag, 256) +!! PRINT *, "Dimension Tag: ", itemTag +!! CALL XDMFRETRIEVEDIMENSIONSVALUETYPE(obj, typeHolder) +!! PRINT *, "Dimension Value Type: ", typeHolder +!! CALL XDMFRETRIEVEDIMENSIONSSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEDIMENSIONSVALUES(obj, myDimensions, XDMF_ARRAY_TYPE_INT32, 3, 0, 1, 1) +!! PRINT *, myDimensions +!!!! /Curvilinear and Regular only +!!!! Rectilinear Only +!! PRINT *, 'Coordinates' +!! CALL XDMFRETRIEVENUMCOORDINATES(obj, numContained) +!! PRINT *, 'Number of Coordinates: ', numContained +!! CALL XDMFRETRIEVECOORDINATEVALUETYPE(obj, 0, typeHolder) +!! PRINT *, 'Coordinate Value Type', typeHolder +!! CALL XDMFRETRIEVECOORDINATENUMPROPERTIES(obj, 0, numContained) +!! PRINT *, 'Number of Properties', numContained +!! CALL XDMFRETRIEVECOORDINATEPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) +!! PRINT *, 'Key: ', itemKey +!! PRINT *, 'Value: ', itemValue +!! CALL XDMFRETRIEVECOORDINATEPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) +!! PRINT *, 'Value: ', itemValue +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 0, numContained) +!! PRINT *, 'Size of Coordinate 0', numContained +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 1, numContained) +!! PRINT *, 'Size of Coordinate 1', numContained +!! CALL XDMFRETRIEVECOORDINATESIZE(obj, 2, numContained) +!! PRINT *, 'Size of Coordinate 2', numContained +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(1), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(13), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! CALL XDMFRETRIEVECOORDINATEVALUES(obj, 0, myPointsOutput(25), XDMF_ARRAY_TYPE_FLOAT32, 12, 0, 1, 1) +!! PRINT 1, myPointsOutput +!!!! /Rectilinear Only +!!!! Regular Grid Only +!! Brick and Origin +!! PRINT *, 'Brick' +!! CALL XDMFRETRIEVEBRICKNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEBRICKPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEBRICKPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEBRICKTAG(obj, itemTag, 256) +!! PRINT *, "Brick Tag: ", itemTag +!! CALL XDMFRETRIEVEBRICKVALUETYPE(obj, typeHolder) +!! PRINT *, "Brick Value Type: ", typeHolder +!! CALL XDMFRETRIEVEBRICKSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEBRICKVALUES(obj, myBrick, XDMF_ARRAY_TYPE_FLOAT64, 3, 0, 1, 1) +!! PRINT *, myBrick +!! PRINT *, 'Origin' +!! CALL XDMFRETRIEVEORIGINNUMPROPERTIES(obj, numContained) +!! PRINT *, 'Number of Properties: ', numContained +!! CALL XDMFRETRIEVEORIGINPROPERTY(obj, 0, itemKey, 256, itemValue, 256) +!! PRINT *, "Key: ", itemKey +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEORIGINPROPERTYBYKEY(obj, itemKey, itemValue, 256) +!! PRINT *, "Value: ", itemValue +!! CALL XDMFRETRIEVEORIGINTAG(obj, itemTag, 256) +!! PRINT *, "Origin Tag: ", itemTag +!! CALL XDMFRETRIEVEORIGINVALUETYPE(obj, typeHolder) +!! PRINT *, "Origin Value Type: ", typeHolder +!! CALL XDMFRETRIEVEORIGINSIZE(obj, numContained) +!! PRINT *, "Number of Values: ", numContained +!! CALL XDMFRETRIEVEORIGINVALUES(obj, myOrigin, XDMF_ARRAY_TYPE_FLOAT64, 3, 0, 1, 1) +!! PRINT *, myOrigin +!!!! /Regular Grid Only + CALL XDMFRETRIEVENUMSETS(obj, numContained) + PRINT *, '\nNumber of Sets:', numContained + PRINT *, '\nSet 0' + CALL XDMFRETRIEVESETNUMPROPERTIES(obj, 0, numContained) + PRINT *, 'Number of Properties: ', numContained + CALL XDMFRETRIEVESETPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVESETPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVESETTYPE(obj, 0, typeHolder) + PRINT *, 'Set Type: ', typeHolder + CALL XDMFRETRIEVESETVALUETYPE(obj, 0, typeHolder) + PRINT *, 'Set Value Type: ', typeHolder + CALL XDMFRETRIEVESETNAME(obj, 0, itemName, 256) + PRINT *, 'Set Name: ', itemName + CALL XDMFRETRIEVESETTAG(obj, 0, itemTag, 256) + PRINT *, 'Set Tag: ', itemTag + CALL XDMFRETRIEVESETVALUES(obj, 0, mySetOutput, XDMF_ARRAY_TYPE_FLOAT64, 12, 0, 1, 1) + PRINT 3, mySetOutput + PRINT *, '\nAttribute 0' + CALL XDMFRETRIEVEATTRIBUTENAME(obj, 0, itemName, 256) + PRINT *, 'Attribute Name: ', itemName + CALL XDMFRETRIEVEATTRIBUTENUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEATTRIBUTEPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTEPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTETAG(obj, 0, itemTag, 256) + PRINT *, 'Attribute Tag: ', itemTag + CALL XDMFRETRIEVEATTRIBUTETYPE(obj, 0, typeHolder) + PRINT *, 'Attribute Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTECENTER(obj, 0, typeHolder) + PRINT *, 'Attribute Center: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTEVALUETYPE(obj, 0, typeHolder) + PRINT *, 'Attribute Value Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTESIZE(obj, 0, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEATTRIBUTEVALUES(obj, 0, myNodeAttributeOutput, XDMF_ARRAY_TYPE_FLOAT64, 12, 0, 1, 1) + PRINT 3, myNodeAttributeOutput +3 FORMAT (' ', 3F6.1) + CALL XDMFOPENATTRIBUTE(obj, 0) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid and Attribute 0: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 1, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Value: ', itemValue + PRINT *, '\nAttribute 1' + CALL XDMFRETRIEVEATTRIBUTENUMPROPERTIES(obj, 1, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEATTRIBUTEPROPERTY(obj, 1, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTEPROPERTYBYKEY(obj, 1, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEATTRIBUTENAME(obj, 1, itemName, 256) + PRINT *, 'Attribute Name: ', itemName + CALL XDMFRETRIEVEATTRIBUTETAG(obj, 1, itemTag, 256) + PRINT *, 'Attribute Tag: ', itemTag + CALL XDMFRETRIEVEATTRIBUTETYPE(obj, 1, typeHolder) + PRINT *, 'Attribute Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTECENTER(obj, 1, typeHolder) + PRINT *, 'Attribute Center: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTEVALUETYPE(obj, 1, typeHolder) + PRINT *, 'Attribute Value Type: ', typeHolder + CALL XDMFRETRIEVEATTRIBUTESIZE(obj, 1, numContained) + PRINT *, 'Number of Values: ', numContained + CALL XDMFRETRIEVEATTRIBUTEVALUES(obj, 1, myCellAttributeOutput, XDMF_ARRAY_TYPE_FLOAT64, 4, 0, 1, 1) + PRINT 4, myCellAttributeOutput +4 FORMAT (' ', F6.1) + CALL XDMFOPENATTRIBUTE(obj, 1) + CALL XDMFRETRIEVENUMINFORMATION(obj, numContained) + PRINT *, 'Number of Information for Grid and Attribute 0: ', numContained + PRINT *, 'Information 0' + CALL XDMFRETRIEVEINFORMATIONNUMPROPERTIES(obj, 0, numContained) + PRINT *, "Number of Properties: ", numContained + CALL XDMFRETRIEVEINFORMATIONPROPERTY(obj, 0, 0, itemKey, 256, itemValue, 256) + PRINT *, "Key: ", itemKey + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONPROPERTYBYKEY(obj, 0, itemKey, itemValue, 256) + PRINT *, "Value: ", itemValue + CALL XDMFRETRIEVEINFORMATIONTAG(obj, 0, itemTag, 256) + PRINT *, 'Information Tag: ', itemTag + CALL XDMFRETRIEVEINFORMATION(obj, 0, itemKey, 256, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue + CALL XDMFRETRIEVEINFORMATIONBYKEY(obj, itemKey, itemValue, 256) + PRINT *, 'Key: ', itemKey + PRINT *, 'Value: ', itemValue - myTime = 2.0 - CALL XDMFSETTIME(obj, myTime) - CALL XDMFADDPREVIOUSATTRIBUTE(obj, cellAttributeId) - CALL XDMFADDGRID(obj, 'Identical'//CHAR(0)) - CALL XDMFCLOSEGRIDCOLLECTION(obj) - CALL XDMFWRITE(obj, filename) CALL XDMFCLOSE(obj) END PROGRAM XdmfFortranExample -