Commit 3613b291 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Change some method names in XdmfArray to be clearer and less verbose. ...

ENH: Change some method names in XdmfArray to be clearer and less verbose.  Modify files for documentation clarity.  Modify some minor things to prevent -Wall warnings in gcc.  Add python install rules and rpathing.
parent 67bf3fee
......@@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 2.6)
set(BUILD_SHARED_LIBS true)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake ${CMAKE_CURRENT_SOURCE_DIR}/core/CMake)
......@@ -50,6 +54,8 @@ if(XDMF_WRAP_PYTHON)
set_source_files_properties(Xdmf.i PROPERTIES CPLUSPLUS ON)
swig_add_module(Xdmf python Xdmf.i)
swig_link_libraries(Xdmf Xdmf ${PYTHON_LIBRARIES})
install(FILES ${CMAKE_BINARY_DIR}/Xdmf.py DESTINATION lib/python)
install(TARGETS ${SWIG_MODULE_Xdmf_REAL_NAME} DESTINATION lib/python)
endif(XDMF_WRAP_PYTHON)
option(XDMF_BUILD_UTILS OFF)
......
......@@ -16,9 +16,9 @@ boost::shared_ptr<XdmfAttribute> XdmfAttribute::New()
}
XdmfAttribute::XdmfAttribute() :
mCenter(XdmfAttributeCenter::Grid()),
mName(""),
mAttributeType(XdmfAttributeType::NoAttributeType()),
mAttributeCenter(XdmfAttributeCenter::Grid())
mType(XdmfAttributeType::NoAttributeType())
{
}
......@@ -30,15 +30,15 @@ const std::string XdmfAttribute::ItemTag = "Attribute";
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttribute::getCenter() const
{
return mAttributeCenter;
return mCenter;
}
std::map<std::string, std::string> XdmfAttribute::getItemProperties() const
{
std::map<std::string, std::string> attributeProperties;
attributeProperties["Name"] = mName;
mAttributeType->getProperties(attributeProperties);
mAttributeCenter->getProperties(attributeProperties);
mType->getProperties(attributeProperties);
mCenter->getProperties(attributeProperties);
return attributeProperties;
}
......@@ -54,11 +54,12 @@ std::string XdmfAttribute::getName() const
boost::shared_ptr<const XdmfAttributeType> XdmfAttribute::getType() const
{
return mAttributeType;
return mType;
}
void XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
if(name != itemProperties.end())
{
......@@ -68,8 +69,8 @@ void XdmfAttribute::populateItem(const std::map<std::string, std::string> & item
{
assert(false);
}
mAttributeCenter = XdmfAttributeCenter::New(itemProperties);
mAttributeType = XdmfAttributeType::New(itemProperties);
mCenter = XdmfAttributeCenter::New(itemProperties);
mType = XdmfAttributeType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
{
if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
......@@ -80,9 +81,9 @@ void XdmfAttribute::populateItem(const std::map<std::string, std::string> & item
}
}
void XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> attributeCenter)
void XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center)
{
mAttributeCenter = attributeCenter;
mCenter = center;
}
void XdmfAttribute::setName(const std::string & name)
......@@ -90,7 +91,7 @@ void XdmfAttribute::setName(const std::string & name)
mName= name;
}
void XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> attributeType)
void XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> type)
{
mAttributeType = attributeType;
mType = type;
}
......@@ -59,9 +59,9 @@ public:
/**
* Set the XdmfAttributeCenter associated with this attribute.
*
* @param attributeCenter the XdmfAttributeCenter to set.
* @param center the XdmfAttributeCenter to set.
*/
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> attributeCenter);
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center);
/**
* Set the name of the attribute.
......@@ -73,9 +73,9 @@ public:
/**
* Set the XdmfAttributeType associated with this attribute.
*
* @param attributeType XdmfAttributeType to set.
* @param type XdmfAttributeType to set.
*/
void setType(const boost::shared_ptr<const XdmfAttributeType> attributeType);
void setType(const boost::shared_ptr<const XdmfAttributeType> type);
protected:
......@@ -87,9 +87,9 @@ private:
XdmfAttribute(const XdmfAttribute & attribute); // Not implemented.
void operator=(const XdmfAttribute & attribute); // Not implemented.
boost::shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName;
boost::shared_ptr<const XdmfAttributeCenter> mAttributeCenter;
boost::shared_ptr<const XdmfAttributeType> mAttributeType;
boost::shared_ptr<const XdmfAttributeType> mType;
};
#endif /* XDMFATTRIBUTE_HPP_ */
......@@ -86,6 +86,7 @@ void XdmfDomain::insert(const boost::shared_ptr<XdmfGridCollection> gridCollecti
void XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
{
if(boost::shared_ptr<XdmfGridCollection> gridCollection = boost::shared_dynamic_cast<XdmfGridCollection>(*iter))
......@@ -119,6 +120,7 @@ void XdmfDomain::removeGridCollection(const unsigned int index)
void XdmfDomain::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfItem::traverse(visitor);
for(std::vector<boost::shared_ptr<XdmfGrid> >::const_iterator iter = mGrids.begin(); iter != mGrids.end(); ++iter)
{
(*iter)->accept(visitor);
......
......@@ -79,17 +79,19 @@ public:
*/
unsigned int getNumberGridCollections() const;
using XdmfItem::insert;
/**
* Insert a XdmfGrid into the domain.
*
* @param grid a shared pointer to an XdmfGrid to insert into the domain.
* @param grid a XdmfGrid to insert into the domain.
*/
void insert(const boost::shared_ptr<XdmfGrid> grid);
/**
* Insert a XdmfGridCollection into the domain.
*
* @param gridCollection a shared pointer to an XdmfGridCollection to insert into the domain.
* @param gridCollection a XdmfGridCollection to insert into the domain.
*/
void insert(const boost::shared_ptr<XdmfGridCollection> gridCollection);
......
......@@ -15,8 +15,8 @@ boost::shared_ptr<XdmfGeometry> XdmfGeometry::New()
}
XdmfGeometry::XdmfGeometry() :
mGeometryType(XdmfGeometryType::NoGeometryType()),
mNumberPoints(0)
mNumberPoints(0),
mType(XdmfGeometryType::NoGeometryType())
{
}
......@@ -29,7 +29,7 @@ const std::string XdmfGeometry::ItemTag = "Geometry";
std::map<std::string, std::string> XdmfGeometry::getItemProperties() const
{
std::map<std::string, std::string> geometryProperties;
mGeometryType->getProperties(geometryProperties);
mType->getProperties(geometryProperties);
return geometryProperties;
}
......@@ -40,21 +40,22 @@ std::string XdmfGeometry::getItemTag() const
unsigned int XdmfGeometry::getNumberPoints() const
{
if(mGeometryType->getDimensions() == 0)
if(mType->getDimensions() == 0)
{
return 0;
}
return this->size() / mGeometryType->getDimensions();
return this->getSize() / mType->getDimensions();
}
boost::shared_ptr<const XdmfGeometryType> XdmfGeometry::getType() const
{
return mGeometryType;
return mType;
}
void XdmfGeometry::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
mGeometryType = XdmfGeometryType::New(itemProperties);
XdmfItem::populateItem(itemProperties, childItems, reader);
mType = XdmfGeometryType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
{
if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
......@@ -65,7 +66,7 @@ void XdmfGeometry::populateItem(const std::map<std::string, std::string> & itemP
}
}
void XdmfGeometry::setType(const boost::shared_ptr<const XdmfGeometryType> geometryType)
void XdmfGeometry::setType(const boost::shared_ptr<const XdmfGeometryType> type)
{
mGeometryType = geometryType;
mType = type;
}
......@@ -51,7 +51,7 @@ public:
*
* @param geometryType the XdmfGeometryType to set.
*/
void setType(const boost::shared_ptr<const XdmfGeometryType> geometryType);
void setType(const boost::shared_ptr<const XdmfGeometryType> type);
protected:
......@@ -63,8 +63,8 @@ private:
XdmfGeometry(const XdmfGeometry & geometry); // Not implemented.
void operator=(const XdmfGeometry & geometry); // Not implemented.
boost::shared_ptr<const XdmfGeometryType> mGeometryType;
int mNumberPoints;
boost::shared_ptr<const XdmfGeometryType> mType;
};
#endif /* XDMFGEOMETRY_HPP_ */
......@@ -63,8 +63,8 @@ boost::shared_ptr<const XdmfGeometryType> XdmfGeometryType::Origin_DXDY()
}
XdmfGeometryType::XdmfGeometryType(const std::string& name, const int& dimensions) :
mName(name),
mDimensions(dimensions)
mDimensions(dimensions),
mName(name)
{
}
......
......@@ -20,9 +20,9 @@ boost::shared_ptr<XdmfGrid> XdmfGrid::New()
}
XdmfGrid::XdmfGrid() :
mName("Grid"),
mGeometry(XdmfGeometry::New()),
mMap(boost::shared_ptr<XdmfMap>()),
mName("Grid"),
mTime(boost::shared_ptr<XdmfTime>()),
mTopology(XdmfTopology::New())
{
......@@ -175,6 +175,7 @@ void XdmfGrid::insert(const boost::shared_ptr<XdmfSet> set)
void XdmfGrid::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
if(name != itemProperties.end())
{
......@@ -282,6 +283,7 @@ void XdmfGrid::setTopology(const boost::shared_ptr<XdmfTopology> topology)
void XdmfGrid::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfItem::traverse(visitor);
if(mTime)
{
mTime->accept(visitor);
......
......@@ -181,6 +181,8 @@ public:
*/
boost::shared_ptr<const XdmfTopology> getTopology() const;
using XdmfItem::insert;
/**
* Insert an attribute into the grid.
*
......
......@@ -15,8 +15,9 @@ boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
};
XdmfGridCollection::XdmfGridCollection() :
XdmfDomain(),
XdmfGrid(),
mCollectionType(XdmfGridCollectionType::NoCollectionType())
mType(XdmfGridCollectionType::NoCollectionType())
{
mName = "Collection";
}
......@@ -32,7 +33,7 @@ std::map<std::string, std::string> XdmfGridCollection::getItemProperties() const
std::map<std::string, std::string> collectionProperties;
collectionProperties["Name"] = mName;
collectionProperties["GridType"] = "Collection";
mCollectionType->getProperties(collectionProperties);
mType->getProperties(collectionProperties);
return collectionProperties;
}
......@@ -43,23 +44,34 @@ std::string XdmfGridCollection::getItemTag() const
boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const
{
return mCollectionType;
return mType;
}
void XdmfGridCollection::insert(const boost::shared_ptr<XdmfInformation> information)
{
XdmfItem::insert(information);
}
void XdmfGridCollection::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
mCollectionType = XdmfGridCollectionType::New(itemProperties);
mType = XdmfGridCollectionType::New(itemProperties);
XdmfDomain::populateItem(itemProperties, childItems, reader);
mInformations.clear();
XdmfGrid::populateItem(itemProperties, childItems, reader);
}
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> type)
{
mCollectionType = collectionType;
mType = type;
}
void XdmfGridCollection::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfGrid::traverse(visitor);
// Only write XdmfInformations once (deal with diamond inheritance)
std::vector<boost::shared_ptr<XdmfInformation> > informations;
informations.swap(mInformations);
XdmfDomain::traverse(visitor);
informations.swap(mInformations);
}
......@@ -16,8 +16,8 @@ class XdmfGridCollectionType;
*
* It is valid to nest collections. A spatial collection within a temporal collection is commonly used.
*/
class XdmfGridCollection : public XdmfGrid,
public XdmfDomain {
class XdmfGridCollection : public XdmfDomain,
public XdmfGrid {
public:
......@@ -47,12 +47,19 @@ public:
using XdmfDomain::insert;
using XdmfGrid::insert;
/**
* Insert an information into the grid collection (needed to use virtual inheritance correctly).
*
* @param information an XdmfInformation to attach to this item.
*/
void insert(const boost::shared_ptr<XdmfInformation> information);
/**
* Set the XdmfGridCollectionType associated with this grid collection.
*
* @param collectionType the XdmfGridCollectionType to set.
*/
void setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType);
void setType(const boost::shared_ptr<const XdmfGridCollectionType> type);
void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
......@@ -66,7 +73,7 @@ private:
XdmfGridCollection(const XdmfGridCollection & collection); // Not implemented.
void operator=(const XdmfGridCollection & collection); // Not implemented.
boost::shared_ptr<const XdmfGridCollectionType> mCollectionType;
boost::shared_ptr<const XdmfGridCollectionType> mType;
};
#endif /* XDMFGRID_HPP_ */
......@@ -41,9 +41,9 @@ std::vector<boost::shared_ptr<XdmfMap> > XdmfMap::New(const std::vector<boost::s
for(unsigned int i=0; i<globalNodeIds.size(); ++i)
{
const boost::shared_ptr<XdmfAttribute> currGlobalNodeIds = globalNodeIds[i];
for(unsigned int j=0; j<currGlobalNodeIds->size(); ++j)
for(unsigned int j=0; j<currGlobalNodeIds->getSize(); ++j)
{
unsigned int currGlobalNodeId = currGlobalNodeIds->getValueCopy<unsigned int>(j);
unsigned int currGlobalNodeId = currGlobalNodeIds->getValue<unsigned int>(j);
if(currGlobalNodeId > maxGlobalNodeId)
{
maxGlobalNodeId = currGlobalNodeId;
......@@ -58,9 +58,9 @@ std::vector<boost::shared_ptr<XdmfMap> > XdmfMap::New(const std::vector<boost::s
for(unsigned int i=0; i<globalNodeIds.size(); ++i)
{
const boost::shared_ptr<XdmfAttribute> currGlobalNodeIds = globalNodeIds[i];
for(unsigned int j=0; j<currGlobalNodeIds->size(); ++j)
for(unsigned int j=0; j<currGlobalNodeIds->getSize(); ++j)
{
unsigned int currGlobalNodeId = currGlobalNodeIds->getValueCopy<unsigned int>(j);
unsigned int currGlobalNodeId = currGlobalNodeIds->getValue<unsigned int>(j);
globalNodeIdMap[currGlobalNodeId][i] = j;
}
}
......@@ -73,9 +73,9 @@ std::vector<boost::shared_ptr<XdmfMap> > XdmfMap::New(const std::vector<boost::s
boost::shared_ptr<XdmfMap> map = XdmfMap::New();
toReturn.push_back(map);
const boost::shared_ptr<XdmfAttribute> currGlobalNodeIds = globalNodeIds[i];
for(unsigned int j=0; j<currGlobalNodeIds->size(); ++j)
for(unsigned int j=0; j<currGlobalNodeIds->getSize(); ++j)
{
unsigned int currGlobalNodeId = currGlobalNodeIds->getValueCopy<unsigned int>(j);
unsigned int currGlobalNodeId = currGlobalNodeIds->getValue<unsigned int>(j);
if(globalNodeIdMap[currGlobalNodeId].size() > 1)
{
for(std::map<unsigned int, unsigned int>::const_iterator iter = globalNodeIdMap[currGlobalNodeId].begin(); iter != globalNodeIdMap[currGlobalNodeId].end(); ++iter)
......@@ -148,6 +148,7 @@ bool XdmfMap::isInitialized() const
void XdmfMap::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
std::vector<boost::shared_ptr<XdmfArray> > arrayVector;
arrayVector.reserve(3);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
......@@ -158,7 +159,7 @@ void XdmfMap::populateItem(const std::map<std::string, std::string> & itemProper
}
}
assert(arrayVector.size() == 3);
assert(arrayVector[0]->size() == arrayVector[1]->size() && arrayVector[0]->size() == arrayVector[2]->size());
assert(arrayVector[0]->getSize() == arrayVector[1]->getSize() && arrayVector[0]->getSize() == arrayVector[2]->getSize());
bool needToRead = false;
for(std::vector<boost::shared_ptr<XdmfArray> >::const_iterator iter = arrayVector.begin(); iter != arrayVector.end(); ++iter)
{
......@@ -174,9 +175,9 @@ void XdmfMap::populateItem(const std::map<std::string, std::string> & itemProper
{
(*iter)->read();
}
for(unsigned int i=0; i<arrayVector[0]->size(); ++i)
for(unsigned int i=0; i<arrayVector[0]->getSize(); ++i)
{
this->insert(arrayVector[0]->getValueCopy<unsigned int>(i), arrayVector[1]->getValueCopy<unsigned int>(i), arrayVector[2]->getValueCopy<unsigned int>(i));
this->insert(arrayVector[0]->getValue<unsigned int>(i), arrayVector[1]->getValue<unsigned int>(i), arrayVector[2]->getValue<unsigned int>(i));
}
}
else
......@@ -191,7 +192,7 @@ void XdmfMap::read()
{
if(mImpl->mLocalNodeIdsHDF5Controller && mImpl->mRemoteTaskIdsHDF5Controller && mImpl->mRemoteLocalNodeIdsHDF5Controller)
{
assert(mImpl->mLocalNodeIdsHDF5Controller->size() == mImpl->mRemoteTaskIdsHDF5Controller->size() && mImpl->mLocalNodeIdsHDF5Controller->size() == mImpl->mRemoteLocalNodeIdsHDF5Controller->size());
assert(mImpl->mLocalNodeIdsHDF5Controller->getSize() == mImpl->mRemoteTaskIdsHDF5Controller->getSize() && mImpl->mLocalNodeIdsHDF5Controller->getSize() == mImpl->mRemoteLocalNodeIdsHDF5Controller->getSize());
boost::shared_ptr<XdmfArray> globalNodeIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> taskIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> localNodeIds = XdmfArray::New();
......@@ -199,18 +200,18 @@ void XdmfMap::read()
mImpl->mRemoteTaskIdsHDF5Controller->read(taskIds.get());
mImpl->mRemoteLocalNodeIdsHDF5Controller->read(localNodeIds.get());
for(unsigned int i=0; i<globalNodeIds->size(); ++i)
for(unsigned int i=0; i<globalNodeIds->getSize(); ++i)
{
std::map<unsigned int, std::map<unsigned int, unsigned int> >::iterator iter = mImpl->mMap.find(globalNodeIds->getValueCopy<unsigned int>(i));
std::map<unsigned int, std::map<unsigned int, unsigned int> >::iterator iter = mImpl->mMap.find(globalNodeIds->getValue<unsigned int>(i));
if(iter != mImpl->mMap.end())
{
iter->second[taskIds->getValueCopy<unsigned int>(i)] = localNodeIds->getValueCopy<unsigned int>(i);
iter->second[taskIds->getValue<unsigned int>(i)] = localNodeIds->getValue<unsigned int>(i);
}
else
{
std::map<unsigned int, unsigned int> newMap;
newMap[taskIds->getValueCopy<unsigned int>(i)] = localNodeIds->getValueCopy<unsigned int>(i);
mImpl->mMap[globalNodeIds->getValueCopy<unsigned int>(i)] = newMap;
newMap[taskIds->getValue<unsigned int>(i)] = localNodeIds->getValue<unsigned int>(i);
mImpl->mMap[globalNodeIds->getValue<unsigned int>(i)] = newMap;
}
}
}
......@@ -223,7 +224,7 @@ void XdmfMap::release()
void XdmfMap::setHDF5Controllers(boost::shared_ptr<XdmfHDF5Controller> localNodeIdsHDF5Controller, boost::shared_ptr<XdmfHDF5Controller> remoteTaskIdsHDF5Controller, boost::shared_ptr<XdmfHDF5Controller> remoteLocalNodeIdsHDF5Controller)
{
assert(localNodeIdsHDF5Controller->size() == remoteTaskIdsHDF5Controller->size() && localNodeIdsHDF5Controller->size() == remoteLocalNodeIdsHDF5Controller->size());
assert(localNodeIdsHDF5Controller->getSize() == remoteTaskIdsHDF5Controller->getSize() && localNodeIdsHDF5Controller->getSize() == remoteLocalNodeIdsHDF5Controller->getSize());
mImpl->mLocalNodeIdsHDF5Controller = localNodeIdsHDF5Controller;
mImpl->mRemoteTaskIdsHDF5Controller = remoteTaskIdsHDF5Controller;
mImpl->mRemoteLocalNodeIdsHDF5Controller = remoteLocalNodeIdsHDF5Controller;
......@@ -232,6 +233,7 @@ void XdmfMap::setHDF5Controllers(boost::shared_ptr<XdmfHDF5Controller> localNode
void XdmfMap::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfItem::traverse(visitor);
boost::shared_ptr<XdmfArray> localNodeIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> remoteTaskIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> remoteLocalNodeIds = XdmfArray::New();
......
......@@ -36,6 +36,8 @@ public:
std::string getItemTag() const;
using XdmfItem::insert;
void insert(const unsigned int localNodeId, const unsigned int remoteTaskId, const unsigned int remoteLocalNodeId);
/**
......
......@@ -18,7 +18,7 @@ boost::shared_ptr<XdmfSet> XdmfSet::New()
XdmfSet::XdmfSet() :
mName(""),
mSetType(XdmfSetType::NoSetType())
mType(XdmfSetType::NoSetType())
{
}
......@@ -63,7 +63,7 @@ std::map<std::string, std::string> XdmfSet::getItemProperties() const
{
std::map<std::string, std::string> setProperties;
setProperties["Name"] = mName;
mSetType->getProperties(setProperties);
mType->getProperties(setProperties);
return setProperties;
}
......@@ -84,7 +84,7 @@ unsigned int XdmfSet::getNumberAttributes() const
boost::shared_ptr<const XdmfSetType> XdmfSet::getType() const
{
return mSetType;
return mType;
}
void XdmfSet::insert(const boost::shared_ptr<XdmfAttribute> attribute)
......@@ -94,6 +94,7 @@ void XdmfSet::insert(const boost::shared_ptr<XdmfAttribute> attribute)
void XdmfSet::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
if(name != itemProperties.end())
{
......@@ -103,7 +104,7 @@ void XdmfSet::populateItem(const std::map<std::string, std::string> & itemProper
{
assert(false);
}
mSetType = XdmfSetType::New(itemProperties);
mType = XdmfSetType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
{
if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
......@@ -141,17 +142,17 @@ void XdmfSet::removeAttribute(const std::string & name)
void XdmfSet::setName(const std::string & name)
{
mName= name;
mName = name;
}
void XdmfSet::setType(const boost::shared_ptr<const XdmfSetType> setType)
void XdmfSet::setType(const boost::shared_ptr<const XdmfSetType> type)
{
mSetType = setType;
mType = type;
}
void XdmfSet::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfArray::traverse(visitor);
XdmfItem::traverse(visitor);
for(std::vector<boost::shared_ptr<XdmfAttribute> >::const_iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter)
{
(*iter)->accept(visitor);
......
......@@ -90,6 +90,9 @@ public:
*/
boost::shared_ptr<const XdmfSetType> getType() const;
using XdmfArray::insert;
using XdmfItem::insert;
/**
* Insert an attribute into the set.
*
......@@ -123,7 +126,7 @@ public:
*
* @param setType the XdmfSetType to set.
*/
void setType(const boost::shared_ptr<const XdmfSetType> setType);
void setType(const boost::shared_ptr<const XdmfSetType> type);
void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
......@@ -139,7 +142,7 @@ private:
std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes;
std::string mName;
boost::shared_ptr<const XdmfSetType> mSetType;
boost::shared_ptr<const XdmfSetType> mType;
};
#endif /* XDMFSET_HPP_ */
......@@ -46,6 +46,7 @@ double XdmfTime::getValue() const
void XdmfTime::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
std::map<std::string, std::string>::const_iterator value = itemProperties.find("Value");
if(value != itemProperties.end())
{
......
......@@ -16,7 +16,7 @@ boost::shared_ptr<XdmfTopology> XdmfTopology::New()
}
XdmfTopology::XdmfTopology() :
mTopologyType(XdmfTopologyType::NoTopologyType())
mType(XdmfTopologyType::NoTopologyType())
{
}
......@@ -34,8 +34,8 @@ std::string XdmfTopology::getItemTag() const
std::map<std::string, std::string> XdmfTopology::getItemProperties() const
{
std::map<std::string, std::string> topologyProperties;
mTopologyType->getProperties(topologyProperties);
if(mTopologyType != XdmfTopologyType::Polyvertex())
mType->getProperties(topologyProperties);
if(mType != XdmfTopologyType::Polyvertex())
{
std::stringstream numElements;
numElements << this->getNumberElements();
......@@ -46,21 +46,22 @@ std::map<std::string, std::string> XdmfTopology::getItemProperties() const
unsigned int XdmfTopology::getNumberElements() const
{
if(mTopologyType->getNodesPerElement() == 0)
if(mType->getNodesPerElement() == 0)
{
return 0;
}
return this->size() / mTopologyType->getNodesPerElement();
return this->getSize() / mType->getNodesPerElement();
}
boost::shared_ptr<const XdmfTopologyType> XdmfTopology::getType() const
{
return mTopologyType;
return mType;
}
void XdmfTopology::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
mTopologyType = XdmfTopologyType::New(itemProperties);
XdmfItem::populateItem(itemProperties, childItems, reader);
mType = XdmfTopologyType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
{
if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
......@@ -71,7 +72,7 @@ void XdmfTopology::populateItem(const std::map<std::string, std::string> & itemP
}
}
void XdmfTopology::setType(const boost::shared_ptr<const XdmfTopologyType> topologyType)
void XdmfTopology::setType(const boost::shared_ptr<const XdmfTopologyType> type)
{
mTopologyType = topologyType;
mType = type;
}
......@@ -53,7 +53,7 @@ public:
*
* @param topologyType the XdmfTopologyType to set.
*/
void setType(const boost::shared_ptr<const XdmfTopologyType> topologyType);
void setType(const boost::shared_ptr<const XdmfTopologyType> type);
protected:
......@@ -65,7 +65,7 @@ private:
XdmfTopology(const XdmfTopology & topology); // Not implemented.
void operator=(const XdmfTopology & topology); // Not implemented.
boost::shared_ptr<const XdmfTopologyType> mTopologyType;
boost::shared_ptr<const XdmfTopologyType> mType;
};
#endif /* XDMFTOPOLOGY_HPP_ */
......@@ -198,9 +198,9 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::ThreeDCoRectMesh()
}
XdmfTopologyType::XdmfTopologyType(const int& nodesPerElement, const std::string& name, const CellType& cellType) :
mNodesPerElement(nodesPerElement),
mCellType(cellType),
mName(name),
mCellType(cellType)
mNodesPerElement(nodesPerElement)
{
}
......