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
Xdmf
Xdmf
Commits
db257fe6
Commit
db257fe6
authored
Jun 25, 2014
by
Andrew J. Burns (Cont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving test output
parent
7863e933
Changes
78
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
2272 additions
and
539 deletions
+2272
-539
CMake/TestingSuite/AddTestsFortran.cmake
CMake/TestingSuite/AddTestsFortran.cmake
+8
-0
CMakeLists.txt
CMakeLists.txt
+5
-0
XdmfAttribute.cpp
XdmfAttribute.cpp
+12
-2
XdmfCurvilinearGrid.cpp
XdmfCurvilinearGrid.cpp
+10
-1
XdmfGeometry.cpp
XdmfGeometry.cpp
+1
-0
XdmfGraph.cpp
XdmfGraph.cpp
+21
-1
XdmfGraph.hpp
XdmfGraph.hpp
+8
-0
XdmfGrid.cpp
XdmfGrid.cpp
+12
-2
XdmfRectilinearGrid.cpp
XdmfRectilinearGrid.cpp
+19
-1
XdmfRegularGrid.cpp
XdmfRegularGrid.cpp
+22
-1
XdmfSet.cpp
XdmfSet.cpp
+12
-2
core/XdmfCoreItemFactory.cpp
core/XdmfCoreItemFactory.cpp
+36
-12
core/XdmfFunction.cpp
core/XdmfFunction.cpp
+23
-14
core/XdmfFunction.hpp
core/XdmfFunction.hpp
+406
-0
core/XdmfHDF5Controller.hpp
core/XdmfHDF5Controller.hpp
+23
-0
core/dsm/XdmfDSMBuffer.cpp
core/dsm/XdmfDSMBuffer.cpp
+42
-37
core/dsm/XdmfDSMCommMPI.cpp
core/dsm/XdmfDSMCommMPI.cpp
+20
-20
core/dsm/XdmfDSMDriver.cpp
core/dsm/XdmfDSMDriver.cpp
+29
-20
core/dsm/XdmfDSMManager.cpp
core/dsm/XdmfDSMManager.cpp
+5
-5
core/dsm/XdmfHDF5ControllerDSM.cpp
core/dsm/XdmfHDF5ControllerDSM.cpp
+12
-9
core/dsm/XdmfHDF5WriterDSM.cpp
core/dsm/XdmfHDF5WriterDSM.cpp
+11
-11
core/dsm/tests/Cxx/CMakeLists.txt
core/dsm/tests/Cxx/CMakeLists.txt
+1
-10
core/dsm/tests/Cxx/DSMLoopTest.cpp
core/dsm/tests/Cxx/DSMLoopTest.cpp
+1
-1
core/dsm/tests/Cxx/TestXdmfHDF5WriterDSM.cpp
core/dsm/tests/Cxx/TestXdmfHDF5WriterDSM.cpp
+6
-0
core/dsm/tests/Cxx/XdmfAcceptTest.cpp
core/dsm/tests/Cxx/XdmfAcceptTest.cpp
+9
-0
core/dsm/tests/Cxx/XdmfConnectTest.cpp
core/dsm/tests/Cxx/XdmfConnectTest.cpp
+5
-0
core/dsm/tests/Cxx/XdmfConnectTest2.cpp
core/dsm/tests/Cxx/XdmfConnectTest2.cpp
+5
-0
core/dsm/tests/Python/CMakeLists.txt
core/dsm/tests/Python/CMakeLists.txt
+1
-10
core/dsm/tests/Python/XdmfExampleAcceptTest.py
core/dsm/tests/Python/XdmfExampleAcceptTest.py
+47
-44
core/dsm/tests/Python/XdmfExampleConnectTest.py
core/dsm/tests/Python/XdmfExampleConnectTest.py
+135
-134
core/dsm/tests/Python/XdmfExampleConnectTest2.py
core/dsm/tests/Python/XdmfExampleConnectTest2.py
+103
-102
core/tests/Cxx/TestXdmfArray.cpp
core/tests/Cxx/TestXdmfArray.cpp
+98
-1
core/tests/Cxx/TestXdmfArrayInsert.cpp
core/tests/Cxx/TestXdmfArrayInsert.cpp
+15
-0
core/tests/Cxx/TestXdmfArrayMultiDimensionalInsert.cpp
core/tests/Cxx/TestXdmfArrayMultiDimensionalInsert.cpp
+2
-0
core/tests/Cxx/TestXdmfArrayMultidimensional.cpp
core/tests/Cxx/TestXdmfArrayMultidimensional.cpp
+29
-0
core/tests/Cxx/TestXdmfArrayWriteRead.cpp
core/tests/Cxx/TestXdmfArrayWriteRead.cpp
+18
-0
core/tests/Cxx/TestXdmfArrayWriteReadHyperSlabs.cpp
core/tests/Cxx/TestXdmfArrayWriteReadHyperSlabs.cpp
+6
-0
core/tests/Cxx/TestXdmfHDF5Controller.cpp
core/tests/Cxx/TestXdmfHDF5Controller.cpp
+6
-0
core/tests/Cxx/TestXdmfHDF5Writer.cpp
core/tests/Cxx/TestXdmfHDF5Writer.cpp
+25
-0
core/tests/Cxx/TestXdmfHDF5WriterTree.cpp
core/tests/Cxx/TestXdmfHDF5WriterTree.cpp
+29
-0
core/tests/Cxx/TestXdmfInformation.cpp
core/tests/Cxx/TestXdmfInformation.cpp
+32
-0
core/tests/Cxx/TestXdmfSparseMatrix.cpp
core/tests/Cxx/TestXdmfSparseMatrix.cpp
+4
-0
core/tests/Python/TestXdmfArray.py
core/tests/Python/TestXdmfArray.py
+16
-0
core/tests/Python/TestXdmfArrayMultidimensional.py
core/tests/Python/TestXdmfArrayMultidimensional.py
+28
-0
examples/Cxx/ExampleXdmfFunction.cpp
examples/Cxx/ExampleXdmfFunction.cpp
+163
-0
examples/Python/XdmfExampleFunction.py
examples/Python/XdmfExampleFunction.py
+163
-0
tests/Cxx/CMakeLists.txt
tests/Cxx/CMakeLists.txt
+4
-0
tests/Cxx/ExampleXdmfRead.cpp
tests/Cxx/ExampleXdmfRead.cpp
+1
-0
tests/Cxx/TestXdmfAttribute.cpp
tests/Cxx/TestXdmfAttribute.cpp
+5
-0
tests/Cxx/TestXdmfBinaryController.cpp
tests/Cxx/TestXdmfBinaryController.cpp
+9
-1
tests/Cxx/TestXdmfCurvilinearGrid.cpp
tests/Cxx/TestXdmfCurvilinearGrid.cpp
+19
-0
tests/Cxx/TestXdmfFunction.cpp
tests/Cxx/TestXdmfFunction.cpp
+18
-9
tests/Cxx/TestXdmfGeometry.cpp
tests/Cxx/TestXdmfGeometry.cpp
+8
-0
tests/Cxx/TestXdmfGraph.cpp
tests/Cxx/TestXdmfGraph.cpp
+17
-1
tests/Cxx/TestXdmfGridCollection.cpp
tests/Cxx/TestXdmfGridCollection.cpp
+29
-0
tests/Cxx/TestXdmfHDF5Hyperslab.cpp
tests/Cxx/TestXdmfHDF5Hyperslab.cpp
+79
-2
tests/Cxx/TestXdmfHDF5Visit.cpp
tests/Cxx/TestXdmfHDF5Visit.cpp
+72
-0
tests/Cxx/TestXdmfMap.cpp
tests/Cxx/TestXdmfMap.cpp
+26
-0
tests/Cxx/TestXdmfMultiXPath.cpp
tests/Cxx/TestXdmfMultiXPath.cpp
+6
-1
tests/Cxx/TestXdmfReader.cpp
tests/Cxx/TestXdmfReader.cpp
+23
-0
tests/Cxx/TestXdmfRectilinearGrid.cpp
tests/Cxx/TestXdmfRectilinearGrid.cpp
+21
-0
tests/Cxx/TestXdmfRegularGrid.cpp
tests/Cxx/TestXdmfRegularGrid.cpp
+26
-0
tests/Cxx/TestXdmfSet.cpp
tests/Cxx/TestXdmfSet.cpp
+15
-0
tests/Cxx/TestXdmfSubset.cpp
tests/Cxx/TestXdmfSubset.cpp
+11
-9
tests/Cxx/TestXdmfTime.cpp
tests/Cxx/TestXdmfTime.cpp
+3
-0
tests/Cxx/TestXdmfTopology.cpp
tests/Cxx/TestXdmfTopology.cpp
+16
-0
tests/Cxx/TestXdmfTopologyMixed.cpp
tests/Cxx/TestXdmfTopologyMixed.cpp
+13
-0
tests/Cxx/TestXdmfUnstructuredGrid.cpp
tests/Cxx/TestXdmfUnstructuredGrid.cpp
+25
-0
tests/Cxx/TestXdmfVisitorValueCounter.cpp
tests/Cxx/TestXdmfVisitorValueCounter.cpp
+3
-0
tests/Cxx/TestXdmfWriter.cpp
tests/Cxx/TestXdmfWriter.cpp
+6
-0
tests/Cxx/TestXdmfXPath.cpp
tests/Cxx/TestXdmfXPath.cpp
+42
-0
tests/Cxx/XdmfPostFixCalc.cpp
tests/Cxx/XdmfPostFixCalc.cpp
+72
-72
tests/Python/TestXdmfFunction.py
tests/Python/TestXdmfFunction.py
+4
-4
tests/Python/TestXdmfFunctionRead.py
tests/Python/TestXdmfFunctionRead.py
+4
-0
tests/Python/TestXdmfRead.py
tests/Python/TestXdmfRead.py
+11
-0
No files found.
CMake/TestingSuite/AddTestsFortran.cmake
View file @
db257fe6
...
...
@@ -65,6 +65,10 @@ MACRO(ADD_TEST_FORTRAN executable)
IF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.f90
)
ADD_EXECUTABLE
(
${
executable
}
${
fortran_source_dir
}
/
${
executable
}
.f90
)
ENDIF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.f90
)
IF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.F90
)
ADD_EXECUTABLE
(
${
executable
}
${
fortran_source_dir
}
/
${
executable
}
.F90
)
ENDIF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.F90
)
GET_PROPERTY
(
fortran_dependencies GLOBAL PROPERTY FORTRAN_TEST_DEPENDENCIES
)
GET_PROPERTY
(
fortran_ldpath GLOBAL PROPERTY FORTRAN_TEST_LDPATH
)
...
...
@@ -128,6 +132,10 @@ MACRO(ADD_MPI_TEST_FORTRAN script files)
ADD_EXECUTABLE
(
${
executable
}
${
fortran_source_dir
}
/
${
executable
}
.f90
)
ENDIF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.f90
)
IF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.F90
)
ADD_EXECUTABLE
(
${
executable
}
${
fortran_source_dir
}
/
${
executable
}
.F90
)
ENDIF
(
EXISTS
${
fortran_source_dir
}
/
${
executable
}
.F90
)
GET_PROPERTY
(
fortran_dependencies GLOBAL PROPERTY FORTRAN_TEST_DEPENDENCIES
)
GET_PROPERTY
(
fortran_ldpath GLOBAL PROPERTY FORTRAN_TEST_LDPATH
)
GET_PROPERTY
(
fortran_path GLOBAL PROPERTY FORTRAN_TEST_PATH
)
...
...
CMakeLists.txt
View file @
db257fe6
...
...
@@ -59,6 +59,11 @@ if(XDMF_BUILD_DSM)
set
(
XDMF_LIBRARIES
${
XDMF_LIBRARIES
}
${
MPI_LIBRARY
}
${
MPI_EXTRA_LIBRARY
}
)
get_filename_component
(
MPI_LIBRARY_DIR
${
MPI_LIBRARY
}
PATH
)
set
(
XDMF_LIBRARY_DIRS
${
XDMF_LIBRARY_DIRS
}
${
MPI_LIBRARY_DIR
}
)
# intel compiler requires an extra tag for CXX_FLAGS in order to properly build
STRING
(
REGEX MATCH
"icpc"
IS_INTEL
"
${
CMAKE_CXX_COMPILER
}
"
)
if
(
NOT
"
${
IS_INTEL
}
"
STREQUAL
""
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DMPICH_IGNORE_CXX_SEEK"
)
endif
(
NOT
"
${
IS_INTEL
}
"
STREQUAL
""
)
endif
(
MPI_FOUND
)
option
(
XDMF_BUILD_DSM_THREADS ON
)
if
(
XDMF_WRAP_PYTHON
)
...
...
XdmfAttribute.cpp
View file @
db257fe6
...
...
@@ -72,7 +72,12 @@ XdmfAttribute::getItemTag() const
std
::
string
XdmfAttribute
::
getName
()
const
{
return
mName
;
if
(
mName
.
c_str
()
==
NULL
)
{
return
""
;
}
else
{
return
mName
;
}
}
shared_ptr
<
const
XdmfAttributeType
>
...
...
@@ -125,7 +130,12 @@ XdmfAttribute::setCenter(const shared_ptr<const XdmfAttributeCenter> center)
void
XdmfAttribute
::
setName
(
const
std
::
string
&
name
)
{
mName
=
name
;
if
(
mName
.
c_str
()
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Internal Name String is a null reference"
);
}
else
{
mName
=
name
;
}
}
void
...
...
XdmfCurvilinearGrid.cpp
View file @
db257fe6
...
...
@@ -223,7 +223,10 @@ XdmfCurvilinearGrid::XdmfCurvilinearGrid(const shared_ptr<XdmfArray> numPoints)
XdmfCurvilinearGrid
::~
XdmfCurvilinearGrid
()
{
delete
mImpl
;
if
(
mImpl
)
{
delete
mImpl
;
}
mImpl
=
NULL
;
}
const
std
::
string
XdmfCurvilinearGrid
::
ItemTag
=
"Grid"
;
...
...
@@ -238,6 +241,9 @@ XdmfCurvilinearGrid::getDimensions()
shared_ptr
<
const
XdmfArray
>
XdmfCurvilinearGrid
::
getDimensions
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Curvilinear Grid Internal Object is NULL"
);
}
return
mImpl
->
mDimensions
;
}
...
...
@@ -269,6 +275,9 @@ XdmfCurvilinearGrid::populateItem(const std::map<std::string, std::string> & ite
void
XdmfCurvilinearGrid
::
setDimensions
(
const
shared_ptr
<
XdmfArray
>
dimensions
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Curvilinear Grid Internal Object is NULL"
);
}
mImpl
->
mDimensions
=
dimensions
;
}
...
...
XdmfGeometry.cpp
View file @
db257fe6
...
...
@@ -33,6 +33,7 @@ shared_ptr<XdmfGeometry> XdmfGeometry::New()
}
XdmfGeometry
::
XdmfGeometry
()
:
XdmfArray
(),
mNumberPoints
(
0
),
mType
(
XdmfGeometryType
::
NoGeometryType
())
{
...
...
XdmfGraph.cpp
View file @
db257fe6
...
...
@@ -35,7 +35,8 @@ XdmfGraph::New(const unsigned int numberNodes)
XdmfGraph
::
XdmfGraph
(
const
unsigned
int
numberNodes
)
:
XdmfSparseMatrix
(
numberNodes
,
numberNodes
)
numberNodes
),
mTime
(
shared_ptr
<
XdmfTime
>
())
{
}
...
...
@@ -51,6 +52,19 @@ XdmfGraph::getItemTag() const
return
ItemTag
;
}
shared_ptr
<
XdmfTime
>
XdmfGraph
::
getTime
()
{
return
boost
::
const_pointer_cast
<
XdmfTime
>
(
static_cast
<
const
XdmfGraph
&>
(
*
this
).
getTime
());
}
shared_ptr
<
const
XdmfTime
>
XdmfGraph
::
getTime
()
const
{
return
mTime
;
}
unsigned
int
XdmfGraph
::
getNumberNodes
()
const
{
...
...
@@ -77,6 +91,12 @@ XdmfGraph::populateItem(const std::map<std::string, std::string> & itemPropertie
}
}
void
XdmfGraph
::
setTime
(
const
shared_ptr
<
XdmfTime
>
time
)
{
mTime
=
time
;
}
void
XdmfGraph
::
traverse
(
const
shared_ptr
<
XdmfBaseVisitor
>
visitor
)
{
...
...
XdmfGraph.hpp
View file @
db257fe6
...
...
@@ -72,10 +72,16 @@ public:
std
::
string
getItemTag
()
const
;
shared_ptr
<
XdmfTime
>
getTime
();
shared_ptr
<
const
XdmfTime
>
getTime
()
const
;
unsigned
int
getNumberNodes
()
const
;
using
XdmfSparseMatrix
::
insert
;
void
setTime
(
const
shared_ptr
<
XdmfTime
>
time
);
void
traverse
(
const
shared_ptr
<
XdmfBaseVisitor
>
visitor
);
protected:
...
...
@@ -91,6 +97,8 @@ private:
XdmfGraph
(
const
XdmfGraph
&
);
// Not implemented.
void
operator
=
(
const
XdmfGraph
&
);
// Not implemented.
shared_ptr
<
XdmfTime
>
mTime
;
};
#ifdef _WIN32
...
...
XdmfGrid.cpp
View file @
db257fe6
...
...
@@ -73,7 +73,12 @@ XdmfGrid::getItemTag() const
std
::
string
XdmfGrid
::
getName
()
const
{
return
mName
;
if
(
mName
.
c_str
()
==
NULL
)
{
return
""
;
}
else
{
return
mName
;
}
}
shared_ptr
<
XdmfTime
>
...
...
@@ -143,7 +148,12 @@ XdmfGrid::populateItem(const std::map<std::string, std::string> & itemProperties
void
XdmfGrid
::
setName
(
const
std
::
string
&
name
)
{
mName
=
name
;
if
(
mName
.
c_str
()
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Internal Name String is a null reference"
);
}
else
{
mName
=
name
;
}
}
void
...
...
XdmfRectilinearGrid.cpp
View file @
db257fe6
...
...
@@ -324,7 +324,10 @@ XdmfRectilinearGrid::XdmfRectilinearGrid(const std::vector<shared_ptr<XdmfArray>
XdmfRectilinearGrid
::~
XdmfRectilinearGrid
()
{
delete
mImpl
;
if
(
mImpl
)
{
delete
mImpl
;
}
mImpl
=
NULL
;
}
const
std
::
string
XdmfRectilinearGrid
::
ItemTag
=
"Grid"
;
...
...
@@ -340,6 +343,9 @@ XdmfRectilinearGrid::getCoordinates(const unsigned int axisIndex)
shared_ptr
<
const
XdmfArray
>
XdmfRectilinearGrid
::
getCoordinates
(
const
unsigned
int
axisIndex
)
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Xdmf Rectilinear Grid Internal Object is NULL"
);
}
if
(
axisIndex
<
mImpl
->
mCoordinates
.
size
())
{
return
mImpl
->
mCoordinates
[
axisIndex
];
}
...
...
@@ -355,6 +361,9 @@ XdmfRectilinearGrid::getCoordinates()
const
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
XdmfRectilinearGrid
::
getCoordinates
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Xdmf Rectilinear Grid Internal Object is NULL"
);
}
return
mImpl
->
mCoordinates
;
}
...
...
@@ -368,6 +377,9 @@ XdmfRectilinearGrid::getDimensions()
shared_ptr
<
const
XdmfArray
>
XdmfRectilinearGrid
::
getDimensions
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Xdmf Rectilinear Grid Internal Object is NULL"
);
}
shared_ptr
<
XdmfArray
>
dimensions
=
XdmfArray
::
New
();
dimensions
->
reserve
(
mImpl
->
mCoordinates
.
size
());
for
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>::
const_iterator
iter
=
...
...
@@ -404,6 +416,9 @@ void
XdmfRectilinearGrid
::
setCoordinates
(
const
unsigned
int
axisIndex
,
const
shared_ptr
<
XdmfArray
>
axisCoordinates
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Xdmf Rectilinear Grid Internal Object is NULL"
);
}
if
(
mImpl
->
mCoordinates
.
size
()
<=
axisIndex
)
{
mImpl
->
mCoordinates
.
reserve
(
axisIndex
+
1
);
unsigned
int
numArraysToInsert
=
...
...
@@ -418,5 +433,8 @@ XdmfRectilinearGrid::setCoordinates(const unsigned int axisIndex,
void
XdmfRectilinearGrid
::
setCoordinates
(
const
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
axesCoordinates
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Xdmf Rectilinear Grid Internal Object is NULL"
);
}
mImpl
->
mCoordinates
=
axesCoordinates
;
}
XdmfRegularGrid.cpp
View file @
db257fe6
...
...
@@ -353,7 +353,10 @@ XdmfRegularGrid::XdmfRegularGrid(const shared_ptr<XdmfArray> brickSize,
XdmfRegularGrid
::~
XdmfRegularGrid
()
{
delete
mImpl
;
if
(
mImpl
)
{
delete
mImpl
;
}
mImpl
=
NULL
;
}
const
std
::
string
XdmfRegularGrid
::
ItemTag
=
"Grid"
;
...
...
@@ -368,6 +371,9 @@ XdmfRegularGrid::getBrickSize()
shared_ptr
<
const
XdmfArray
>
XdmfRegularGrid
::
getBrickSize
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
return
mImpl
->
mBrickSize
;
}
...
...
@@ -381,6 +387,9 @@ XdmfRegularGrid::getDimensions()
shared_ptr
<
const
XdmfArray
>
XdmfRegularGrid
::
getDimensions
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
return
mImpl
->
mDimensions
;
}
...
...
@@ -394,6 +403,9 @@ XdmfRegularGrid::getOrigin()
shared_ptr
<
const
XdmfArray
>
XdmfRegularGrid
::
getOrigin
()
const
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
return
mImpl
->
mOrigin
;
}
...
...
@@ -428,17 +440,26 @@ XdmfRegularGrid::populateItem(const std::map<std::string, std::string> & itemPro
void
XdmfRegularGrid
::
setBrickSize
(
const
shared_ptr
<
XdmfArray
>
brickSize
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
mImpl
->
mBrickSize
=
brickSize
;
}
void
XdmfRegularGrid
::
setDimensions
(
const
shared_ptr
<
XdmfArray
>
dimensions
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
mImpl
->
mDimensions
=
dimensions
;
}
void
XdmfRegularGrid
::
setOrigin
(
const
shared_ptr
<
XdmfArray
>
origin
)
{
if
(
mImpl
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Regular Grid Internal Object is NULL"
);
}
mImpl
->
mOrigin
=
origin
;
}
XdmfSet.cpp
View file @
db257fe6
...
...
@@ -67,7 +67,12 @@ XdmfSet::getItemTag() const
std
::
string
XdmfSet
::
getName
()
const
{
return
mName
;
if
(
mName
.
c_str
()
==
NULL
)
{
return
""
;
}
else
{
return
mName
;
}
}
shared_ptr
<
const
XdmfSetType
>
...
...
@@ -112,7 +117,12 @@ XdmfSet::populateItem(const std::map<std::string, std::string> & itemProperties,
void
XdmfSet
::
setName
(
const
std
::
string
&
name
)
{
mName
=
name
;
if
(
mName
.
c_str
()
==
NULL
)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Internal Name String is a null reference"
);
}
else
{
mName
=
name
;
}
}
void
...
...
core/XdmfCoreItemFactory.cpp
View file @
db257fe6
...
...
@@ -71,22 +71,46 @@ XdmfCoreItemFactory::createItem(const std::string & itemTag,
else
{
expressionToParse
=
expression
->
second
;
}
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
variableNames
=
itemProperties
.
find
(
"VariableNames"
);
std
::
vector
<
std
::
string
>
nameVector
;
std
::
string
variableList
=
variableNames
->
second
;
size_t
barSplit
=
0
;
std
::
string
subcontent
;
while
(
barSplit
!=
std
::
string
::
npos
)
{
barSplit
=
0
;
barSplit
=
variableList
.
find_first_of
(
"|"
,
barSplit
);
if
(
barSplit
==
std
::
string
::
npos
)
{
subcontent
=
variableList
;
}
else
{
subcontent
=
variableList
.
substr
(
0
,
barSplit
);
variableList
=
variableList
.
substr
(
barSplit
+
1
);
barSplit
++
;
}
nameVector
.
push_back
(
subcontent
);
}
std
::
map
<
std
::
string
,
shared_ptr
<
XdmfArray
>
>
variableCollection
;
for
(
unsigned
int
i
=
0
;
i
<
childItems
.
size
();
++
i
)
{
try
{
shared_ptr
<
XdmfArray
>
tempArray
=
shared_dynamic_cast
<
XdmfArray
>
(
childItems
[
i
]);
if
(
tempArray
->
getName
().
compare
(
""
)
!=
0
)
{
variableCollection
[
tempArray
->
getName
()]
=
tempArray
;
tempArray
->
read
();
for
(
unsigned
int
i
=
0
;
i
<
childItems
.
size
()
&&
i
<
nameVector
.
size
();
++
i
)
{
if
(
nameVector
[
i
].
compare
(
""
)
!=
0
)
{
if
(
shared_ptr
<
XdmfArray
>
array
=
shared_dynamic_cast
<
XdmfArray
>
(
childItems
[
i
]))
{
variableCollection
[
nameVector
[
i
]]
=
array
;
array
->
read
();
}
else
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Function passed non-Array item"
);
}
}
catch
(...)
{
XdmfError
::
message
(
XdmfError
::
FATAL
,
"Error: Function passed non-Array item"
);
}
}
shared_ptr
<
XdmfArray
>
parsedArray
=
shared_ptr
<
XdmfArray
>
();
parsedArray
=
XdmfFunction
::
evaluateExpression
(
expressionToParse
,
variableCollection
);
...
...
core/XdmfFunction.cpp
View file @
db257fe6
...
...
@@ -114,11 +114,11 @@ std::map<std::string, shared_ptr<XdmfFunction::XdmfFunctionInternal> >
XdmfFunction
::
abs
))
(
"ABS_TOKEN"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
XdmfFunction
::
abs
))
(
"A
RC
COS"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
(
"ACOS"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
XdmfFunction
::
arccos
))
(
"A
RC
SIN"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
(
"ASIN"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
XdmfFunction
::
arcsin
))
(
"A
RC
TAN"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
(
"ATAN"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
XdmfFunction
::
arctan
))
(
"AVE"
,
XdmfFunctionInternalImpl
::
New
((
shared_ptr
<
XdmfArray
>
(
*
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
XdmfFunction
::
average
))
...
...
@@ -349,15 +349,15 @@ XdmfFunction::arctan(std::vector<shared_ptr<XdmfArray> > values)
shared_ptr
<
XdmfArray
>
XdmfFunction
::
average
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
)
{
double
total
=
sum
(
values
)
->
getValue
<
double
>
(
0
);;
int
totalSize
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
++
i
)
{
totalSize
+=
values
[
i
]
->
getSize
();
}
shared_ptr
<
XdmfArray
>
returnArray
=
XdmfArray
::
New
();
returnArray
->
insert
(
0
,
total
/
totalSize
);
return
returnArray
;
double
total
=
sum
(
values
)
->
getValue
<
double
>
(
0
);;
int
totalSize
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
++
i
)
{
totalSize
+=
values
[
i
]
->
getSize
();
}
shared_ptr
<
XdmfArray
>
returnArray
=
XdmfArray
::
New
();
returnArray
->
insert
(
0
,
total
/
totalSize
);
return
returnArray
;
}
shared_ptr
<
XdmfArray
>
...
...
@@ -520,7 +520,7 @@ XdmfFunction::evaluateExpression(std::string expression,
}
}
// Found to be a digit
if
(
mValidDigitChars
.
find
(
expression
[
i
])
!=
std
::
string
::
npos
||
if
(
mValidDigitChars
.
find
(
expression
[
i
])
!=
std
::
string
::
npos
||
(
expression
[
i
]
==
'-'
&&
hyphenIsDigit
))
{
// Progress until a non-digit is found
int
valueStart
=
i
;
...
...
@@ -776,6 +776,16 @@ XdmfFunction::getItemProperties() const
functionProperties
[
constructedIt
->
first
]
=
constructedIt
->
second
;
}
std
::
stringstream
variableStream
;
for
(
std
::
map
<
std
::
string
,
shared_ptr
<
XdmfArray
>
>::
const_iterator
variableIter
=
mVariableList
.
begin
();
variableIter
!=
mVariableList
.
end
();
++
variableIter
)
{
variableStream
<<
"|"
<<
variableIter
->
first
;
}
functionProperties
[
"VariableNames"
]
=
variableStream
.
str
();
return
functionProperties
;
}
...
...
@@ -1157,7 +1167,6 @@ XdmfFunction::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
for
(
std
::
map
<
std
::
string
,
shared_ptr
<
XdmfArray
>
>::
iterator
it
=
mVariableList
.
begin
();
it
!=
mVariableList
.
end
();
++
it
)
{
it
->
second
->
setName
(
it
->
first
);
it
->
second
->
accept
(
visitor
);
}
}
core/XdmfFunction.hpp
View file @
db257fe6
...
...
@@ -130,6 +130,28 @@ public:
static
const
std
::
string
ItemTag
;
/**
* Takes the first array provided and returns an array containing
* the absolute value equivalent of that array.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfFunction.cpp
* @skipline //#abs
* @until //#abs
*
* Python
*
* @dontinclude XdmfExampleFunction.py
* @skipline #//abs
* @until #//abs
*
* @param values A vector containing the array to be used
* @return An XdmfArray containing the absolute value
* equivalent of the first array
*/
static
shared_ptr
<
XdmfArray
>
abs
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/*
...
...
@@ -279,12 +301,112 @@ public:
shared_ptr
<
XdmfOperationInternal
>
newOperation
,
int
priority
);
/**
* Takes the arrays provided adds them together, returning the result.
*
* If the first array has one value an array is generated adding
* it to each value of the second array.
*
* If the second array has one value. That value is added to
* all values in the first array.
*
* If both arrays have the same number of values, the
* value of the first array is added to the value of the second array
* with the same index.
*
* An error is thrown if the array sizes are both large than 1
* and do not match.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfFunction.cpp
* @skipline //#addition
* @until //#addition
*
* Python
*
* @dontinclude XdmfExampleFunction.py
* @skipline #//addition
* @until #//addition
*
* @param values A vector containing the array to be used
* @return An XdmfArray containing the sums
* of the values of the arrays
*/
static
shared_ptr
<
XdmfArray
>
addition
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
);
/**
* Takes the first array provided and returns an array containing
* the arcsin of all the values in that array.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfFunction.cpp
* @skipline //#arcsin
* @until //#arcsin
*
* Python
*
* @dontinclude XdmfExampleFunction.py
* @skipline #//arcsin
* @until #//arcsin
*
* @param values A vector containing the array to be used
* @return An XdmfArray containing the arcsin of the
* values of the first array
*/
static
shared_ptr
<
XdmfArray
>
arcsin
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/**
* Takes the first array provided and returns an array containing
* the arccos of all the values in that array.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfFunction.cpp
* @skipline //#arccos
* @until //#arccos
*
* Python
*
* @dontinclude XdmfExampleFunction.py
* @skipline #//arccos
* @until #//arccos
*
* @param values A vector containing the array to be used
* @return An XdmfArray containing the arccos of the