Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CrayzeeWulf
Xdmf
Commits
31b424c7
Commit
31b424c7
authored
Oct 07, 2010
by
Kenneth Leiter
Browse files
ENH: Get Java wrapping working again. Add curvilinear grid.
parent
42286d09
Changes
21
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
31b424c7
...
...
@@ -135,6 +135,7 @@ if(NOT XDMF_BUILD_CORE_ONLY)
XdmfGrid
XdmfGridCollection
XdmfGridCollectionType
XdmfGridCurvilinear
XdmfGridRectilinear
XdmfGridRegular
XdmfItemFactory
...
...
Xdmf.i
View file @
31b424c7
...
...
@@ -98,13 +98,29 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
}
}
// Swig+Java will automatically create 'getter' functions for static
// variables in a class (in this case the ItemTag member variable).
// This happens to conflict with the getters that Xdmf implements to
// override the otherwise virtual functions of the parent class. Here,
// we ask swig to ignore the static variable (thereby removing direct
// access to the variable, but leaving access to our getter function
// Ignore const overloaded methods
%
ignore
XdmfDomain
::
getGrid
(
const
unsigned
int
)
const
;
%
ignore
XdmfDomain
::
getGrid
(
const
std
::
string
&
)
const;
%
ignore
XdmfDomain
::
getGridCollection
(
const
unsigned
int
)
const
;
%
ignore
XdmfDomain
::
getGridCollection
(
const
std
::
string
&
)
const;
%
ignore
XdmfGrid
::
getAttribute
(
const
unsigned
int
)
const
;
%
ignore
XdmfGrid
::
getAttribute
(
const
std
::
string
&
)
const;
%
ignore
XdmfGrid
::
getGeometry
()
const
;
%
ignore
XdmfGrid
::
getMap
()
const
;
%
ignore
XdmfGrid
::
getSet
(
const
unsigned
int
)
const
;
%
ignore
XdmfGrid
::
getSet
(
const
std
::
string
&
)
const;
%
ignore
XdmfGrid
::
getTime
()
const
;
%
ignore
XdmfGrid
::
getTopology
()
const
;
%
ignore
XdmfGridRectilinear
::
getCoordinates
(
const
unsigned
int
)
const
;
%
ignore
XdmfGridRectilinear
::
getCoordinates
()
const
;
%
ignore
XdmfGridRectilinear
::
getDimensions
()
const
;
%
ignore
XdmfGridRegular
::
getBrickSize
()
const
;
%
ignore
XdmfGridRegular
::
getDimensions
()
const
;
%
ignore
XdmfGridRegular
::
getOrigin
()
const
;
%
ignore
XdmfSet
::
getAttribute
(
const
unsigned
int
)
const
;
%
ignore
XdmfSet
::
getAttribute
(
const
std
::
string
&
)
const;
// Ignore ItemTags
%
ignore
XdmfAttribute
::
ItemTag
;
%
ignore
XdmfDomain
::
ItemTag
;
%
ignore
XdmfGeometry
::
ItemTag
;
...
...
@@ -117,29 +133,6 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%
ignore
XdmfTime
::
ItemTag
;
%
ignore
XdmfTopology
::
ItemTag
;
// Swig+Java does not like 2 functions with the same prototype that
// simply return const/non-const versions of the same type. We
// ask Swig to ignore one of the two getter functions. We may
// have to change this to rename the function to a new name such
// that we preserve the ability to get a constant variable
%
rename
(
getAttributeUIntConst
)
XdmfSet
::
getAttribute
(
unsigned
int
const
)
const
;
%
rename
(
getAttributeStrConst
)
XdmfSet
::
getAttribute
(
std
::
string
const
&
)
const;
%
ignore
XdmfDomain
::
getGrid
(
const
unsigned
int
index
)
const
;
%
ignore
XdmfDomain
::
getGridCollection
(
unsigned
int
const
)
const
;
%
ignore
XdmfGrid
::
getAttribute
(
const
unsigned
int
index
)
const
;
%
ignore
XdmfGrid
::
getAttribute
(
const
std
::
string
&
name
)
const
;
%
ignore
XdmfGrid
::
getSet
(
const
unsigned
int
index
)
const
;
%
ignore
XdmfGrid
::
getSet
(
const
std
::
string
&
name
)
const
;
%
ignore
XdmfGrid
::
getGeometry
()
const
;
%
ignore
XdmfGrid
::
getTime
()
const
;
%
ignore
XdmfGrid
::
getTopology
()
const
;
%
ignore
XdmfGridCollection
::
getGrid
(
const
unsigned
int
index
)
const
;
%
ignore
XdmfGridCollection
::
insert
(
const
boost
::
shared_ptr
<
XdmfInformation
>
information
)
;
%
ignore
XdmfGrid
::
getMap
()
const
;
%
ignore
XdmfSet
::
getHDF5Controller
()
const
;
%
pragma
(
java
)
jniclasscode
=%
{
static
{
...
...
XdmfGridCurvilinear.cpp
0 → 100644
View file @
31b424c7
/*
* XdmfGridCurvilinear.cpp
*
* Created on: Jan 25, 2010
* Author: kleiter
*/
#include
<cmath>
#include
"XdmfArray.hpp"
#include
"XdmfGridCurvilinear.hpp"
#include
"XdmfTopology.hpp"
#include
"XdmfTopologyType.hpp"
/**
* PIMPL
*/
class
XdmfGridCurvilinear
::
XdmfGridCurvilinearImpl
{
public:
class
XdmfTopologyCurvilinear
:
public
XdmfTopology
{
public:
static
boost
::
shared_ptr
<
XdmfTopologyCurvilinear
>
New
(
const
XdmfGridCurvilinear
*
const
curvilinearGrid
)
{
boost
::
shared_ptr
<
XdmfTopologyCurvilinear
>
p
(
new
XdmfTopologyCurvilinear
(
curvilinearGrid
));
return
p
;
}
unsigned
int
getNumberElements
()
const
{
const
boost
::
shared_ptr
<
const
XdmfArray
>
dimensions
=
mCurvilinearGrid
->
getDimensions
();
if
(
dimensions
->
getSize
()
==
0
)
{
return
0
;
}
unsigned
int
toReturn
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
dimensions
->
getSize
();
++
i
)
{
toReturn
*=
(
dimensions
->
getValue
<
unsigned
int
>
(
i
)
-
1
);
}
return
toReturn
;
}
private:
XdmfTopologyCurvilinear
(
const
XdmfGridCurvilinear
*
const
curvilinearGrid
)
:
mCurvilinearGrid
(
curvilinearGrid
)
{
this
->
setType
(
XdmfTopologyTypeCurvilinear
::
New
(
curvilinearGrid
));
}
const
XdmfGridCurvilinear
*
const
mCurvilinearGrid
;
};
class
XdmfTopologyTypeCurvilinear
:
public
XdmfTopologyType
{
public:
static
boost
::
shared_ptr
<
const
XdmfTopologyTypeCurvilinear
>
New
(
const
XdmfGridCurvilinear
*
const
curvilinearGrid
)
{
boost
::
shared_ptr
<
const
XdmfTopologyTypeCurvilinear
>
p
(
new
XdmfTopologyTypeCurvilinear
(
curvilinearGrid
));
return
p
;
}
unsigned
int
getNodesPerElement
()
const
{
// 2^Dimensions
// e.g. 1D = 2 nodes per element and 2D = 4 nodes per element.
return
(
unsigned
int
)
std
::
pow
(
2
,
(
double
)
mCurvilinearGrid
->
getDimensions
()
->
getSize
());
}
void
getProperties
(
std
::
map
<
std
::
string
,
std
::
string
>
&
collectedProperties
)
const
{
boost
::
shared_ptr
<
const
XdmfArray
>
dimensions
=
mCurvilinearGrid
->
getDimensions
();
if
(
dimensions
->
getSize
()
==
3
)
{
collectedProperties
[
"Type"
]
=
"3DSMesh"
;
}
else
if
(
dimensions
->
getSize
()
==
2
)
{
collectedProperties
[
"Type"
]
=
"2DSMesh"
;
}
else
{
assert
(
false
);
}
collectedProperties
[
"Dimensions"
]
=
dimensions
->
getValuesString
();
}
private:
XdmfTopologyTypeCurvilinear
(
const
XdmfGridCurvilinear
*
const
curvilinearGrid
)
:
XdmfTopologyType
(
0
,
"foo"
,
XdmfTopologyType
::
Structured
),
mCurvilinearGrid
(
curvilinearGrid
)
{
}
const
XdmfGridCurvilinear
*
const
mCurvilinearGrid
;
};
XdmfGridCurvilinearImpl
(
const
boost
::
shared_ptr
<
XdmfArray
>
numPoints
)
:
mDimensions
(
numPoints
)
{
}
boost
::
shared_ptr
<
XdmfArray
>
mDimensions
;
};
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
XdmfGridCurvilinear
::
New
(
const
unsigned
int
xNumPoints
,
const
unsigned
int
yNumPoints
)
{
boost
::
shared_ptr
<
XdmfArray
>
numPoints
=
XdmfArray
::
New
();
numPoints
->
resize
<
unsigned
int
>
(
2
);
numPoints
->
insert
(
0
,
xNumPoints
);
numPoints
->
insert
(
1
,
yNumPoints
);
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
p
(
new
XdmfGridCurvilinear
(
numPoints
));
return
p
;
}
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
XdmfGridCurvilinear
::
New
(
const
unsigned
int
xNumPoints
,
const
unsigned
int
yNumPoints
,
const
unsigned
int
zNumPoints
)
{
boost
::
shared_ptr
<
XdmfArray
>
numPoints
=
XdmfArray
::
New
();
numPoints
->
resize
<
unsigned
int
>
(
3
);
numPoints
->
insert
(
0
,
xNumPoints
);
numPoints
->
insert
(
1
,
yNumPoints
);
numPoints
->
insert
(
2
,
zNumPoints
);
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
p
(
new
XdmfGridCurvilinear
(
numPoints
));
return
p
;
}
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
XdmfGridCurvilinear
::
New
(
const
boost
::
shared_ptr
<
XdmfArray
>
numPoints
)
{
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
p
(
new
XdmfGridCurvilinear
(
numPoints
));
return
p
;
}
XdmfGridCurvilinear
::
XdmfGridCurvilinear
(
const
boost
::
shared_ptr
<
XdmfArray
>
numPoints
)
:
mImpl
(
new
XdmfGridCurvilinearImpl
(
numPoints
))
{
this
->
setTopology
(
XdmfGridCurvilinearImpl
::
XdmfTopologyCurvilinear
::
New
(
this
));
}
XdmfGridCurvilinear
::~
XdmfGridCurvilinear
()
{
delete
mImpl
;
}
const
std
::
string
XdmfGridCurvilinear
::
ItemTag
=
"Grid"
;
boost
::
shared_ptr
<
XdmfArray
>
XdmfGridCurvilinear
::
getDimensions
()
{
return
boost
::
const_pointer_cast
<
XdmfArray
>
(
static_cast
<
const
XdmfGridCurvilinear
&>
(
*
this
).
getDimensions
());
}
boost
::
shared_ptr
<
const
XdmfArray
>
XdmfGridCurvilinear
::
getDimensions
()
const
{
return
mImpl
->
mDimensions
;
}
void
XdmfGridCurvilinear
::
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
);
for
(
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>::
const_iterator
iter
=
childItems
.
begin
();
iter
!=
childItems
.
end
();
++
iter
)
{
if
(
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
curvilinearGrid
=
boost
::
shared_dynamic_cast
<
XdmfGridCurvilinear
>
(
*
iter
))
{
mImpl
->
mDimensions
=
curvilinearGrid
->
getDimensions
();
}
}
}
void
XdmfGridCurvilinear
::
setDimensions
(
const
boost
::
shared_ptr
<
XdmfArray
>
dimensions
)
{
mImpl
->
mDimensions
=
dimensions
;
}
XdmfGridCurvilinear.hpp
0 → 100644
View file @
31b424c7
#ifndef XDMFGRIDCURVILINEAR_HPP_
#define XDMFGRIDCURVILINEAR_HPP_
// Includes
#include
"XdmfGrid.hpp"
/**
* @brief A curvilinear (or structured) grid consisting of cells and points arranged on a regular lattice in space.
*
* XdmfGridCurvilinear represents a mesh of cells and points arranged with regular topology in space. A curvilinear grid
* contains regular topology but irregular geometry.
*
* In order to define a curvilinear grid, the dimensions of the grid must be supplied and the coordinates of each point
* must be specified.
*
*/
class
XdmfGridCurvilinear
:
public
XdmfGrid
{
public:
/**
* Create a new curvilinear grid (Two dimensional).
*
* @param xNumPoints the number of points in the x direction.
* @param yNumPoints the number of points in the y direction.
*
* @return constructed curvilinear grid.
*/
static
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
New
(
const
unsigned
int
xNumPoints
,
const
unsigned
int
yNumPoints
);
/**
* Create a new curvilinear grid (Three dimensional).
*
* @param xNumPoints the number of points in the x direction.
* @param yNumPoints the number of points in the y direction.
* @param yNumPoints the number of points in the z direction.
*
* @return constructed curvilinear grid.
*/
static
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
New
(
const
unsigned
int
xNumPoints
,
const
unsigned
int
yNumPoints
,
const
unsigned
int
zNumPounts
);
/**
* Create a new curvilinear grid (N dimensional).
*
* @param numPoints the number of points in each direction.
*
* @return constructed curvilinear grid.
*/
static
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
New
(
const
boost
::
shared_ptr
<
XdmfArray
>
numPoints
);
virtual
~
XdmfGridCurvilinear
();
LOKI_DEFINE_VISITABLE
(
XdmfGridCurvilinear
,
XdmfGrid
)
static
const
std
::
string
ItemTag
;
/**
* Get the dimensions of the grid, the number of points in each direction.
*
* @return XdmfArray containing dimensions of this grid.
*/
boost
::
shared_ptr
<
XdmfArray
>
getDimensions
();
/**
* Get the dimensions of the grid, the number of points in each direction (const version).
*
* @return XdmfArray containing the dimensions of this grid.
*/
boost
::
shared_ptr
<
const
XdmfArray
>
getDimensions
()
const
;
/**
* Set the dimensions of the grid, the number of points in each direction.
*
* @param dimensions the dimension of the grid.
*/
void
setDimensions
(
const
boost
::
shared_ptr
<
XdmfArray
>
dimensions
);
protected:
XdmfGridCurvilinear
(
const
boost
::
shared_ptr
<
XdmfArray
>
numPoints
);
void
populateItem
(
const
std
::
map
<
std
::
string
,
std
::
string
>
&
itemProperties
,
std
::
vector
<
boost
::
shared_ptr
<
XdmfItem
>
>
&
childItems
,
const
XdmfCoreReader
*
const
reader
);
private:
/**
* PIMPL
*/
class
XdmfGridCurvilinearImpl
;
XdmfGridCurvilinear
(
const
XdmfGridCurvilinear
&
grid
);
// Not implemented.
void
operator
=
(
const
XdmfGridCurvilinear
&
grid
);
// Not implemented.
XdmfGridCurvilinearImpl
*
mImpl
;
};
#endif
/* XDMFGRIDRECTILINEAR_HPP_ */
XdmfGridRectilinear.cpp
View file @
31b424c7
...
...
@@ -63,7 +63,7 @@ public:
this
->
setType
(
XdmfGeometryTypeRectilinear
::
New
(
mRectilinearGrid
));
}
XdmfGridRectilinear
*
const
mRectilinearGrid
;
const
XdmfGridRectilinear
*
const
mRectilinearGrid
;
};
class
XdmfGeometryTypeRectilinear
:
public
XdmfGeometryType
...
...
@@ -87,11 +87,11 @@ public:
const
unsigned
int
dimensions
=
this
->
getDimensions
();
if
(
dimensions
==
3
)
{
collectedProperties
[
"Type"
]
=
"
ORIGIN_DXDYD
Z"
;
collectedProperties
[
"Type"
]
=
"
VXVYV
Z"
;
}
else
if
(
dimensions
==
2
)
{
collectedProperties
[
"Type"
]
=
"
ORIGIN_DXD
Y"
;
collectedProperties
[
"Type"
]
=
"
VXV
Y"
;
}
else
{
...
...
@@ -103,7 +103,7 @@ public:
XdmfGeometryTypeRectilinear
(
const
XdmfGridRectilinear
*
const
rectilinearGrid
)
:
XdmfGeometryType
(
""
,
0
),
mRectilinearGrid
(
mR
ectilinearGrid
)
mRectilinearGrid
(
r
ectilinearGrid
)
{
}
...
...
@@ -296,8 +296,11 @@ void XdmfGridRectilinear::populateItem(const std::map<std::string, std::string>
{
if
(
boost
::
shared_ptr
<
XdmfGridRectilinear
>
rectilinearGrid
=
boost
::
shared_dynamic_cast
<
XdmfGridRectilinear
>
(
*
iter
))
{
this
->
setCoordinates
(
rectilinearGrid
->
getCoordinates
());
break
;
if
(
rectilinearGrid
->
getGeometry
()
->
getType
()
->
getDimensions
()
>
0
)
{
this
->
setCoordinates
(
rectilinearGrid
->
getCoordinates
());
break
;
}
}
}
}
...
...
XdmfGridRectilinear.hpp
View file @
31b424c7
...
...
@@ -5,7 +5,7 @@
#include
"XdmfGrid.hpp"
/**
* @brief A
mesh
consisting of cells and points arranged on a regular lattice in space.
* @brief A
rectilinear grid
consisting of cells and points arranged on a regular lattice in space.
*
* XdmfGridRectilinear represents a mesh of cells and point arranged on a regular lattice in space.
* Points are arranged along coordinate axes, but the spacing between points may vary.
...
...
XdmfGridRegular.cpp
View file @
31b424c7
...
...
@@ -208,44 +208,44 @@ public:
};
boost
::
shared_ptr
<
XdmfGridRegular
>
XdmfGridRegular
::
New
(
const
double
b
rickSize
X
,
const
double
b
rickSize
Y
,
const
unsigned
int
n
umPoints
X
,
const
unsigned
int
n
umPoints
Y
,
const
double
o
rigin
X
,
const
double
o
rigin
Y
)
boost
::
shared_ptr
<
XdmfGridRegular
>
XdmfGridRegular
::
New
(
const
double
xB
rickSize
,
const
double
yB
rickSize
,
const
unsigned
int
xN
umPoints
,
const
unsigned
int
yN
umPoints
,
const
double
xO
rigin
,
const
double
yO
rigin
)
{
boost
::
shared_ptr
<
XdmfArray
>
brickSize
=
XdmfArray
::
New
();
brickSize
->
resize
<
double
>
(
2
);
brickSize
->
insert
(
0
,
b
rickSize
X
);
brickSize
->
insert
(
1
,
b
rickSize
Y
);
brickSize
->
insert
(
0
,
xB
rickSize
);
brickSize
->
insert
(
1
,
yB
rickSize
);
boost
::
shared_ptr
<
XdmfArray
>
numPoints
=
XdmfArray
::
New
();
numPoints
->
resize
<
unsigned
int
>
(
2
);
numPoints
->
insert
(
0
,
n
umPoints
X
);
numPoints
->
insert
(
1
,
n
umPoints
Y
);
numPoints
->
insert
(
0
,
xN
umPoints
);
numPoints
->
insert
(
1
,
yN
umPoints
);
boost
::
shared_ptr
<
XdmfArray
>
origin
=
XdmfArray
::
New
();
origin
->
resize
<
double
>
(
2
);
origin
->
insert
(
0
,
o
rigin
X
);
origin
->
insert
(
1
,
o
rigin
Y
);
origin
->
insert
(
0
,
xO
rigin
);
origin
->
insert
(
1
,
yO
rigin
);
boost
::
shared_ptr
<
XdmfGridRegular
>
p
(
new
XdmfGridRegular
(
brickSize
,
numPoints
,
origin
));
return
p
;
}
boost
::
shared_ptr
<
XdmfGridRegular
>
XdmfGridRegular
::
New
(
const
double
b
rickSize
X
,
const
double
b
rickSize
Y
,
const
double
b
rickSize
Z
,
const
unsigned
int
n
umPoints
X
,
const
unsigned
int
n
umPoints
Y
,
const
unsigned
int
n
umPoints
Z
,
const
double
o
rigin
X
,
const
double
o
rigin
Y
,
const
double
o
rigin
Z
)
boost
::
shared_ptr
<
XdmfGridRegular
>
XdmfGridRegular
::
New
(
const
double
xB
rickSize
,
const
double
yB
rickSize
,
const
double
zB
rickSize
,
const
unsigned
int
xN
umPoints
,
const
unsigned
int
yN
umPoints
,
const
unsigned
int
zN
umPoints
,
const
double
xO
rigin
,
const
double
yO
rigin
,
const
double
zO
rigin
)
{
boost
::
shared_ptr
<
XdmfArray
>
brickSize
=
XdmfArray
::
New
();
brickSize
->
resize
<
double
>
(
3
);
brickSize
->
insert
(
0
,
b
rickSize
X
);
brickSize
->
insert
(
1
,
b
rickSize
Y
);
brickSize
->
insert
(
2
,
b
rickSize
Z
);
brickSize
->
insert
(
0
,
xB
rickSize
);
brickSize
->
insert
(
1
,
yB
rickSize
);
brickSize
->
insert
(
2
,
zB
rickSize
);
boost
::
shared_ptr
<
XdmfArray
>
numPoints
=
XdmfArray
::
New
();
numPoints
->
resize
<
unsigned
int
>
(
3
);
numPoints
->
insert
(
0
,
n
umPoints
X
);
numPoints
->
insert
(
1
,
n
umPoints
Y
);
numPoints
->
insert
(
2
,
n
umPoints
Z
);
numPoints
->
insert
(
0
,
xN
umPoints
);
numPoints
->
insert
(
1
,
yN
umPoints
);
numPoints
->
insert
(
2
,
zN
umPoints
);
boost
::
shared_ptr
<
XdmfArray
>
origin
=
XdmfArray
::
New
();
origin
->
resize
<
double
>
(
3
);
origin
->
insert
(
0
,
o
rigin
X
);
origin
->
insert
(
1
,
o
rigin
Y
);
origin
->
insert
(
2
,
o
rigin
Z
);
origin
->
insert
(
0
,
xO
rigin
);
origin
->
insert
(
1
,
yO
rigin
);
origin
->
insert
(
2
,
zO
rigin
);
boost
::
shared_ptr
<
XdmfGridRegular
>
p
(
new
XdmfGridRegular
(
brickSize
,
numPoints
,
origin
));
return
p
;
}
...
...
XdmfGridRegular.hpp
View file @
31b424c7
...
...
@@ -5,7 +5,7 @@
#include
"XdmfGrid.hpp"
/**
* @brief A
mesh
consisting of congruent points arranged regularly in space.
* @brief A
regular grid
consisting of congruent points arranged regularly in space.
*
* XdmfGridRegular represents a regular mesh of congruent points arranged in space.
* In order to define a regular grid, three sets of terms need to be supplied:
...
...
@@ -21,36 +21,36 @@ public:
/**
* Create a new structured grid (Two dimensional).
*
* @param
b
rickSize
X
the size of the brick in the x direction.
* @param
b
rickSize
Y
the size of the brick in the y direction.
* @param
n
umPoints
X
the number of points in the x direction.
* @param
n
umPoints
Y
the number of points in the y direction.
* @param
o
rigin
X
the x coordinate of the origin.
* @param
o
rigin
Y
the y coordinate of the origin.
* @param
xB
rickSize the size of the brick in the x direction.
* @param
yB
rickSize the size of the brick in the y direction.
* @param
xN
umPoints the number of points in the x direction.
* @param
yN
umPoints the number of points in the y direction.
* @param
xO
rigin the x coordinate of the origin.
* @param
yO
rigin the y coordinate of the origin.
*
* @return constructed structured grid.
*/
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
b
rickSize
X
,
const
double
b
rickSize
Y
,
const
unsigned
int
n
umPoints
X
,
const
unsigned
int
n
umPoints
Y
,
const
double
o
rigin
X
,
const
double
o
rigin
Y
);
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
xB
rickSize
,
const
double
yB
rickSize
,
const
unsigned
int
xN
umPoints
,
const
unsigned
int
yN
umPoints
,
const
double
xO
rigin
,
const
double
yO
rigin
);
/**
* Create a new structured grid (Three dimensional).
*
* @param
b
rickSize
X
the size of the brick in the x direction.
* @param
b
rickSize
Y
the size of the brick in the y direction.
* @param
b
rickSize
Z
the size of the brick in the z direction.
* @param
n
umPoints
X
the number of points in the x direction.
* @param
n
umPoints
Y
the number of points in the y direction.
* @param
n
umPoints
Z
the number of points in the z direction.
* @param
o
rigin
X
the x coordinate of the origin.
* @param
o
rigin
Y
the y coordinate of the origin.
* @param
o
rigin
Z
the z coordinate of the origin.
* @param
xB
rickSize the size of the brick in the x direction.
* @param
yB
rickSize the size of the brick in the y direction.
* @param
zB
rickSize the size of the brick in the z direction.
* @param
xN
umPoints the number of points in the x direction.
* @param
yN
umPoints the number of points in the y direction.
* @param
zN
umPoints the number of points in the z direction.
* @param
xO
rigin the x coordinate of the origin.
* @param
yO
rigin the y coordinate of the origin.
* @param
zO
rigin the z coordinate of the origin.
*
* @return constructed structured grid.
*/
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
b
rickSize
X
,
const
double
b
rickSize
Y
,
const
double
b
rickSize
Z
,
const
unsigned
int
n
umPoints
X
,
const
unsigned
int
n
umPoints
Y
,
const
unsigned
int
n
umPoints
Z
,
const
double
o
rigin
X
,
const
double
o
rigin
Y
,
const
double
o
rigin
Z
);
static
boost
::
shared_ptr
<
XdmfGridRegular
>
New
(
const
double
xB
rickSize
,
const
double
yB
rickSize
,
const
double
zB
rickSize
,
const
unsigned
int
xN
umPoints
,
const
unsigned
int
yN
umPoints
,
const
unsigned
int
zN
umPoints
,
const
double
xO
rigin
,
const
double
yO
rigin
,
const
double
zO
rigin
);
/**
* Create a new structured grid (N dimensional).
...
...
XdmfItemFactory.cpp
View file @
31b424c7
...
...
@@ -5,6 +5,8 @@
#include
"XdmfGeometryType.hpp"
#include
"XdmfGrid.hpp"
#include
"XdmfGridCollection.hpp"
#include
"XdmfGridCurvilinear.hpp"
#include
"XdmfGridRectilinear.hpp"
#include
"XdmfGridRegular.hpp"
#include
"XdmfInformation.hpp"
#include
"XdmfItemFactory.hpp"
...
...
@@ -80,6 +82,18 @@ boost::shared_ptr<XdmfItem> XdmfItemFactory::createItem(const std::string & item
}
return
boost
::
shared_ptr
<
XdmfItem
>
();
}
else
if
(
typeVal
.
compare
(
"VXVY"
)
==
0
||
typeVal
.
compare
(
"VXVYVZ"
)
==
0
)
{
std
::
vector
<
boost
::
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
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
))
{
coordinateValues
.
push_back
(
array
);
}
}
return
XdmfGridRectilinear
::
New
(
coordinateValues
);
}
}
return
XdmfGeometry
::
New
();
}
...
...
@@ -96,10 +110,19 @@ boost::shared_ptr<XdmfItem> XdmfItemFactory::createItem(const std::string & item
// 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
<
XdmfGridRegular
>
regularGrid
=
boost
::
shared_dynamic_cast
<
XdmfGridRegular
>
(
*
iter
))
if
(
boost
::
shared_ptr
<
XdmfGridCurvilinear
>
curvilinear
=
boost
::
shared_dynamic_cast
<
XdmfGridCurvilinear
>
(
*
iter
))
{
return
XdmfGridCurvilinear
::
New
(
0
,
0
);
}
else
if
(
boost
::
shared_ptr
<
XdmfGridRegular
>
regularGrid
=
boost
::
shared_dynamic_cast
<
XdmfGridRegular
>
(
*
iter
))
{
return
XdmfGridRegular
::
New
(
0
,
0
,
0
,
0
,
0
,
0
);
}
else
if
(
boost
::
shared_ptr
<
XdmfGridRectilinear
>
rectilinearGrid
=
boost
::
shared_dynamic_cast
<
XdmfGridRectilinear
>
(
*
iter
))
{
std
::
vector
<
boost
::
shared_ptr
<
XdmfArray
>
>
coordinateValues
;
return
XdmfGridRectilinear
::
New
(
coordinateValues
);
}
}
return
XdmfGrid
::
New
();
}
...
...
@@ -132,7 +155,8 @@ boost::shared_ptr<XdmfItem> XdmfItemFactory::createItem(const std::string & item
{
std
::
string
typeVal
=
type
->
second
;
std
::
transform
(
typeVal
.
begin
(),
typeVal
.
end
(),
typeVal
.
begin
(),
(
int
(
*
)(
int
))
std
::
toupper
);
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
)
if
(
typeVal
.
compare
(
"2DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"3DCORECTMESH"
)
==
0
||
typeVal
.
compare
(
"2DSMESH"
)
==
0
||
typeVal
.
compare
(
"3DSMESH"
)
==
0
)
{
boost
::
shared_ptr
<
XdmfArray
>
dimensionsArray
=
XdmfArray
::
New
();
std
::
string
dimensionsString
=
""
;
...
...
@@ -146,8 +170,21 @@ boost::shared_ptr<XdmfItem> XdmfItemFactory::createItem(const std::string & item
{
dimensionsArray
->
pushBack
<
unsigned
int
>
(
atoi
((
*
iter
).
c_str
()));
}
return
XdmfGridRegular
::
New
(
boost
::
shared_ptr
<
XdmfArray
>
(),
dimensionsArray
,
boost
::
shared_ptr
<
XdmfArray
>
());