Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Armin Wehrfritz
Xdmf
Commits
dc68e15b
Commit
dc68e15b
authored
May 08, 2014
by
Kenneth Leiter
Browse files
ENH: Remove unneccesary try catch blocks.
Add HDF5 tree writer test.
parent
55717ca0
Changes
37
Hide whitespace changes
Inline
Side-by-side
XdmfAttribute.cpp
View file @
dc68e15b
...
...
@@ -94,14 +94,9 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
mName
=
name
->
second
;
}
else
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'Name' not found in itemProperties in "
"XdmfAttribute::populateItem"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'Name' not found in itemProperties in "
"XdmfAttribute::populateItem"
);
}
mCenter
=
XdmfAttributeCenter
::
New
(
itemProperties
);
...
...
XdmfAttributeCenter.cpp
View file @
dc68e15b
...
...
@@ -81,14 +81,9 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
center
=
itemProperties
.
find
(
"Center"
);
if
(
center
==
itemProperties
.
end
())
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'Center' not found in itemProperties in "
"XdmfAttributeCenter::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'Center' not found in itemProperties in "
"XdmfAttributeCenter::New"
);
}
const
std
::
string
&
centerVal
=
center
->
second
;
...
...
@@ -108,15 +103,11 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
return
Edge
();
}
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New"
);
// unreachable
return
shared_ptr
<
const
XdmfAttributeCenter
>
();
}
...
...
XdmfAttributeType.cpp
View file @
dc68e15b
...
...
@@ -127,16 +127,12 @@ XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties
return
NoAttributeType
();
}
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Type not of 'None','Scalar','Vector','Tensor', "
"'Matrix','Tensor6', or 'GlobalId' in "
"XdmfAttributeType::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Type not of 'None','Scalar','Vector','Tensor', "
"'Matrix','Tensor6', or 'GlobalId' in "
"XdmfAttributeType::New"
);
// unreachable
return
shared_ptr
<
const
XdmfAttributeType
>
();
}
...
...
XdmfCurvilinearGrid.cpp
View file @
dc68e15b
...
...
@@ -44,14 +44,9 @@ public:
static
shared_ptr
<
XdmfTopologyCurvilinear
>
New
(
const
XdmfCurvilinearGrid
*
const
curvilinearGrid
)
{
try
{
shared_ptr
<
XdmfTopologyCurvilinear
>
p
(
new
XdmfTopologyCurvilinear
(
curvilinearGrid
));
return
p
;
}
catch
(
XdmfError
e
)
{
throw
e
;
}
shared_ptr
<
XdmfTopologyCurvilinear
>
p
(
new
XdmfTopologyCurvilinear
(
curvilinearGrid
));
return
p
;
}
unsigned
int
...
...
@@ -74,12 +69,7 @@ public:
XdmfTopologyCurvilinear
(
const
XdmfCurvilinearGrid
*
const
curvilinearGrid
)
:
mCurvilinearGrid
(
curvilinearGrid
)
{
try
{
this
->
setType
(
XdmfTopologyTypeCurvilinear
::
New
(
curvilinearGrid
));
}
catch
(
XdmfError
e
)
{
throw
e
;
}
this
->
setType
(
XdmfTopologyTypeCurvilinear
::
New
(
curvilinearGrid
));
}
const
XdmfCurvilinearGrid
*
const
mCurvilinearGrid
;
...
...
@@ -110,14 +100,9 @@ public:
return
12
;
}
else
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getEdgesPerElement"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getEdgesPerElement"
);
}
return
0
;
}
...
...
@@ -134,14 +119,9 @@ public:
return
6
;
}
else
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getFacesPerElement"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getFacesPerElement"
);
}
return
0
;
}
...
...
@@ -167,14 +147,9 @@ public:
collectedProperties
[
"Type"
]
=
"2DSMesh"
;
}
else
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getProperties"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getProperties"
);
}
collectedProperties
[
"Dimensions"
]
=
dimensions
->
getValuesString
();
}
...
...
XdmfGeometry.cpp
View file @
dc68e15b
...
...
@@ -46,14 +46,9 @@ const std::string XdmfGeometry::ItemTag = "Geometry";
std
::
map
<
std
::
string
,
std
::
string
>
XdmfGeometry
::
getItemProperties
()
const
{
try
{
std
::
map
<
std
::
string
,
std
::
string
>
geometryProperties
;
mType
->
getProperties
(
geometryProperties
);
return
geometryProperties
;
}
catch
(
XdmfError
e
)
{
throw
e
;
}
std
::
map
<
std
::
string
,
std
::
string
>
geometryProperties
;
mType
->
getProperties
(
geometryProperties
);
return
geometryProperties
;
}
std
::
string
...
...
XdmfGeometryType.cpp
View file @
dc68e15b
...
...
@@ -67,14 +67,9 @@ XdmfGeometryType::New(const std::map<std::string, std::string> & itemProperties)
type
=
itemProperties
.
find
(
"GeometryType"
);
}
if
(
type
==
itemProperties
.
end
())
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Neither 'Type' nor 'GeometryType' in itemProperties "
"in XdmfGeometryType::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Neither 'Type' nor 'GeometryType' in itemProperties "
"in XdmfGeometryType::New"
);
}
const
std
::
string
&
typeVal
=
type
->
second
;
...
...
@@ -88,13 +83,8 @@ XdmfGeometryType::New(const std::map<std::string, std::string> & itemProperties)
return
XY
();
}
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Type not 'None', 'XYZ', or 'XY' "
"in XdmfGeometryType::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Type not 'None', 'XYZ', or 'XY' "
"in XdmfGeometryType::New"
);
return
shared_ptr
<
const
XdmfGeometryType
>
();
}
...
...
XdmfGridCollectionType.cpp
View file @
dc68e15b
...
...
@@ -65,14 +65,9 @@ XdmfGridCollectionType::New(const std::map<std::string, std::string> & itemPrope
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
type
=
itemProperties
.
find
(
"CollectionType"
);
if
(
type
==
itemProperties
.
end
())
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'CollectionType' not in itemProperties in "
"XdmfGridCollectionType::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'CollectionType' not in itemProperties in "
"XdmfGridCollectionType::New"
);
}
const
std
::
string
&
typeVal
=
type
->
second
;
...
...
@@ -86,15 +81,11 @@ XdmfGridCollectionType::New(const std::map<std::string, std::string> & itemPrope
return
Temporal
();
}
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'CollectionType' not of 'None', 'Spatial', or "
"'Temporal' in XdmfGridCollectionType::New"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"'CollectionType' not of 'None', 'Spatial', or "
"'Temporal' in XdmfGridCollectionType::New"
);
// unreachable
return
shared_ptr
<
const
XdmfGridCollectionType
>
();
}
...
...
XdmfItemFactory.cpp
View file @
dc68e15b
...
...
@@ -26,6 +26,7 @@
#include
"XdmfAttribute.hpp"
#include
"XdmfCurvilinearGrid.hpp"
#include
"XdmfDomain.hpp"
#include
"XdmfError.hpp"
#include
"XdmfFunction.hpp"
#include
"XdmfGeometry.hpp"
#include
"XdmfGeometryType.hpp"
...
...
@@ -41,7 +42,6 @@
#include
"XdmfTime.hpp"
#include
"XdmfTopology.hpp"
#include
"XdmfUnstructuredGrid.hpp"
#include
"XdmfError.hpp"
shared_ptr
<
XdmfItemFactory
>
XdmfItemFactory
::
New
()
...
...
@@ -63,174 +63,169 @@ XdmfItemFactory::createItem(const std::string & itemTag,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
const
std
::
vector
<
shared_ptr
<
XdmfItem
>
>
&
childItems
)
const
{
try
{
shared_ptr
<
XdmfItem
>
newItem
=
XdmfCoreItemFactory
::
createItem
(
itemTag
,
itemProperties
,
childItems
);
if
(
newItem
)
{
return
newItem
;
}
shared_ptr
<
XdmfItem
>
newItem
=
XdmfCoreItemFactory
::
createItem
(
itemTag
,
itemProperties
,
childItems
);
if
(
newItem
)
{
return
newItem
;
}
if
(
itemTag
.
compare
(
XdmfAttribute
::
ItemTag
)
==
0
)
{
return
XdmfAttribute
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfDomain
::
ItemTag
)
==
0
)
{
return
XdmfDomain
::
New
();
if
(
itemTag
.
compare
(
XdmfAttribute
::
ItemTag
)
==
0
)
{
return
XdmfAttribute
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfDomain
::
ItemTag
)
==
0
)
{
return
XdmfDomain
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfGeometry
::
ItemTag
)
==
0
)
{
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
type
=
itemProperties
.
find
(
"Type"
);
if
(
type
==
itemProperties
.
end
())
{
type
=
itemProperties
.
find
(
"GeometryType"
);
}
else
if
(
itemTag
.
compare
(
XdmfGeometry
::
ItemTag
)
==
0
)
{
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
type
=
itemProperties
.
find
(
"Type"
);
if
(
type
==
itemProperties
.
end
())
{
type
=
itemProperties
.
find
(
"GeometryType"
);
}
if
(
type
!=
itemProperties
.
end
())
{
const
std
::
string
&
typeVal
=
type
->
second
;
if
(
typeVal
.
compare
(
"ORIGIN_DXDY"
)
==
0
||
typeVal
.
compare
(
"ORIGIN_DXDYDZ"
)
==
0
)
{
shared_ptr
<
XdmfArray
>
origin
=
shared_ptr
<
XdmfArray
>
();
shared_ptr
<
XdmfArray
>
brickSize
=
shared_ptr
<
XdmfArray
>
();
for
(
std
::
vector
<
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
shared_ptr
<
XdmfArray
>
array
=
shared_dynamic_cast
<
XdmfArray
>
(
*
iter
))
{
if
(
!
origin
)
{
origin
=
array
;
}
else
if
(
!
brickSize
)
{
brickSize
=
array
;
break
;
}
if
(
type
!=
itemProperties
.
end
())
{
const
std
::
string
&
typeVal
=
type
->
second
;
if
(
typeVal
.
compare
(
"ORIGIN_DXDY"
)
==
0
||
typeVal
.
compare
(
"ORIGIN_DXDYDZ"
)
==
0
)
{
shared_ptr
<
XdmfArray
>
origin
=
shared_ptr
<
XdmfArray
>
();
shared_ptr
<
XdmfArray
>
brickSize
=
shared_ptr
<
XdmfArray
>
();
for
(
std
::
vector
<
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
shared_ptr
<
XdmfArray
>
array
=
shared_dynamic_cast
<
XdmfArray
>
(
*
iter
))
{
if
(
!
origin
)
{
origin
=
array
;
}
}
if
(
origin
&&
brickSize
)
{
return
XdmfRegularGrid
::
New
(
brickSize
,
shared_ptr
<
XdmfArray
>
(),
origin
);
}
return
shared_ptr
<
XdmfItem
>
();
}
else
if
(
typeVal
.
compare
(
"VXVY"
)
==
0
||
typeVal
.
compare
(
"VXVYVZ"
)
==
0
)
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
for
(
std
::
vector
<
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
shared_ptr
<
XdmfArray
>
array
=
shared_dynamic_cast
<
XdmfArray
>
(
*
iter
))
{
coordinateValues
.
push_back
(
array
);
else
if
(
!
brickSize
)
{
brickSize
=
array
;
break
;
}
}
return
XdmfRectilinearGrid
::
New
(
coordinateValues
);
}
if
(
origin
&&
brickSize
)
{
return
XdmfRegularGrid
::
New
(
brickSize
,
shared_ptr
<
XdmfArray
>
(),
origin
);
}
return
shared_ptr
<
XdmfItem
>
();
}
return
XdmfGeometry
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfGraph
::
ItemTag
)
==
0
)
{
return
XdmfGraph
::
New
(
0
);
}
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
)
{
return
XdmfGridCollection
::
New
();
}
else
{
// Find out what kind of grid we have
else
if
(
typeVal
.
compare
(
"VXVY"
)
==
0
||
typeVal
.
compare
(
"VXVYVZ"
)
==
0
)
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
for
(
std
::
vector
<
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
shared_ptr
<
XdmfCurvilinearGrid
>
curvilinear
=
shared_dynamic_cast
<
XdmfCurvilinearGrid
>
(
*
iter
))
{
return
XdmfCurvilinearGrid
::
New
(
0
,
0
);
}
else
if
(
shared_ptr
<
XdmfRegularGrid
>
regularGrid
=
shared_dynamic_cast
<
XdmfRegularGrid
>
(
*
iter
))
{
return
XdmfRegularGrid
::
New
(
0
,
0
,
0
,
0
,
0
,
0
);
}
else
if
(
shared_ptr
<
XdmfRectilinearGrid
>
rectilinearGrid
=
shared_dynamic_cast
<
XdmfRectilinearGrid
>
(
*
iter
))
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
return
XdmfRectilinearGrid
::
New
(
coordinateValues
);
if
(
shared_ptr
<
XdmfArray
>
array
=
shared_dynamic_cast
<
XdmfArray
>
(
*
iter
))
{
coordinateValues
.
push_back
(
array
);
}
}
return
Xdmf
UnstructuredGrid
::
New
(
);
return
Xdmf
RectilinearGrid
::
New
(
coordinateValues
);
}
}
else
if
(
itemTag
.
compare
(
XdmfInformation
::
ItemTag
)
==
0
)
{
return
XdmfInformation
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfMap
::
ItemTag
)
==
0
)
{
return
XdmfMap
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfSet
::
ItemTag
)
==
0
)
{
return
XdmfSet
::
New
();
return
XdmfGeometry
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfGraph
::
ItemTag
)
==
0
)
{
return
XdmfGraph
::
New
(
0
);
}
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
)
{
return
XdmfGridCollection
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfSparseMatrix
::
ItemTag
)
==
0
)
{
return
XdmfSparseMatrix
::
New
(
0
,
0
);
else
{
// Find out what kind of grid we have
for
(
std
::
vector
<
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
shared_ptr
<
XdmfCurvilinearGrid
>
curvilinear
=
shared_dynamic_cast
<
XdmfCurvilinearGrid
>
(
*
iter
))
{
return
XdmfCurvilinearGrid
::
New
(
0
,
0
);
}
else
if
(
shared_ptr
<
XdmfRegularGrid
>
regularGrid
=
shared_dynamic_cast
<
XdmfRegularGrid
>
(
*
iter
))
{
return
XdmfRegularGrid
::
New
(
0
,
0
,
0
,
0
,
0
,
0
);
}
else
if
(
shared_ptr
<
XdmfRectilinearGrid
>
rectilinearGrid
=
shared_dynamic_cast
<
XdmfRectilinearGrid
>
(
*
iter
))
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
return
XdmfRectilinearGrid
::
New
(
coordinateValues
);
}
}
return
XdmfUnstructuredGrid
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfTime
::
ItemTag
)
==
0
)
{
return
XdmfTime
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfInformation
::
ItemTag
)
==
0
)
{
return
XdmfInformation
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfMap
::
ItemTag
)
==
0
)
{
return
XdmfMap
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfSet
::
ItemTag
)
==
0
)
{
return
XdmfSet
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfSparseMatrix
::
ItemTag
)
==
0
)
{
return
XdmfSparseMatrix
::
New
(
0
,
0
);
}
else
if
(
itemTag
.
compare
(
XdmfTime
::
ItemTag
)
==
0
)
{
return
XdmfTime
::
New
();
}
else
if
(
itemTag
.
compare
(
XdmfTopology
::
ItemTag
)
==
0
)
{
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
type
=
itemProperties
.
find
(
"Type"
);
if
(
type
==
itemProperties
.
end
())
{
type
=
itemProperties
.
find
(
"TopologyType"
);
}
else
if
(
itemTag
.
compare
(
XdmfTopology
::
ItemTag
)
==
0
)
{
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
type
=
itemProperties
.
find
(
"Type"
);
if
(
type
==
itemProperties
.
end
())
{
type
=
itemProperties
.
find
(
"TopologyType"
);
}
if
(
type
!=
itemProperties
.
end
())
{
std
::
string
typeVal
=
type
->
second
;
std
::
transform
(
typeVal
.
begin
(),
typeVal
.
end
(),
typeVal
.
begin
(),
(
int
(
*
)(
int
))
toupper
);
if
(
type
!=
itemProperties
.
end
())
{
std
::
string
typeVal
=
type
->
second
;
std
::
transform
(
typeVal
.
begin
(),
typeVal
.
end
(),
typeVal
.
begin
(),
(
int
(
*
)(
int
))
toupper
);
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"2DSMESH"
)
==
0
||
typeVal
.
compare
(
"3DSMESH"
)
==
0
)
{
shared_ptr
<
XdmfArray
>
dimensionsArray
=
XdmfArray
::
New
();
std
::
string
dimensionsString
=
""
;
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
dimensions
=
itemProperties
.
find
(
"Dimensions"
);
if
(
dimensions
!=
itemProperties
.
end
())
{
dimensionsString
=
dimensions
->
second
;
}
boost
::
tokenizer
<>
tokens
(
dimensionsString
);
for
(
boost
::
tokenizer
<>::
const_iterator
iter
=
tokens
.
begin
();
iter
!=
tokens
.
end
();
++
iter
)
{
dimensionsArray
->
pushBack
<
unsigned
int
>
(
atoi
((
*
iter
).
c_str
()));
}
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"2DSMESH"
)
==
0
||
typeVal
.
compare
(
"3DSMESH"
)
==
0
)
{
shared_ptr
<
XdmfArray
>
dimensionsArray
=
XdmfArray
::
New
();
std
::
string
dimensionsString
=
""
;
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
dimensions
=
itemProperties
.
find
(
"Dimensions"
);
if
(
dimensions
!=
itemProperties
.
end
())
{
dimensionsString
=
dimensions
->
second
;
}
boost
::
tokenizer
<>
tokens
(
dimensionsString
);
for
(
boost
::
tokenizer
<>::
const_iterator
iter
=
tokens
.
begin
();
iter
!=
tokens
.
end
();
++
iter
)
{
dimensionsArray
->
pushBack
<
unsigned
int
>
(
atoi
((
*
iter
).
c_str
()));
}
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
)
{
return
XdmfRegularGrid
::
New
(
shared_ptr
<
XdmfArray
>
(),
dimensionsArray
,
shared_ptr
<
XdmfArray
>
());
}
else
{
return
XdmfCurvilinearGrid
::
New
(
dimensionsArray
);
}
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
)
{
return
XdmfRegularGrid
::
New
(
shared_ptr
<
XdmfArray
>
(),
dimensionsArray
,
shared_ptr
<
XdmfArray
>
());
}
else
if
(
typeVal
.
compare
(
"2DRECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DRECTMESH"
)
==
0
)
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
return
XdmfRectilinearGrid
::
New
(
coordinateValues
);
else
{
return
XdmfCurvilinearGrid
::
New
(
dimensionsArray
);
}
}
return
XdmfTopology
::
New
();
else
if
(
typeVal
.
compare
(
"2DRECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DRECTMESH"
)
==
0
)
{
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
return
XdmfRectilinearGrid
::
New
(
coordinateValues
);
}
}
return
shared_ptr
<
XdmfItem
>
();
}
catch
(
XdmfError
e
)
{
throw
e
;
return
XdmfTopology
::
New
();
}
return
shared_ptr
<
XdmfItem
>
();
}
XdmfMap.cpp
View file @
dc68e15b
...
...
@@ -176,25 +176,15 @@ XdmfMap::populateItem(const std::map<std::string, std::string> & itemProperties,
if
(
arrayVector
.
size
()
!=
0
)
{
if
(
arrayVector
.
size
()
!=
3
)
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Expected 3 arrays attached to "
"XdmfMap::populateItem"
);
}
catch
(
XdmfError
e
)
{
throw
e
;
}
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Expected 3 arrays attached to "
"XdmfMap::populateItem"
);
}
if
(
!
(
arrayVector
[
0
]
->
getSize
()
==
arrayVector
[
1
]
->
getSize
()
&&
arrayVector
[
0
]
->
getSize
()
==
arrayVector
[
2
]
->
getSize
()))
{
try
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Arrays must be of equal size in "
"XdmfMap:: populateItem"
);
}
catch
(
XdmfError
e
)
{