Commit d642a8c3 authored by David E. DeMarle's avatar David E. DeMarle

Merge branch 'michal/add-finite-element-function' into 'master'

Add FiniteElementFunction as new Attribute ItemType

See merge request !41
parents 701d36d4 0ccaf3a1
......@@ -55,14 +55,18 @@
Format (XML | HDF | Binary | TIFF) "XML"
>
<!--Describes the values on the mesh-->
<!ELEMENT Attribute (Information*, DataItem)>
<!ELEMENT Attribute (Information*, DataItem*)>
<!ATTLIST Attribute
Name CDATA #IMPLIED
Center (Node | Cell | Grid | Face | Edge) "Node"
Center (Node | Cell | Grid | Face | Edge | Other) "Node"
AttributeType (Scalar | Vector | Tensor | Tensor6 | Matrix) "Scalar"
ItemType (FiniteElementFunction) #IMPLIED
ElementFamily (CG | DG | RT | BDM | CR | N1curl | N2curl) #IMPLIED
ElementDegree CDATA #IMPLIED
ElementCell CDATA #IMPLIED
>
<!--Describes subsections of a grid-->
<!ELEMENT Set (Information*, DataItem)>
<!ELEMENT Set (Information*, DataItem*, Attribute)>
<!ATTLIST Set
Name CDATA #IMPLIED
Type (NoSetType | Node | Cell | Face | Edge) "Node"
......
This diff is collapsed.
......@@ -70,8 +70,15 @@ public:
virtual ~XdmfAttribute();
LOKI_DEFINE_VISITABLE(XdmfAttribute, XdmfArray)
XDMF_CHILDREN(XdmfAttribute, XdmfArray, AuxiliaryArray, Name)
static const std::string ItemTag;
using XdmfArray::insert;
#if defined(SWIG)
using XdmfItem::insert;
#endif
/**
* Get the XdmfAttributeCenter associated with this attribute.
*
......@@ -163,6 +170,34 @@ public:
*/
shared_ptr<const XdmfAttributeType> getType() const;
/**
* Get the ItemType associated with this attribute.
*
* @return ItemType of the attribute.
*/
std::string getItemType() const;
/**
* Get the ElementFamily associated with this attribute.
*
* @return ElementFamily of the attribute.
*/
std::string getElementFamily() const;
/**
* Get the ElementDegree associated with this attribute.
*
* @return ElementDegree of the attribute.
*/
unsigned int getElementDegree() const;
/**
* Get the ElementCell associated with this attribute.
*
* @return ElementCell of the attribute.
*/
std::string getElementCell() const;
/**
* Set the XdmfAttributeCenter associated with this attribute.
*
......@@ -238,8 +273,38 @@ public:
*/
void setType(const shared_ptr<const XdmfAttributeType> type);
/**
* Set the ItemType associated with this attribute.
*
* @param type ItemType to set.
*/
void setItemType(std::string type);
/**
* Set the ElementFamily associated with this attribute.
*
* @param type ElementFamily to set.
*/
void setElementFamily(std::string type);
/**
* Set the ElementDegree associated with this attribute.
*
* @param type ElementDegree to set.
*/
void setElementDegree(unsigned int degree);
/**
* Set the ElementCell associated with this attribute.
*
* @param type ElementCell to set.
*/
void setElementCell(std::string cell);
XdmfAttribute(XdmfAttribute &);
void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
protected:
XdmfAttribute();
......@@ -257,6 +322,11 @@ private:
shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName;
shared_ptr<const XdmfAttributeType> mType;
std::string mItemType;
unsigned int mElementDegree;
std::string mElementFamily;
std::string mElementCell;
};
#endif
......
......@@ -68,6 +68,14 @@ XdmfAttributeCenter::Node()
return p;
}
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Other()
{
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Other"));
return p;
}
void
XdmfAttributeCenter::InitTypes()
{
......@@ -76,6 +84,7 @@ XdmfAttributeCenter::InitTypes()
mAttributeCenterDefinitions["FACE"] = Face;
mAttributeCenterDefinitions["EDGE"] = Edge;
mAttributeCenterDefinitions["NODE"] = Node;
mAttributeCenterDefinitions["OTHER"] = Other;
}
XdmfAttributeCenter::XdmfAttributeCenter(const std::string & name) :
......@@ -105,16 +114,16 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
if (returnType == mAttributeCenterDefinitions.end()) {
XdmfError::message(XdmfError::FATAL,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New");
"Center not of 'Grid','Cell','Face','Edge','Node',"
"'Other' in XdmfAttributeCenter::New");
}
else {
return (*(returnType->second))();
}
XdmfError::message(XdmfError::FATAL,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New");
"Center not of 'Grid','Cell','Face','Edge','Node',"
"'Other' in XdmfAttributeCenter::New");
// unreachable
return shared_ptr<const XdmfAttributeCenter>();
......@@ -152,3 +161,8 @@ int XdmfAttributeCenterNode()
{
return XDMF_ATTRIBUTE_CENTER_NODE;
}
int XdmfAttributeCenterOther()
{
return XDMF_ATTRIBUTE_CENTER_OTHER;
}
\ No newline at end of file
......@@ -81,6 +81,7 @@ public:
static shared_ptr<const XdmfAttributeCenter> Face();
static shared_ptr<const XdmfAttributeCenter> Edge();
static shared_ptr<const XdmfAttributeCenter> Node();
static shared_ptr<const XdmfAttributeCenter> Other();
void
getProperties(std::map<std::string, std::string> & collectedProperties) const;
......@@ -127,12 +128,14 @@ extern "C" {
#define XDMF_ATTRIBUTE_CENTER_FACE 102
#define XDMF_ATTRIBUTE_CENTER_EDGE 103
#define XDMF_ATTRIBUTE_CENTER_NODE 104
#define XDMF_ATTRIBUTE_CENTER_OTHER 105
XDMF_EXPORT int XdmfAttributeCenterGrid();
XDMF_EXPORT int XdmfAttributeCenterCell();
XDMF_EXPORT int XdmfAttributeCenterFace();
XDMF_EXPORT int XdmfAttributeCenterEdge();
XDMF_EXPORT int XdmfAttributeCenterNode();
XDMF_EXPORT int XdmfAttributeCenterOther();
#ifdef __cplusplus
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment