Commit 08a05864 authored by Kitware Robot's avatar Kitware Robot Committed by David E. DeMarle

xdmf3 2016-06-16 (cdb48e8e)

Code extracted from:

    git://xdmf.org/Xdmf.git

at commit cdb48e8ed4c736733631dd13e65da97f89313d23 (master).
parent f98573a5
* -whitespace
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
set(XDMF_DSM_IS_CRAY "@XDMF_DSM_IS_CRAY@")
if (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}${SEPARATOR}${LDPATH}")
else (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
endif (XDMF_DSM_IS_CRAY)
SET(ENV{MPIEXEC} "@MPIEXEC@")
MESSAGE("| Calling:\t${EXECUTABLE} ${ARGUMENTS}")
......
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
set(XDMF_DSM_IS_CRAY "@XDMF_DSM_IS_CRAY@")
if (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}${SEPARATOR}${LDPATH}")
else (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
endif (XDMF_DSM_IS_CRAY)
SET(ENV{MPIEXEC} "@MPIEXEC@")
MESSAGE("| Calling:\t${EXECUTABLE} ${ARGUMENTS}")
......
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
set(XDMF_DSM_IS_CRAY "@XDMF_DSM_IS_CRAY@")
if (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}${SEPARATOR}${LDPATH}")
else (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
endif (XDMF_DSM_IS_CRAY)
SET(ENV{MPIEXEC} "@MPIEXEC@")
MESSAGE("| Calling:\t${EXECUTABLE} ${ARGUMENTS}")
......
......@@ -3,7 +3,13 @@ SET(python_binary_dir "@CMAKE_CURRENT_BINARY_DIR@")
SET(ENV{PYTHONPATH} "${PYTHONPATH}${SEPARATOR}$ENV{PYTHONPATH}")
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
set(XDMF_DSM_IS_CRAY "@XDMF_DSM_IS_CRAY@")
if (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}${SEPARATOR}${LDPATH}")
else (XDMF_DSM_IS_CRAY)
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
endif (XDMF_DSM_IS_CRAY)
MESSAGE("| Calling:\t${python_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS(
......
......@@ -3,7 +3,16 @@ SET(python_binary_dir "@CMAKE_CURRENT_BINARY_DIR@")
SET(ENV{PYTHONPATH} "${PYTHONPATH}${SEPARATOR}$ENV{PYTHONPATH}")
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
set(XDMF_DSM_IS_CRAY "@XDMF_DSM_IS_CRAY@")
if (XDMF_DSM_IS_CRAY)
# message("Cray Style")
SET(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}${SEPARATOR}${LDPATH}")
else (XDMF_DSM_IS_CRAY)
# message("Normal Style")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
endif (XDMF_DSM_IS_CRAY)
SET(ENV{PYTHON_EXECUTABLE} "${python_runtime}")
SET(ENV{MPIEXEC} "@MPIEXEC@")
......
......@@ -82,5 +82,10 @@ MACRO(SET_CORE dir)
STRING(REGEX MATCH "core" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Core")
ENDIF()
ENDMACRO()
ELSE(EXISTS ${is_core})
STRING(REGEX MATCH "utils" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Util")
ENDIF(EXISTS ${is_core})
ENDIF(EXISTS ${is_core})
ENDMACRO(SET_CORE dir)
......@@ -19,27 +19,31 @@ class ProjectVersion {
*
* @param name of the project
*/
ProjectVersion(std::string iProjectName, int iMajor, int iMinor) {
setProjectName(iProjectName);
setMajor(iMajor);
setMinor(iMinor);
}
ProjectVersion(std::string iProjectName, int iMajor, int iMinor, int iPatch) {
setProjectName(iProjectName);
setMajor(iMajor);
setMinor(iMinor);
setPatch(iPatch);
}
ProjectVersion(std::string iProjectName,
std::string iMajor, std::string iMinor) {
setProjectName(iProjectName);
setMajorStr(iMajor);
setMinorStr(iMinor);
}
/**
* Get the version string
*
* @return the Version in "ProjectName Major.Minor" string format
*/
std::string iMajor, std::string iMinor, std::string iPatch) {
setProjectName(iProjectName);
setMajorStr(iMajor);
setMinorStr(iMinor);
setPatchStr(iPatch);
}
/**
* Get the version string
*
* @return the Version in "ProjectName Major.Minor.Patch" string format
*/
std::string getFull() {
return getProjectName()+std::string(" ")+
getMajorStr()+std::string(".")+
getMinorStr();
return getProjectName()+std::string(" ")+
getMajorStr()+std::string(".")+
getMinorStr()+std::string(".")+
getPatchStr();
}
/**
......@@ -47,79 +51,101 @@ class ProjectVersion {
*
* @return the Version in "Major.Minor" string format
*/
std::string getShort() {
return getMajorStr()+std::string(".")+
getMinorStr();
}
std::string getShort() {
return getMajorStr()+std::string(".")+
getMinorStr();
}
/**
/**
* Get the version objects project name
*
* @return the project name in string format
*/
std::string getProjectName() { return ProjectName; }
/**
/**
* Get the Version Major
*
* @return the Version Major in string format
*/
std::string getMajorStr()
{
std::string getMajorStr()
{
if(Major != -1) return IntToStr(Major);
return("X");
}
/**
/**
* Get the Version Minor
*
* @return the Version Minor in string format
*/
std::string getMinorStr()
{
{
if(Minor != -1) return IntToStr(Minor);
return("X");
}
/**
/**
* Get the Version Patch
*
* @return the Version Patch in string format
*/
std::string getPatchStr()
{
if(Patch != -1) return IntToStr(Patch);
return("X");
}
/**
* Get the Version Major
*
* @return the Version Major in int format
*/
int getMajor() { return Major; }
/**
/**
* Get the Version Minor
*
* @return the Version Minor in int format
*/
int getMinor() { return Minor; }
/**
* Get the Version Patch
*
* @return the Version Patch in int format
*/
int getPatch() { return Patch; }
private:
std::string ProjectName;
int Major, Minor;
int Major, Minor, Patch;
std::string IntToStr(int number) {
std::stringstream s;
s << number;
return s.str();
}
std::string IntToStr(int number) {
std::stringstream s;
s << number;
return s.str();
}
int StrToInt(std::string string) {
int i = 0;
std::stringstream s(string);
if(!(s >> i)) return -1;
return i;
int i = 0;
std::stringstream s(string);
if(!(s >> i)) return -1;
return i;
}
void setProjectName(std::string iProjectName)
{ ProjectName = iProjectName; }
{ ProjectName = iProjectName; }
void setMajor(int iMajor) { Major = iMajor; }
void setMajorStr(std::string iMajor) {
Major = StrToInt(iMajor);
Major = StrToInt(iMajor);
}
void setMinor(int iMinor) { Minor = iMinor; }
void setMinorStr(std::string iMinor) {
Minor = StrToInt(iMinor);
Minor = StrToInt(iMinor);
}
void setPatch(int iPatch) { Patch = iPatch; }
void setPatchStr(std::string iPatch) {
Patch = StrToInt(iPatch);
}
};
......
......@@ -14,11 +14,16 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/CMake/VersionSuite)
# Default incase CalculateVerison is not called
SET(vMajor "0")
SET(vMinor "0")
SET(vPatch "0")
# This Macro allows you to set up the Version in a one liner
MACRO(VersionCreate versionName versionMajor export_name)
MACRO(VersionCreate versionName versionMajor versionMinor versionPatch export_name)
VersionMajorSet(${versionMajor})
VersionCalculate()
VersionMinorSet(${versionMinor})
VersionPatchSet(${versionPatch})
# Manually generating minor version
# VersionCalculate()
VersionWrite(${versionName} ${export_name} "${ARGN}")
ENDMACRO()
......@@ -27,6 +32,14 @@ MACRO(VersionMajorSet versionMajor)
SET(vMajor ${versionMajor})
ENDMACRO()
MACRO(VersionMinorSet versionMinor)
SET(vMinor ${versionMinor})
ENDMACRO(VersionMinorSet)
MACRO(VersionPatchSet versionPatch)
SET(vPatch ${versionPatch})
ENDMACRO(VersionPatchSet)
# This Macro calculates the number of tags from your git repo
MACRO(VersionCalculate)
FIND_PACKAGE(Git)
......@@ -53,6 +66,7 @@ MACRO(VersionWrite vProjectName export_name)
"/* Current Version of ${vProjectName}
* Major is: ${vMajor}
* Minor is: ${vMinor}
* Patch is: ${vPatch}
*/
${includes}
\#include \"ProjectVersion.hpp\"
......@@ -64,6 +78,6 @@ extern ${export_name} ProjectVersion ${vProjectName}Version;\n"
* Make sure to include this file in your built sources
*/
\#include \"${vProjectName}Version.hpp\"
ProjectVersion ${vProjectName}Version = ProjectVersion(\"${vProjectName}\", \"${vMajor}\", \"${vMinor}\");\n"
ProjectVersion ${vProjectName}Version = ProjectVersion(\"${vProjectName}\", \"${vMajor}\", \"${vMinor}\", \"${vPatch}\");\n"
)
ENDMACRO()
......@@ -31,6 +31,14 @@ if(XDMF_BUILD_TESTING)
include(CTest)
endif()
if (BUILD_SHARED_LIBS)
#STRING(REGEX MATCH "-fPIC" IS_FPIC "${CMAKE_CXX_FLAGS}")
#if ("${IS_FPIC}" STREQUAL "")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
#endif ("${IS_FPIC}" STREQUAL "")
add_definitions(-DXDMFSTATIC)
endif (BUILD_SHARED_LIBS)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
......@@ -63,6 +71,19 @@ endif()
option(XDMF_WRAP_PYTHON OFF)
option(XDMF_WRAP_JAVA OFF)
#check for TIFF
find_package(TIFF)
if (TIFF_FOUND)
add_definitions(-DXDMF_BUILD_TIFF)
mark_as_advanced(FORCE TIFF_INCLUDE_DIR)
mark_as_advanced(FORCE TIFF_LIBRARIES)
mark_as_advanced(FORCE TIFF_LIBRARY)
include_directories(${TIFF_INCLUDE_DIR})
get_filename_component(TIFF_LIBRARY_DIR "${TIFF_LIBRARY}" PATH)
set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${TIFF_LIBRARY_DIR})
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${TIFF_LIBRARIES})
endif (TIFF_FOUND)
# Test for DSM
option(XDMF_BUILD_DSM OFF)
mark_as_advanced(XDMF_BUILD_DSM)
......@@ -85,6 +106,7 @@ if(XDMF_BUILD_DSM)
mark_as_advanced(FORCE PYTHON_INCLUDE_MPI4PY_DIR)
set(PYTHON_INCLUDE_MPI4PY_DIR "" CACHE STRING "Directory containing mpi4py/mpi4py.i")
endif ()
add_definitions(-DXDMF_BUILD_DSM)
endif()
# If we are wrapping either, we need swig
......@@ -121,7 +143,7 @@ if(XDMF_WRAP_PYTHON)
# Output:
# Target Name = the output target name will have ${python_name} as its name
macro(XDMF_SWIG_PYTHON python_name)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR})
# optimize swig generation --- these are all flags corresponding to -O
# except -fvirtual which breaks visitor operation
set(CMAKE_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -modern -fastdispatch -nosafecstrings -noproxydel -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone)
......@@ -146,7 +168,7 @@ if(XDMF_WRAP_PYTHON)
endif()
if(WIN32)
if(NOT MSVC10)
if(NOT MSVC10)
set_target_properties(${SWIG_MODULE_${python_name}Python_REAL_NAME}
PROPERTIES
PREFIX ../
......@@ -154,14 +176,13 @@ if(XDMF_WRAP_PYTHON)
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
endif()
set_target_properties(${SWIG_MODULE_${python_name}Python_REAL_NAME}
PROPERTIES
OUTPUT_NAME "_${python_name}")
string(TOUPPER ${python_name} python_name_upper)
set(${python_name_upper}_PYTHON
${CMAKE_INSTALL_PREFIX}/lib/python/${python_name}.py)
......@@ -196,9 +217,9 @@ if(XDMF_WRAP_JAVA)
# Target Name = the output target name will have ${java_name}Java as its name
# Target Jar = the output target jar will have ${java_name}Java.jar as its name
macro(XDMF_SWIG_JAVA java_name)
set(${java_name}_JAVA_JAR ${CMAKE_CURRENT_BINARY_DIR}/${java_name}.jar)
set(${java_name}_JAVA_JAR ${CMAKE_BINARY_DIR}/${java_name}.jar)
set(XDMF_JAVA_PACKAGE_DIR mil/army/arl/xdmf)
set(XDMF_JAVA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
set(XDMF_JAVA_DIR ${CMAKE_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
set(CMAKE_SWIG_OUTDIR ${XDMF_JAVA_DIR})
set(CMAKE_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -v -make_default -package mil.army.arl.xdmf)
set_source_files_properties(${java_name}.i PROPERTIES CPLUSPLUS ON)
......@@ -272,6 +293,7 @@ link_directories(${XDMF_LIBRARY_DIRS})
option(XDMF_BUILD_CORE_ONLY OFF)
if(NOT XDMF_BUILD_CORE_ONLY)
set(XdmfSources
XdmfAggregate
XdmfAttribute
XdmfAttributeCenter
XdmfAttributeType
......@@ -283,6 +305,8 @@ if(NOT XDMF_BUILD_CORE_ONLY)
XdmfGrid
XdmfGridCollection
XdmfGridCollectionType
XdmfGridController
XdmfGridTemplate
XdmfItemFactory
XdmfMap
XdmfReader
......@@ -290,17 +314,34 @@ if(NOT XDMF_BUILD_CORE_ONLY)
XdmfRegularGrid
XdmfSet
XdmfSetType
XdmfTemplate
XdmfTime
XdmfTopology
XdmfTopologyType
XdmfUnstructuredGrid)
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources})
add_library(XdmfObjects OBJECT ${XdmfSources})
set_target_properties(XdmfObjects PROPERTIES
POSITION_INDEPENDENT_CODE True)
add_library(${XDMF_LIBNAME} $<TARGET_OBJECTS:XdmfObjects>)
if (BUILD_SHARED_LIBS)
add_library(Xdmf_Static STATIC $<TARGET_OBJECTS:XdmfObjects>)
if (UNIX)
set_target_properties(Xdmf_Static PROPERTIES
OUTPUT_NAME "Xdmf")
endif (UNIX)
endif (BUILD_SHARED_LIBS)
if(XDMF_BUILD_DSM)
target_link_libraries(${XDMF_LIBNAME} XdmfCore XdmfDSM)
else()
if (BUILD_SHARED_LIBS)
target_link_libraries(Xdmf_Static XdmfCore_Static XdmfDSM_Static)
endif (BUILD_SHARED_LIBS)
else(XDMF_BUILD_DSM)
target_link_libraries(${XDMF_LIBNAME} XdmfCore)
endif()
if (BUILD_SHARED_LIBS)
target_link_libraries(Xdmf_Static XdmfCore_Static)
endif (BUILD_SHARED_LIBS)
endif(XDMF_BUILD_DSM)
if (COMMAND vtk_target_install)
vtk_target_install(${XDMF_LIBNAME})
endif()
......@@ -308,25 +349,42 @@ if(NOT XDMF_BUILD_CORE_ONLY)
if(WIN32)
if (BUILD_SHARED_LIBS)
set_target_properties(${XDMF_LIBNAME} PROPERTIES
DEFINE_SYMBOL XDMF_EXPORTS)
endif()
DEFINE_SYMBOL Xdmf_EXPORTS)
set_target_properties(Xdmf_Static PROPERTIES
DEFINE_SYMBOL Xdmf_EXPORTS)
endif ()
if(NOT MSVC10)
set_target_properties(${XDMF_LIBNAME} PROPERTIES
set_target_properties(${XDMF_LIBNAME} PROPERTIES
PREFIX ../
IMPORT_PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
if (BUILD_SHARED_LIBS)
set_target_properties(Xdmf_Static PROPERTIES
PREFIX ../
IMPORT_PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif ()
endif()
endif()
if(XDMF_WRAP_JAVA)
XDMF_SWIG_JAVA(${XDMF_LIBNAME} Compiled_XdmfCore_Jar)
endif()
if(XDMF_WRAP_PYTHON)
XDMF_SWIG_PYTHON(${XDMF_LIBNAME} XdmfCore XdmfDSM)
if (NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "Python Wrappers do not function"
" properly without shared libraries")
endif (NOT BUILD_SHARED_LIBS)
if (XDMF_BUILD_DSM)
XDMF_SWIG_PYTHON(${XDMF_LIBNAME} XdmfCore XdmfDSM)
else()
XDMF_SWIG_PYTHON(${XDMF_LIBNAME} XdmfCore)
endif()
set(XDMF_PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib/python/)
endif()
......@@ -344,8 +402,12 @@ if(NOT XDMF_BUILD_CORE_ONLY)
endif()
if(UNIX)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.so)
endif()
if (BUILD_SHARED_LIBS)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.so)
else (BUILD_SHARED_LIBS)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.a)
endif (BUILD_SHARED_LIBS)
endif(UNIX)
if(APPLE)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.dylib)
......@@ -363,6 +425,12 @@ if(NOT XDMF_BUILD_CORE_ONLY)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if (BUILD_SHARED_LIBS)
install(TARGETS Xdmf_Static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (BUILD_SHARED_LIBS)
endif()
xdmf_create_config_file(${PROJECT_NAME})
......
SET(CTEST_NIGHTLY_START_TIME "00:00:00 EDT")
SET(CTEST_PROJECT_NAME "Xdmf")
SET(CTEST_PROJECT_NAME "XDMF")
SET(CTEST_DROP_METHOD "https")
SET(CTEST_DROP_SITE "hsai-web-origin.arl.army.mil")
SET(CTEST_DROP_LOCATION "/hsai/CDash/submit.php?project=Xdmf2")
SET(CTEST_DROP_SITE "open.cdash.org")
SET(CTEST_DROP_LOCATION "/submit.php?project=XDMF")
SET(CTEST_DROP_SITE_CDASH True)
SET(CTEST_CURL_OPTIONS "CURLOPT_SSL_VERIFYPEER_OFF;CURLOPT_SSL_VERIFYHOST_OFF")
......@@ -76,6 +76,9 @@
* a topology could be shared across multiple grids or a grid
* could be included in multiple grid collections and/or the domain.
*
* Comparing objects is done by comparing pointer addresses,
* a deep copy will not produce an equivalent object.
*
*
* C++ Examples:
*
......
/*****************************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : XdmfAggregate.cpp */
/* */
/* Author: */
/* Andrew Burns */
/* andrew.j.burns2@us.army.mil */
/* US Army Research Laboratory */
/* Aberdeen Proving Ground, MD */
/* */
/* Copyright @ 2013 US Army Research Laboratory */
/* All Rights Reserved */
/* See Copyright.txt for details */
/* */
/* This software is distributed WITHOUT ANY WARRANTY; without */
/* even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE. See the above copyright notice */
/* for more information. */
/* */
/*****************************************************************************/
#include <numeric>
#include <functional>
#include <boost/tokenizer.hpp>
#include "XdmfArray.hpp"
#include "XdmfError.hpp"
#include "XdmfAggregate.hpp"
#include "XdmfVisitor.hpp"
#include "XdmfWriter.hpp"
#include "string.h"
XDMF_CHILDREN_IMPLEMENTATION(XdmfAggregate, XdmfArray, Array, Name)
XdmfAggregate::XdmfAggregate()
{
}
XdmfAggregate::XdmfAggregate(XdmfAggregate & refAggregate) :
XdmfArrayReference(refAggregate)
{
}
XdmfAggregate::~XdmfAggregate()
{
}
const std::string XdmfAggregate::ItemTag = "Aggregate";
shared_ptr<XdmfAggregate>
XdmfAggregate::New()
{
shared_ptr<XdmfAggregate> p(new XdmfAggregate());
return p;
}
std::vector<unsigned int> XdmfAggregate::getDimensions() const
{
std::vector<unsigned int> testDims = mArrays[0]->getDimensions();
bool isSame = true;
for(std::vector<shared_ptr<XdmfArray> >::const_iterator iter =
mArrays.begin();
iter != mArrays.end() && isSame;
++iter) {
std::vector<unsigned int> compareDims = (*iter)->getDimensions();
if (compareDims.size() == testDims.size())
{
for (unsigned int i = 0; i < testDims.size(); ++i)
{
if (compareDims[i] != testDims[i])
{
isSame = false;
break;
}
}
}
else
{
isSame = false;
break;
}
}
if (isSame)
{
testDims.push_back(mArrays.size());
return testDims;
}
else
{
std::vector<unsigned int> returnDims;
returnDims.push_back(this->getSize());
return returnDims;
}
}
std::map<std::string, std::string>
XdmfAggregate::getItemProperties() const
{
std::map<std::string, std::string> aggregateMap = XdmfArrayReference::getItemProperties();
return aggregateMap;
}
std::string
XdmfAggregate::getItemTag() const
{
return ItemTag;
}
unsigned int
XdmfAggregate::getSize() const
{
unsigned int total = 0;
for(std::vector<shared_ptr<XdmfArray> >::const_iterator iter =
mArrays.begin();
iter != mArrays.end();
++iter) {
total += (*iter)->getSize();
}
return total;
}
void
XdmfAggregate::populateItem(const std::map<std::string, std::string> & itemProperties,
const std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader)
{
bool placeholderFound =