Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CrayzeeWulf
Xdmf
Commits
8c4b7ddd
Commit
8c4b7ddd
authored
Sep 16, 2010
by
Kenneth Leiter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: Get reading of regular grids partially complete.
parent
c0e846fa
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
133 additions
and
64 deletions
+133
-64
XdmfGeometryType.cpp
XdmfGeometryType.cpp
+9
-18
XdmfGeometryType.hpp
XdmfGeometryType.hpp
+7
-2
XdmfGridRegular.cpp
XdmfGridRegular.cpp
+18
-1
XdmfGridRegular.hpp
XdmfGridRegular.hpp
+3
-3
XdmfItemFactory.cpp
XdmfItemFactory.cpp
+31
-13
XdmfItemFactory.hpp
XdmfItemFactory.hpp
+1
-1
XdmfTopology.cpp
XdmfTopology.cpp
+17
-1
XdmfTopology.hpp
XdmfTopology.hpp
+3
-0
XdmfTopologyType.cpp
XdmfTopologyType.cpp
+14
-13
XdmfTopologyType.hpp
XdmfTopologyType.hpp
+10
-3
core/XdmfCoreItemFactory.cpp
core/XdmfCoreItemFactory.cpp
+3
-4
core/XdmfCoreItemFactory.hpp
core/XdmfCoreItemFactory.hpp
+4
-1
core/XdmfCoreReader.cpp
core/XdmfCoreReader.cpp
+1
-1
tests/Cxx/CMakeLists.txt
tests/Cxx/CMakeLists.txt
+1
-0
tests/Cxx/TestXdmfGeometry.cpp
tests/Cxx/TestXdmfGeometry.cpp
+2
-0
tests/Cxx/TestXdmfGridRegular.cpp
tests/Cxx/TestXdmfGridRegular.cpp
+7
-3
tests/Cxx/TestXdmfTopology.cpp
tests/Cxx/TestXdmfTopology.cpp
+2
-0
No files found.
XdmfGeometryType.cpp
View file @
8c4b7ddd
...
...
@@ -44,24 +44,12 @@ boost::shared_ptr<const XdmfGeometryType> XdmfGeometryType::VXVYVZ()
return
p
;
}
boost
::
shared_ptr
<
const
XdmfGeometryType
>
XdmfGeometryType
::
Origin_DXDYDZ
()
{
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
p
(
new
XdmfGeometryType
(
"ORIGIN_DXDYDZ"
,
3
));
return
p
;
}
boost
::
shared_ptr
<
const
XdmfGeometryType
>
XdmfGeometryType
::
VXVY
()
{
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
p
(
new
XdmfGeometryType
(
"VXVY"
,
2
));
return
p
;
}
boost
::
shared_ptr
<
const
XdmfGeometryType
>
XdmfGeometryType
::
Origin_DXDY
()
{
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
p
(
new
XdmfGeometryType
(
"ORIGIN_DXDY"
,
2
));
return
p
;
}
XdmfGeometryType
::
XdmfGeometryType
(
const
std
::
string
&
name
,
const
int
&
dimensions
)
:
mDimensions
(
dimensions
),
mName
(
name
)
...
...
@@ -107,17 +95,15 @@ boost::shared_ptr<const XdmfGeometryType> XdmfGeometryType::New(const std::map<s
{
return
VXVYVZ
();
}
else
if
(
typeVal
.
compare
(
"ORIGIN_DXDYDZ"
)
==
0
)
{
return
Origin_DXDYDZ
();
}
else
if
(
typeVal
.
compare
(
"VXVY"
)
==
0
)
{
return
VXVY
();
}
else
if
(
typeVal
.
compare
(
"ORIGIN_DXDY"
)
==
0
)
else
if
(
typeVal
.
compare
(
"ORIGIN_DXDY"
)
==
0
||
typeVal
.
compare
(
"ORIGIN_DXDYDZ"
)
==
0
)
{
return
Origin_DXDY
();
// Special case --- Regular Grid
boost
::
shared_ptr
<
const
XdmfGeometryType
>
p
(
new
XdmfGeometryType
(
"REGULAR"
,
0
));
return
p
;
}
else
{
...
...
@@ -142,6 +128,11 @@ unsigned int XdmfGeometryType::getDimensions() const
return
mDimensions
;
}
std
::
string
XdmfGeometryType
::
getName
()
const
{
return
mName
;
}
void
XdmfGeometryType
::
getProperties
(
std
::
map
<
std
::
string
,
std
::
string
>
&
collectedProperties
)
const
{
collectedProperties
[
"Type"
]
=
mName
;
...
...
XdmfGeometryType.hpp
View file @
8c4b7ddd
...
...
@@ -37,9 +37,7 @@ public:
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
X_Y_Z
();
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
X_Y
();
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
VXVYVZ
();
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
Origin_DXDYDZ
();
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
VXVY
();
static
boost
::
shared_ptr
<
const
XdmfGeometryType
>
Origin_DXDY
();
/**
* Get the dimensions of this geometry type - i.e. XYZ = 3.
...
...
@@ -48,6 +46,13 @@ public:
*/
virtual
unsigned
int
getDimensions
()
const
;
/**
* Get the name of this geometry type.
*
* @return the name of this geometry type.
*/
std
::
string
getName
()
const
;
virtual
void
getProperties
(
std
::
map
<
std
::
string
,
std
::
string
>
&
collectedProperties
)
const
;
/*
...
...
XdmfGridRegular.cpp
View file @
8c4b7ddd
...
...
@@ -5,6 +5,7 @@
* Author: kleiter
*/
#include <boost/tokenizer.hpp>
#include <cmath>
#include "XdmfArray.hpp"
#include "XdmfGeometry.hpp"
...
...
@@ -160,7 +161,7 @@ public:
unsigned
int
getNodesPerElement
()
const
{
// 2
^
Dimensions
// 2
^
Dimensions
// e.g. 1D = 2 nodes per element and 2D = 4 nodes per element.
return
(
unsigned
int
)
std
::
pow
(
2
,
(
double
)
mRegularGrid
->
getDimensions
()
->
getSize
());
}
...
...
@@ -295,6 +296,22 @@ boost::shared_ptr<const XdmfArray> XdmfGridRegular::getOrigin() const
return
mImpl
->
mOrigin
;
}
void
XdmfGridRegular
::
populateItem
(
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
,
const
XdmfCoreReader
*
const
reader
)
{
XdmfGrid
::
populateItem
(
itemProperties
,
childItems
,
reader
);
mImpl
->
mOrigin
->
swap
(
this
->
getGeometry
());
mImpl
->
mBrickSize
->
swap
(
this
->
getGeometry
());
mImpl
->
mDimensions
->
clear
();
std
::
string
dimensions
=
this
->
getTopology
()
->
getDimensions
();
boost
::
tokenizer
<>
tokens
(
dimensions
);
for
(
boost
::
tokenizer
<>::
const_iterator
iter
=
tokens
.
begin
();
iter
!=
tokens
.
end
();
++
iter
)
{
mImpl
->
mDimensions
->
pushBack
<
unsigned
int
>
(
atoi
((
*
iter
).
c_str
()));
}
this
->
setGeometry
(
XdmfGridRegularImpl
::
XdmfGeometryRegular
::
New
(
this
));
this
->
setTopology
(
XdmfGridRegularImpl
::
XdmfTopologyRegular
::
New
(
this
));
}
void
XdmfGridRegular
::
setBrickSize
(
const
boost
::
shared_ptr
<
XdmfArray
>
brickSize
)
{
mImpl
->
mBrickSize
=
brickSize
;
...
...
XdmfGridRegular.hpp
View file @
8c4b7ddd
...
...
@@ -31,7 +31,7 @@ public:
* @return constructed structured grid.
*/
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
brickSizeX
,
const
double
brickSizeY
,
const
unsigned
int
numPointsX
,
const
unsigned
int
numPointsY
,
const
double
originX
=
0
,
const
double
originY
=
0
);
const
unsigned
int
numPointsY
,
const
double
originX
,
const
double
originY
);
/**
* Create a new structured grid (Three dimensional).
...
...
@@ -50,7 +50,7 @@ public:
*/
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
brickSizeX
,
const
double
brickSizeY
,
const
double
brickSizeZ
,
const
unsigned
int
numPointsX
,
const
unsigned
int
numPointsY
,
const
unsigned
int
numPointsZ
,
const
double
originX
=
0
,
const
double
originY
=
0
,
const
double
originZ
=
0
);
const
double
originX
,
const
double
originY
,
const
double
originZ
);
virtual
~
XdmfGridRegular
();
...
...
@@ -129,7 +129,7 @@ protected:
XdmfGridRegular
(
const
double
brickSizeX
,
const
double
brickSizeY
,
const
double
brickSizeZ
,
const
unsigned
int
numPointsX
,
const
unsigned
int
numPointsY
,
const
unsigned
int
numPointsZ
,
const
double
originX
,
const
double
originY
,
const
double
originZ
);
//virtual
void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader);
void
populateItem
(
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
,
const
XdmfCoreReader
*
const
reader
);
private:
...
...
XdmfItemFactory.cpp
View file @
8c4b7ddd
#include "XdmfAttribute.hpp"
#include "XdmfDomain.hpp"
#include "XdmfGeometry.hpp"
#include "XdmfGeometryType.hpp"
#include "XdmfGrid.hpp"
#include "XdmfGridCollection.hpp"
#include "XdmfGridRegular.hpp"
#include "XdmfInformation.hpp"
#include "XdmfItemFactory.hpp"
#include "XdmfMap.hpp"
...
...
@@ -24,9 +26,9 @@ XdmfItemFactory::~XdmfItemFactory()
{
}
boost
::
shared_ptr
<
XdmfItem
>
XdmfItemFactory
::
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
)
const
boost
::
shared_ptr
<
XdmfItem
>
XdmfItemFactory
::
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
const
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
)
const
{
boost
::
shared_ptr
<
XdmfItem
>
newItem
=
XdmfCoreItemFactory
::
createItem
(
itemTag
,
itemProperties
);
boost
::
shared_ptr
<
XdmfItem
>
newItem
=
XdmfCoreItemFactory
::
createItem
(
itemTag
,
itemProperties
,
childItems
);
if
(
newItem
)
{
...
...
@@ -35,47 +37,63 @@ boost::shared_ptr<XdmfItem> XdmfItemFactory::createItem(const std::string & item
if
(
itemTag
.
compare
(
XdmfAttribute
::
ItemTag
)
==
0
)
{
newItem
=
XdmfAttribute
::
New
();
return
XdmfAttribute
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfDomain
::
ItemTag
)
==
0
)
{
newItem
=
XdmfDomain
::
New
();
return
XdmfDomain
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfGeometry
::
ItemTag
)
==
0
)
{
newItem
=
XdmfGeometry
::
New
();
return
XdmfGeometry
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfGrid
::
ItemTag
)
==
0
)
{
// For backwards compatibility with the old format, this tag can correspond to multiple XdmfItems.
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
gridType
=
itemProperties
.
find
(
"GridType"
);
if
(
gridType
!=
itemProperties
.
end
()
&&
gridType
->
second
.
compare
(
"Collection"
)
==
0
)
{
newItem
=
XdmfGridCollection
::
New
();
return
XdmfGridCollection
::
New
();
}
else
{
newItem
=
XdmfGrid
::
New
();
// Find out what kind of grid we have
for
(
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
boost
::
shared_ptr
<
XdmfGeometry
>
geometry
=
boost
::
shared_dynamic_cast
<
XdmfGeometry
>
(
*
iter
))
{
if
(
geometry
->
getType
()
->
getName
().
compare
(
"REGULAR"
)
==
0
)
{
return
XdmfGridRegular
::
New
(
0
,
0
,
0
,
0
,
0
,
0
);
}
else
{
break
;
}
}
}
return
XdmfGrid
::
New
();
}
}
else
if
(
itemTag
.
compare
(
XdmfInformation
::
ItemTag
)
==
0
)
{
newItem
=
XdmfInformation
::
New
();
return
XdmfInformation
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfMap
::
ItemTag
)
==
0
)
{
newItem
=
XdmfMap
::
New
();
return
XdmfMap
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfSet
::
ItemTag
)
==
0
)
{
newItem
=
XdmfSet
::
New
();
return
XdmfSet
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfTime
::
ItemTag
)
==
0
)
{
newItem
=
XdmfTime
::
New
();
return
XdmfTime
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfTopology
::
ItemTag
)
==
0
)
{
newItem
=
XdmfTopology
::
New
();
return
XdmfTopology
::
New
();
}
return
new
Item
;
return
boost
::
shared_ptr
<
Xdmf
Item
>
()
;
}
XdmfItemFactory.hpp
View file @
8c4b7ddd
...
...
@@ -23,7 +23,7 @@ public:
virtual
~
XdmfItemFactory
();
virtual
boost
::
shared_ptr
<
XdmfItem
>
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
)
const
;
virtual
boost
::
shared_ptr
<
XdmfItem
>
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
const
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
)
const
;
protected:
...
...
XdmfTopology.cpp
View file @
8c4b7ddd
...
...
@@ -16,6 +16,7 @@ boost::shared_ptr<XdmfTopology> XdmfTopology::New()
}
XdmfTopology
::
XdmfTopology
()
:
mDimensions
(
""
),
mType
(
XdmfTopologyType
::
NoTopologyType
())
{
}
...
...
@@ -26,6 +27,17 @@ XdmfTopology::~XdmfTopology()
const
std
::
string
XdmfTopology
::
ItemTag
=
"Topology"
;
std
::
string
XdmfTopology
::
getDimensions
()
const
{
if
(
mDimensions
.
compare
(
""
)
==
0
)
{
std
::
stringstream
toReturn
;
toReturn
<<
this
->
getNumberElements
();
return
toReturn
.
str
();
}
return
mDimensions
;
}
std
::
string
XdmfTopology
::
getItemTag
()
const
{
return
ItemTag
;
...
...
@@ -62,6 +74,11 @@ void XdmfTopology::populateItem(const std::map<std::string, std::string> & itemP
{
XdmfItem
::
populateItem
(
itemProperties
,
childItems
,
reader
);
mType
=
XdmfTopologyType
::
New
(
itemProperties
);
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
dimensions
=
itemProperties
.
find
(
"Dimensions"
);
if
(
dimensions
!=
itemProperties
.
end
())
{
mDimensions
=
dimensions
->
second
;
}
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
))
...
...
@@ -75,5 +92,4 @@ void XdmfTopology::populateItem(const std::map<std::string, std::string> & itemP
void
XdmfTopology
::
setType
(
const
boost
::
shared_ptr
<
const
XdmfTopologyType
>
type
)
{
mType
=
type
;
}
XdmfTopology.hpp
View file @
8c4b7ddd
...
...
@@ -30,6 +30,8 @@ public:
LOKI_DEFINE_VISITABLE
(
XdmfTopology
,
XdmfArray
)
static
const
std
::
string
ItemTag
;
std
::
string
getDimensions
()
const
;
std
::
map
<
std
::
string
,
std
::
string
>
getItemProperties
()
const
;
std
::
string
getItemTag
()
const
;
...
...
@@ -65,6 +67,7 @@ private:
XdmfTopology
(
const
XdmfTopology
&
topology
);
// Not implemented.
void
operator
=
(
const
XdmfTopology
&
topology
);
// Not implemented.
std
::
string
mDimensions
;
boost
::
shared_ptr
<
const
XdmfTopologyType
>
mType
;
};
...
...
XdmfTopologyType.cpp
View file @
8c4b7ddd
...
...
@@ -210,7 +210,7 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::ThreeDCoRectMesh()
return p;
}*/
XdmfTopologyType
::
XdmfTopologyType
(
const
int
&
nodesPerElement
,
const
std
::
string
&
name
,
const
CellType
&
cellType
)
:
XdmfTopologyType
::
XdmfTopologyType
(
const
unsigned
int
nodesPerElement
,
const
std
::
string
&
name
,
const
CellType
cellType
)
:
mCellType
(
cellType
),
mName
(
name
),
mNodesPerElement
(
nodesPerElement
)
...
...
@@ -322,19 +322,20 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::New(const std::map<s
{
return
Mixed
();
}
/*
else if(typeVal.compare("2DSMESH") == 0)
/*else if(typeVal.compare("2DSMESH") == 0)
{
return TwoDSMesh();
}
else if(typeVal.compare("2DRECTMESH") == 0)
{
return TwoDRectMesh();
}
else if(typeVal.compare("2DCORECTMESH") == 0)
}
*/
else
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
)
{
return TwoDCoRectMesh();
}
// Special case --- Regular Grid
boost
::
shared_ptr
<
const
XdmfTopologyType
>
p
(
new
XdmfTopologyType
(
0
,
"REGULAR"
,
Structured
));
return
p
;
}
/*
else if(typeVal.compare("3DSMESH") == 0)
{
return ThreeDSMesh();
...
...
@@ -342,12 +343,7 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::New(const std::map<s
else if(typeVal.compare("3DRECTMESH") == 0)
{
return ThreeDRectMesh();
}
else if(typeVal.compare("3DCORECTMESH") == 0)
{
return ThreeDCoRectMesh();
}
*/
}*/
else
{
assert
(
false
);
...
...
@@ -371,6 +367,11 @@ XdmfTopologyType::CellType XdmfTopologyType::getCellType() const
return
mCellType
;
}
std
::
string
XdmfTopologyType
::
getName
()
const
{
return
mName
;
}
unsigned
int
XdmfTopologyType
::
getNodesPerElement
()
const
{
return
mNodesPerElement
;
...
...
XdmfTopologyType.hpp
View file @
8c4b7ddd
...
...
@@ -88,12 +88,19 @@ public:
//static boost::shared_ptr<const XdmfTopologyType> ThreeDCoRectMesh();
/**
* Get the cell type associated with this topology type
* Get the cell type associated with this topology type
.
*
* @return a CellType containing the cell type.
*/
CellType
getCellType
()
const
;
/**
* Get the name of this topology type.
*
* @return the name of this topology type.
*/
std
::
string
getName
()
const
;
/**
* Get the number of nodes per element associated with this topology type.
*
...
...
@@ -126,7 +133,7 @@ protected:
* by Xdmf should be accessed through more specific static methods that construct XdmfTopologyType -
* i.e. XdmfTopologyType::Tetrahedron()
*/
XdmfTopologyType
(
const
int
&
nodesPerElement
,
const
std
::
string
&
name
,
const
CellType
&
cellType
);
XdmfTopologyType
(
const
unsigned
int
nodesPerElement
,
const
std
::
string
&
name
,
const
CellType
cellType
);
private:
...
...
@@ -137,7 +144,7 @@ private:
CellType
mCellType
;
std
::
string
mName
;
int
mNodesPerElement
;
unsigned
int
mNodesPerElement
;
};
#endif
/* XDMFTOPOLOGYTYPE_HPP_ */
core/XdmfCoreItemFactory.cpp
View file @
8c4b7ddd
...
...
@@ -9,12 +9,11 @@ XdmfCoreItemFactory::~XdmfCoreItemFactory()
{
}
boost
::
shared_ptr
<
XdmfItem
>
XdmfCoreItemFactory
::
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
)
const
boost
::
shared_ptr
<
XdmfItem
>
XdmfCoreItemFactory
::
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
,
const
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
)
const
{
boost
::
shared_ptr
<
XdmfItem
>
newItem
=
boost
::
shared_ptr
<
XdmfItem
>
();
if
(
itemTag
.
compare
(
XdmfArray
::
ItemTag
)
==
0
)
{
newItem
=
XdmfArray
::
New
();
return
XdmfArray
::
New
();
}
return
newItem
;
return
boost
::
shared_ptr
<
XdmfItem
>
();
;
}
core/XdmfCoreItemFactory.hpp
View file @
8c4b7ddd
...
...
@@ -7,6 +7,7 @@ class XdmfItem;
// Includes
#include <boost/shared_ptr.hpp>
#include <map>
#include <vector>
/**
* @brief Factory that constructs XdmfItems using tags and properties.
...
...
@@ -24,9 +25,11 @@ public:
*
* @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.
*
* @return constructed XdmfItem. If no XdmfItem can be constructed, return NULL.
*/
virtual
boost
::
shared_ptr
<
XdmfItem
>
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
)
const
;
virtual
boost
::
shared_ptr
<
XdmfItem
>
createItem
(
const
std
::
string
&
itemTag
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
const
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
)
const
;
protected:
...
...
core/XdmfCoreReader.cpp
View file @
8c4b7ddd
...
...
@@ -129,7 +129,7 @@ public:
currAttribute
=
currAttribute
->
next
;
}
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
childItems
=
this
->
read
(
currNode
->
children
);
boost
::
shared_ptr
<
XdmfItem
>
newItem
=
mItemFactory
->
createItem
((
const
char
*
)
currNode
->
name
,
itemProperties
);
boost
::
shared_ptr
<
XdmfItem
>
newItem
=
mItemFactory
->
createItem
((
const
char
*
)
currNode
->
name
,
itemProperties
,
childItems
);
if
(
newItem
==
NULL
)
{
assert
(
false
);
...
...
tests/Cxx/CMakeLists.txt
View file @
8c4b7ddd
...
...
@@ -43,6 +43,7 @@ CLEAN_CXX_TEST(TestXdmfGridCollection
)
CLEAN_CXX_TEST
(
TestXdmfGridRegular
TestXdmfGridRegular1.xmf
TestXdmfGridRegular2.xmf
)
CLEAN_CXX_TEST
(
TestXdmfReader
TestXdmfReader1.h5
...
...
tests/Cxx/TestXdmfGeometry.cpp
View file @
8c4b7ddd
...
...
@@ -12,9 +12,11 @@ int main(int, char *)
boost
::
shared_ptr
<
XdmfGeometry
>
geometry
=
XdmfGeometry
::
New
();
assert
(
geometry
->
getType
()
==
XdmfGeometryType
::
NoGeometryType
());
assert
(
geometry
->
getType
()
->
getDimensions
()
==
0
);
assert
(
geometry
->
getType
()
->
getName
().
compare
(
"None"
)
==
0
);
geometry
->
setType
(
XdmfGeometryType
::
XYZ
());
assert
(
geometry
->
getType
()
==
XdmfGeometryType
::
XYZ
());
assert
(
geometry
->
getType
()
->
getDimensions
()
==
3
);
assert
(
geometry
->
getType
()
->
getName
().
compare
(
"XYZ"
)
==
0
);
return
0
;
}
tests/Cxx/TestXdmfGridRegular.cpp
View file @
8c4b7ddd
...
...
@@ -2,12 +2,11 @@
#include "XdmfGeometry.hpp"
#include "XdmfGeometryType.hpp"
#include "XdmfGridRegular.hpp"
#include "XdmfReader.hpp"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfWriter.hpp"
#include <iostream>
int
main
(
int
,
char
*
)
{
boost
::
shared_ptr
<
XdmfGridRegular
>
grid
=
XdmfGridRegular
::
New
(
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
);
...
...
@@ -86,8 +85,13 @@ int main(int, char *)
// Input / Output
boost
::
shared_ptr
<
XdmfWriter
>
writer
=
XdmfWriter
::
New
(
"TestXdmfGridRegular1.xmf"
);
grid
->
accept
(
writer
);
boost
::
shared_ptr
<
XdmfReader
>
reader
=
XdmfReader
::
New
();
boost
::
shared_ptr
<
XdmfGrid
>
grid2
=
boost
::
shared_dynamic_cast
<
XdmfGrid
>
(
reader
->
read
(
"TestXdmfGridRegular1.xmf"
));
boost
::
shared_ptr
<
XdmfWriter
>
writer2
=
XdmfWriter
::
New
(
"TestXdmfGridRegular2.xmf"
);
grid2
->
accept
(
writer2
);
return
0
;
}
tests/Cxx/TestXdmfTopology.cpp
View file @
8c4b7ddd
...
...
@@ -17,10 +17,12 @@ int main(int, char *)
boost
::
shared_ptr
<
XdmfTopology
>
top
=
XdmfTopology
::
New
();
assert
(
top
->
getType
()
==
XdmfTopologyType
::
NoTopologyType
());
assert
(
top
->
getType
()
->
getNodesPerElement
()
==
0
);
assert
(
top
->
getType
()
->
getName
().
compare
(
"NoTopology"
)
==
0
);
top
->
setType
(
XdmfTopologyType
::
Hexahedron
());
assert
(
top
->
getType
()
==
XdmfTopologyType
::
Hexahedron
());
assert
(
top
->
getType
()
->
getNodesPerElement
()
==
8
);
assert
(
top
->
getType
()
->
getName
().
compare
(
"Hexahedron"
)
==
0
);
boost
::
shared_ptr
<
const
XdmfTopologyType
>
polygon
=
XdmfTopologyType
::
Polygon
(
6
);
boost
::
shared_ptr
<
const
XdmfTopologyType
>
polygon6
=
XdmfTopologyType
::
Polygon
(
6
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment