Commit 4d392806 authored by Kenneth Leiter's avatar Kenneth Leiter

STYLE: Transition to friendlier formatting style.

Hopefully this will become a standard style for Xdmf development.
All spaces - 80 character line wrapping.
parent 3f126cb1
core/XdmfVersion.hpp
core/XdmfVersion.cpp
......@@ -49,7 +49,7 @@ MACRO(VersionWrite vProjectName export_name)
FOREACH(il ${include_list})
SET(includes "${includes}\n\#include \"${il}\"")
ENDFOREACH(il ${include_list})
FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${vProjectName}Version.hpp
FILE(WRITE ${CMAKE_BINARY_DIR}/${vProjectName}Version.hpp
"/* Current Version of ${vProjectName}
* Major is: ${vMajor}
* Minor is: ${vMinor}
......@@ -59,7 +59,7 @@ ${includes}
extern ${export_name} ProjectVersion ${vProjectName}Version;\n"
)
FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${vProjectName}Version.cpp
FILE(WRITE ${CMAKE_BINARY_DIR}/${vProjectName}Version.cpp
"/* Current Version of ${vProjectName}
* Make sure to include this file in your built sources
*/
......
This diff is collapsed.
#ifndef _XDMF_HPP
#define _XDMF_HPP
/* Keep all our Win32 Conversions here */
#ifdef _WIN32
/* Used to export/import from the dlls */
#undef XDMFCORE_EXPORT
#define XDMFCORE_EXPORT __declspec(dllimport)
#undef XDMFCORE_TEMPLATE
#define XDMFCORE_TEMPLATE extern
#ifdef Xdmf_EXPORTS
#define XDMF_EXPORT __declspec(dllexport)
#define XDMF_TEMPLATE
#else /* Xdmf_EXPORTS */
#define XDMF_EXPORT __declspec(dllimport)
#define XDMF_TEMPLATE extern
#endif /* Xdmf_EXPORTS */
/* Compiler Warnings */
#ifndef XDMF_DEBUG
#pragma warning( disable : 4231 ) /* nonstandard extension used : 'extern' before template explicit instantiation */
#pragma warning( disable : 4251 ) /* needs to have dll-interface to be used by clients (Most of these guys are in private */
#pragma warning( disable : 4275 ) /* non dll-interface class 'std::_Container_base_aux' used as base for dll-interface class */
#pragma warning( disable : 4373 ) /* virtual function overrides, parameters only differed by const/volatile qualifiers */
#pragma warning( disable : 4748 ) /* /GS can not protect parameters and local variables from local buffer overrun (turned off op)*/
#endif /* XDMF_DEBUG */
/* Compiler Optimizations will result in an 'internal compiler error', so turn them off */
#pragma optimize("g", off)
/* Keep all our Win32 Conversions here */
#ifdef _WIN32
/* Used to export/import from the dlls */
#undef XDMFCORE_EXPORT
#define XDMFCORE_EXPORT __declspec(dllimport)
#undef XDMFCORE_TEMPLATE
#define XDMFCORE_TEMPLATE extern
#else /* _WIN32 */
/* We don't need to export/import since there are no dlls */
#define XDMFCORE_EXPORT
#define XDMF_EXPORT
#define XDMFCORE_TEMPLATE
#define XDMF_TEMPLATE
#endif /* _WIN32 */
#ifdef Xdmf_EXPORTS
#define XDMF_EXPORT __declspec(dllexport)
#define XDMF_TEMPLATE
#else /* Xdmf_EXPORTS */
#define XDMF_EXPORT __declspec(dllimport)
#define XDMF_TEMPLATE extern
#endif /* Xdmf_EXPORTS */
/* Compiler Warnings */
#ifndef XDMF_DEBUG
#pragma warning( disable : 4231 ) /* nonstandard extension used : 'extern' before template explicit instantiation */
#pragma warning( disable : 4251 ) /* needs to have dll-interface to be used by clients (Most of these guys are in private */
#pragma warning( disable : 4275 ) /* non dll-interface class 'std::_Container_base_aux' used as base for dll-interface class */
#pragma warning( disable : 4373 ) /* virtual function overrides, parameters only differed by const/volatile qualifiers */
#pragma warning( disable : 4748 ) /* /GS can not protect parameters and local variables from local buffer overrun (turned off op)*/
#endif /* XDMF_DEBUG */
/* Compiler Optimizations will result in an 'internal compiler error', so turn them off */
#pragma optimize("g", off)
#else /* _WIN32 */
/* We don't need to export/import since there are no dlls */
#define XDMFCORE_EXPORT
#define XDMF_EXPORT
#define XDMFCORE_TEMPLATE
#define XDMF_TEMPLATE
#endif /* _WIN32 */
#endif /* _XDMF_HPP */
This diff is collapsed.
......@@ -9,16 +9,17 @@
#include "XdmfAttributeCenter.hpp"
#include "XdmfAttributeType.hpp"
boost::shared_ptr<XdmfAttribute> XdmfAttribute::New()
boost::shared_ptr<XdmfAttribute>
XdmfAttribute::New()
{
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
}
XdmfAttribute::XdmfAttribute() :
mCenter(XdmfAttributeCenter::Grid()),
mName(""),
mType(XdmfAttributeType::NoAttributeType())
mCenter(XdmfAttributeCenter::Grid()),
mName(""),
mType(XdmfAttributeType::NoAttributeType())
{
}
......@@ -28,70 +29,84 @@ XdmfAttribute::~XdmfAttribute()
const std::string XdmfAttribute::ItemTag = "Attribute";
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttribute::getCenter() const
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttribute::getCenter() const
{
return mCenter;
return mCenter;
}
std::map<std::string, std::string> XdmfAttribute::getItemProperties() const
std::map<std::string, std::string>
XdmfAttribute::getItemProperties() const
{
std::map<std::string, std::string> attributeProperties;
attributeProperties["Name"] = mName;
mType->getProperties(attributeProperties);
mCenter->getProperties(attributeProperties);
return attributeProperties;
std::map<std::string, std::string> attributeProperties;
attributeProperties["Name"] = mName;
mType->getProperties(attributeProperties);
mCenter->getProperties(attributeProperties);
return attributeProperties;
}
std::string XdmfAttribute::getItemTag() const
std::string
XdmfAttribute::getItemTag() const
{
return ItemTag;
return ItemTag;
}
std::string XdmfAttribute::getName() const
std::string
XdmfAttribute::getName() const
{
return mName;
return mName;
}
boost::shared_ptr<const XdmfAttributeType> XdmfAttribute::getType() const
boost::shared_ptr<const XdmfAttributeType>
XdmfAttribute::getType() const
{
return mType;
return mType;
}
void XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
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())
{
mName = name->second;
}
else
{
assert(false);
}
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))
{
this->swap(array);
}
// TODO: If multiple dataitems.
}
XdmfItem::populateItem(itemProperties, childItems, reader);
std::map<std::string, std::string>::const_iterator name =
itemProperties.find("Name");
if(name != itemProperties.end()) {
mName = name->second;
}
else {
assert(false);
}
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)) {
this->swap(array);
}
// TODO: If multiple dataitems.
}
}
void XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center)
void
XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center)
{
mCenter = center;
mCenter = center;
}
void XdmfAttribute::setName(const std::string & name)
void
XdmfAttribute::setName(const std::string & name)
{
mName= name;
mName= name;
}
void XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> type)
void
XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> type)
{
mType = type;
mType = type;
}
......@@ -10,92 +10,100 @@ class XdmfAttributeType;
#include "XdmfArray.hpp"
/**
* @brief Handles computed values attached to an XdmfGrid.
* @brief Holds values located at specific parts of an XdmfGrid.
*
* XdmfAttribute contains two properties that should be set, XdmfAttributeCenter and XdmfAttributeType.
* XdmfAttribute is a subclass of XdmfDataItem, meaning it contains an XdmfArray to store values.
* XdmfAttribute holds values centered at specific locations of an XdmfGrid.
* An attribute contains two properties that should be set,
* XdmfAttributeCenter, which describes where the values are centered, and
* XdmfAttributeType, which describes what types of values the attribute
* contains.
*/
class XDMF_EXPORT XdmfAttribute : public XdmfArray {
public:
/**
* Create a new XdmfAttribute.
*
* @return constructed XdmfAttribute.
*/
static boost::shared_ptr<XdmfAttribute> New();
virtual ~XdmfAttribute();
LOKI_DEFINE_VISITABLE(XdmfAttribute, XdmfArray)
static const std::string ItemTag;
/**
* Get the XdmfAttributeCenter associated with this attribute.
*
* @return XdmfAttributeCenter of the attribute.
*/
boost::shared_ptr<const XdmfAttributeCenter> getCenter() const;
std::map<std::string, std::string> getItemProperties() const;
std::string getItemTag() const;
/**
* Get the name of the attribute.
*
* @return a string containing the name of the attribute.
*/
std::string getName() const;
/**
* Get the XdmfAttributeType associated with this attribute.
*
* @return XdmfAttributeType of the attribute.
*/
boost::shared_ptr<const XdmfAttributeType> getType() const;
/**
* Set the XdmfAttributeCenter associated with this attribute.
*
* @param center the XdmfAttributeCenter to set.
*/
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center);
/**
* Set the name of the attribute.
*
* @param name a string containing the name to set.
*/
void setName(const std::string & name);
/**
* Set the XdmfAttributeType associated with this attribute.
*
* @param type XdmfAttributeType to set.
*/
void setType(const boost::shared_ptr<const XdmfAttributeType> type);
protected:
XdmfAttribute();
virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader);
private:
XdmfAttribute(const XdmfAttribute &); // Not implemented.
void operator=(const XdmfAttribute &); // Not implemented.
boost::shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName;
boost::shared_ptr<const XdmfAttributeType> mType;
public:
/**
* Create a new XdmfAttribute.
*
* @return constructed XdmfAttribute.
*/
static boost::shared_ptr<XdmfAttribute> New();
virtual ~XdmfAttribute();
LOKI_DEFINE_VISITABLE(XdmfAttribute, XdmfArray);
static const std::string ItemTag;
/**
* Get the XdmfAttributeCenter associated with this attribute.
*
* @return XdmfAttributeCenter of the attribute.
*/
boost::shared_ptr<const XdmfAttributeCenter> getCenter() const;
std::map<std::string, std::string> getItemProperties() const;
std::string getItemTag() const;
/**
* Get the name of the attribute.
*
* @return a string containing the name of the attribute.
*/
std::string getName() const;
/**
* Get the XdmfAttributeType associated with this attribute.
*
* @return XdmfAttributeType of the attribute.
*/
boost::shared_ptr<const XdmfAttributeType> getType() const;
/**
* Set the XdmfAttributeCenter associated with this attribute.
*
* @param center the XdmfAttributeCenter to set.
*/
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center);
/**
* Set the name of the attribute.
*
* @param name a string containing the name to set.
*/
void setName(const std::string & name);
/**
* Set the XdmfAttributeType associated with this attribute.
*
* @param type XdmfAttributeType to set.
*/
void setType(const boost::shared_ptr<const XdmfAttributeType> type);
protected:
XdmfAttribute();
virtual void
populateItem(const std::map<std::string, std::string> & itemProperties,
std::vector<boost::shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader);
private:
XdmfAttribute(const XdmfAttribute &); // Not implemented.
void operator=(const XdmfAttribute &); // Not implemented.
boost::shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName;
boost::shared_ptr<const XdmfAttributeType> mType;
};
#ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<const XdmfAttributeType>;
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<const XdmfAttributeCenter>;
XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeType>;
XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeCenter>;
#endif
#endif /* XDMFATTRIBUTE_HPP_ */
......@@ -8,38 +8,48 @@
#include "XdmfAttributeCenter.hpp"
// Supported XdmfAttributeCenters
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::Grid()
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Grid()
{
static boost::shared_ptr<const XdmfAttributeCenter> p(new XdmfAttributeCenter("Grid"));
return p;
static boost::shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Grid"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::Cell()
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Cell()
{
static boost::shared_ptr<const XdmfAttributeCenter> p(new XdmfAttributeCenter("Cell"));
return p;
static boost::shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Cell"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::Face()
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Face()
{
static boost::shared_ptr<const XdmfAttributeCenter> p(new XdmfAttributeCenter("Face"));
return p;
static boost::shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Face"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::Edge()
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Edge()
{
static boost::shared_ptr<const XdmfAttributeCenter> p(new XdmfAttributeCenter("Edge"));
return p;
static boost::shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Edge"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::Node()
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Node()
{
static boost::shared_ptr<const XdmfAttributeCenter> p(new XdmfAttributeCenter("Node"));
return p;
static boost::shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Node"));
return p;
}
XdmfAttributeCenter::XdmfAttributeCenter(const std::string & name) :
mName(name)
mName(name)
{
}
......@@ -47,42 +57,38 @@ XdmfAttributeCenter::~XdmfAttributeCenter()
{
}
boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperties)
boost::shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperties)
{
std::map<std::string, std::string>::const_iterator center = itemProperties.find("Center");
if(center != itemProperties.end())
{
const std::string centerVal = center->second;
if(centerVal.compare("Grid") == 0)
{
return Grid();
}
else if(centerVal.compare("Cell") == 0)
{
return Cell();
}
else if(centerVal.compare("Face") == 0)
{
return Face();
}
else if(centerVal.compare("Edge") == 0)
{
return Edge();
}
else if(centerVal.compare("Node") == 0)
{
return Node();
}
else
{
assert(false);
}
}
assert(false);
return boost::shared_ptr<const XdmfAttributeCenter>();
std::map<std::string, std::string>::const_iterator center =
itemProperties.find("Center");
if(center != itemProperties.end()) {
const std::string centerVal = center->second;
if(centerVal.compare("Grid") == 0) {
return Grid();
}
else if(centerVal.compare("Cell") == 0) {
return Cell();
}
else if(centerVal.compare("Face") == 0) {
return Face();
}
else if(centerVal.compare("Edge") == 0) {
return Edge();
}
else if(centerVal.compare("Node") == 0) {
return Node();
}
else {
assert(false);
}
}
assert(false);
return boost::shared_ptr<const XdmfAttributeCenter>();
}
void XdmfAttributeCenter::getProperties(std::map<std::string, std::string> & collectedProperties) const
void
XdmfAttributeCenter::getProperties(std::map<std::string, std::string> & collectedProperties) const
{
collectedProperties["Center"] = mName;
collectedProperties["Center"] = mName;
}
......@@ -8,54 +8,58 @@
/**
* @brief Property describing where XdmfAttribute values are centered.
*
* XdmfAttributeCenter is a property used by XdmfAttribute to specify where its values are centered
* on the XdmfGrid. A specific XdmfAttributeCenter can be created by calling on of the static methods
* in the class, i.e. XdmfAttributeCenter::Cell().
* XdmfAttributeCenter is a property used by XdmfAttribute to specify 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:
* Grid
* Cell
* Face
* Edge
* Node
* Grid
* Cell
* Face
* Edge
* Node
*/
class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
public:
public:
virtual ~XdmfAttributeCenter();
virtual ~XdmfAttributeCenter();
friend class XdmfAttribute;
friend class XdmfAttribute;
// Supported Xdmf Attribute Centers
static boost::shared_ptr<const XdmfAttributeCenter> Grid();
static boost::shared_ptr<const XdmfAttributeCenter> Cell();
static boost::shared_ptr<const XdmfAttributeCenter> Face();
static boost::shared_ptr<const XdmfAttributeCenter> Edge();
static boost::shared_ptr<const XdmfAttributeCenter> Node();
// Supported Xdmf Attribute Centers
static boost::shared_ptr<const XdmfAttributeCenter> Grid();
static boost::shared_ptr<const XdmfAttributeCenter> Cell();
static boost::shared_ptr<const XdmfAttributeCenter> Face();
static boost::shared_ptr<const XdmfAttributeCenter> Edge();
static boost::shared_ptr<const XdmfAttributeCenter> Node();
void getProperties(std::map<std::string, std::string> & collectedProperties) const;
void
getProperties(std::map<std::string, std::string> & collectedProperties) const;
protected:
protected:
/**
* Protected constructor for XdmfAttributeCenter. The constructor is protected because all attribute centers supported
* by Xdmf should be accessed through more specific static methods that construct XdmfAttributeCenters - i.e.
* XdmfAttributeCenter::Node().
*
* @param name the name of the XdmfAttributeCenter to construct.
*/
XdmfAttributeCenter(const std::string & name);
/**
* Protected constructor for XdmfAttributeCenter. The constructor is
* protected because all attribute centers supported by Xdmf should be
* accessed through more specific static methods that construct
* XdmfAttributeCenters - i.e. XdmfAttributeCenter::Node().
*
* @param name the name of the XdmfAttributeCenter to construct.
*/
XdmfAttributeCenter(const std::string & name);
private:
private:
XdmfAttributeCenter(const XdmfAttributeCenter & attributeCenter); // Not implemented.
void operator=(const XdmfAttributeCenter & attributeCenter); // Not implemented.
XdmfAttributeCenter(const XdmfAttributeCenter &); // Not implemented.
void operator=(const XdmfAttributeCenter &); // Not implemented.
static boost::shared_ptr<const XdmfAttributeCenter> New(const std::map<std::string, std::string> & itemProperties);
static boost::shared_ptr<const XdmfAttributeCenter>
New(const std::map<std::string, std::string> & itemProperties);
std::string mName;
std::string mName;
};
#endif /* XDMFATTRIBUTECENTER_HPP_ */
......@@ -8,50 +8,64 @@
#include "XdmfAttributeType.hpp"
// Supported XdmfAttributeTypes
boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::NoAttributeType()
boost::shared_ptr<const XdmfAttributeType>
XdmfAttributeType::NoAttributeType()
{
static boost::shared_ptr<const XdmfAttributeType> p(new XdmfAttributeType("None"));
return p;
static boost::shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("None"));
return p;
}
boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::Scalar()
boost::shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Scalar()
{
static boost::shared_ptr<const XdmfAttributeType> p(new XdmfAttributeType("Scalar"));
return p;
static boost::shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Scalar"));
return p;
}