Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Getting Data Into ICE through ICE-IO
This tutorial provides a detailed example for integrating an HDF5 data file into ICE for reactor analysis.
Contents
Requirements
This section provides a description of prerequisites for compiling the ICE-IO C++ package.
In order to compile ICE-IO, you need the following tools:
- CMake 2.8 or later
- Boost 1.35 or later
- HDF5 with CPP support
Boost and HDF5 depend on CMake to utilize these pieces correctly. If you are using a local install of HDF5 or Boost or wish to override the root installs of these libraries, then the following variables can be set in your .bashrc or called on the command line in order to override the Boost or HDF5 install directories:
HDF5_ROOT =/path/to/hdf5/install
BOOST_ROOT=/path/to/boost/install
Installing ICE-IO Locally
Once you have installed the software required for ICE-IO as detailed in the section above, you can download and build ICE-IO to your local machine.
Checking out ICE-IO Source from the Public Repository
The entire ICE-IO package for C++ is stored in two locations within the trunk: src/native and tests/native. When you checkout ICE-IO, it is easier to checkout the entire trunk and work from there to do an entire install of ICE. If you wish to only checkout the source code, then you can do so, but the root CMakeFile.txt located in the trunk will need to be modified to edit out the test.
To start, open up a terminal to your home directory. You will need to checkout the entire ICE trunk repository with the following command:
user@localhost ~ > svn checkout https://svn.code.sf.net/p/niceproject/code/trunk nice-trunk
This command will take a few moments to complete. If the link in the above command is out of date, please visit the ICE SourceForge page, click on the Code link, and use the Read Only access address available there.
Navigate to the newly-created ice-trunk directory and list the directory's contents. It should look something like the following:
user@localhost ~ > cd nice-trunk/
user@localhost ~/nice-trunk > ls
build CMakeLists.txt deps docs Doxyfile.in examples features license model repository scripts src storyboards targets tests themes UseDoxygen.cmake web
user@localhost ~/nice-trunk >
Compiling ICE-IO from Source
Before compiling the ICE-IO library, you need to determine where you want to install them. If you have administrative privileges on your machine, then the libraries will install to /usr/local/lib. If you do not have administrative privileges, then you need to install ICE-IO to your home area. In the example commands below, I installed ICE-IO to /home/user/niceIO.
First, make a new directory in the checked out ICE trunk directory and navigate to it as in the command below.
user@localhost ~/nice-trunk > mkdir niceIO; cd niceIO
user@localhost ~/nice-trunk/niceIO >
We will need to run our compilation with CMake in this directory. Use the command below to run CMake for ICE-IO.
Note (1): You need to substitute your installation path for the HDF5 libraries in the -DHDF5_DIR=/opt/hdf5-1.8.10_mpich-3.0rc1_gcc-4.4.6/ flag.
Note (2): If you do not have administrative privileges on your machine, you need to substitute your desired installation path for ICE in the -DCMAKE_INSTALL_PREFIX:PATH=/home/user/niceIO flag.
user@localhost ~/nice-trunk/niceIO > /opt/cmake-2.8.10.2_gcc-4.4.6/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/user/niceIO -DCMAKE_CXX_FLAGS=-pg -DHDF5_DIR=/opt/hdf5-1.8.10_mpich-3.0rc1_gcc-4.4.6/ ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.41.0
-- Found HDF5: /usr/lib64/libhdf5_cpp.so;/usr/lib64/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libm.so
-- Found Doxygen: /usr/bin/doxygen (found version "1.6.1")
-- Found DOXYFILE_IN: /home/user/nice-trunk/Doxyfile.in
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/nice-trunk/niceIO
user@localhost ~/nice-trunk/niceIO >
Next, you need to run make to build the ICE-IO library. You will get a lot of output from this command, some of which I have omitted here. Run the following command:
user@localhost ~/nice-trunk/niceIO > make -j32
Scanning dependencies of target NiCEIO
[ 3%] [ 3%] [ 5%] Building CXX object src/native/gov.ornl.nice.io.native/hdf/CMakeFiles/NiCEIO.dir/HdfFileFactory.cpp.o
Building CXX object src/native/gov.ornl.nice.io.native/hdf/CMakeFiles/NiCEIO.dir/HdfReaderFactory.cpp.o
Building CXX object src/native/gov.ornl.nice.io.native/hdf/CMakeFiles/NiCEIO.dir/HdfWriterFactory.cpp.o
Linking CXX shared library libNiCEIO.so
[ 5%] Built target NiCEIO
Scanning dependencies of target NiCEReactor
Scanning dependencies of target HdfFileFactoryTester
Scanning dependencies of target HdfWriterFactoryTester
.
.
.
Linking CXX executable LWRGridManagerTester
[100%] Built target LWRComponentWriterTester
[100%] Built target PWRAssemblyTester
[100%] Built target LWRGridManagerTester
[100%] Built target GridLocationTester
[100%] Built target FuelAssemblyTester
user@localhost ~/nice-trunk/niceIO >
Next, you need to make sure the binaries compiled successfully by running the tests. To do this, run the following command:
user@localhost ~/nice-trunk/niceIO > make test Running tests... Test project /home/user/nice-trunk/niceIO Start 1: HdfReaderFactoryTester 1/27 Test #1: HdfReaderFactoryTester ........... Passed 0.02 sec Start 2: HdfFileFactoryTester 2/27 Test #2: HdfFileFactoryTester ............. Passed 0.02 sec Start 3: HdfWriterFactoryTester 3/27 Test #3: HdfWriterFactoryTester ........... Passed 0.03 sec Start 4: TubeTester 4/27 Test #4: TubeTester ....................... Passed 0.03 sec Start 5: MaterialTester 5/27 Test #5: MaterialTester ................... Passed 0.03 sec Start 6: HDF5LWRTagTypeTester 6/27 Test #6: HDF5LWRTagTypeTester ............. Passed 0.02 sec Start 7: GridLabelProviderTester 7/27 Test #7: GridLabelProviderTester .......... Passed 0.04 sec Start 8: LWRComponentReaderTester 8/27 Test #8: LWRComponentReaderTester ......... Passed 0.08 sec Start 9: GridLocationTester 9/27 Test #9: GridLocationTester ............... Passed 0.01 sec Start 10: LWRCompositeTester 10/27 Test #10: LWRCompositeTester ............... Passed 0.03 sec Start 11: LWRComponentWriterTester 11/27 Test #11: LWRComponentWriterTester ......... Passed 0.05 sec Start 12: MaterialBlockTester 12/27 Test #12: MaterialBlockTester .............. Passed 0.03 sec Start 13: LWRComponentTester 13/27 Test #13: LWRComponentTester ............... Passed 0.04 sec Start 14: FeatureSetTester 14/27 Test #14: FeatureSetTester ................. Passed 0.01 sec Start 15: LWReactorTester 15/27 Test #15: LWReactorTester .................. Passed 0.03 sec Start 16: LWRRodTester 16/27 Test #16: LWRRodTester ..................... Passed 0.03 sec Start 17: LWRDataProviderTester 17/27 Test #17: LWRDataProviderTester ............ Passed 0.02 sec Start 18: LWRDataTester 18/27 Test #18: LWRDataTester .................... Passed 0.02 sec Start 19: RingTester 19/27 Test #19: RingTester ....................... Passed 0.03 sec Start 20: LWRGridManagerTester 20/27 Test #20: LWRGridManagerTester ............. Passed 0.04 sec Start 21: BWReactorTester 21/27 Test #21: BWReactorTester .................. Passed 0.01 sec Start 22: PWRAssemblyTester 22/27 Test #22: PWRAssemblyTester ................ Passed 0.04 sec Start 23: RodClusterAssemblyTester 23/27 Test #23: RodClusterAssemblyTester ......... Passed 0.03 sec Start 24: FuelAssemblyTester 24/27 Test #24: FuelAssemblyTester ............... Passed 0.05 sec Start 25: ControlBankTester 25/27 Test #25: ControlBankTester ................ Passed 0.03 sec Start 26: PressurizedWaterReactorTester 26/27 Test #26: PressurizedWaterReactorTester .... Passed 0.10 sec Start 27: IncoreInstrumentTester 27/27 Test #27: IncoreInstrumentTester ........... Passed 0.03 sec 100% tests passed, 0 tests failed out of 27 Total Test time (real) = 0.93 sec user@localhost ~/nice-trunk/iceIO >
The last thing to do is install the now successfully tested ICE-IO library. To do this, run make install as in the below command:
user@localhost ~/nice-trunk/niceIO > make install
[ 5%] Built target NiCEIO
[ 47%] Built target NiCEReactor
[ 49%] Built target HdfFileFactoryTester
[ 50%] Built target HdfReaderFactoryTester
[ 52%] Built target HdfWriterFactoryTester
[ 54%] Built target BWReactorTester
[ 56%] Built target ControlBankTester
[ 57%] Built target FeatureSetTester
[ 59%] Built target FuelAssemblyTester
[ 61%] Built target GridLabelProviderTester
[ 63%] Built target GridLocationTester
[ 64%] Built target HDF5LWRTagTypeTester
[ 66%] Built target IncoreInstrumentTester
[ 68%] Built target LWRComponentReaderTester
[ 70%] Built target LWRComponentTester
[ 71%] Built target LWRComponentWriterTester
[ 73%] Built target LWRCompositeTester
[ 75%] Built target LWRDataProviderTester
[ 77%] Built target LWRDataTester
[ 78%] Built target LWRGridManagerTester
[ 80%] Built target LWRRodTester
[ 82%] Built target LWReactorTester
[ 84%] Built target MaterialBlockTester
[ 85%] Built target MaterialTester
[ 87%] Built target PWRAssemblyTester
[ 89%] Built target PressurizedWaterReactorTester
[ 91%] Built target RingTester
[ 92%] Built target RodClusterAssemblyTester
[ 94%] Built target TubeTester
[ 96%] Built target SampleReactor
[ 98%] Built target TestDriver
[100%] Built target WriteReactorExample
Install the project...
-- Install configuration: ""
-- Installing: /home/user/niceIO/lib/libNiCEIO.so
-- Installing: /home/user/niceIO/include/IHdfWriter.h
-- Installing: /home/user/niceIO/include/HdfReaderFactory.h
-- Installing: /home/user/niceIO/include/IHdfReadable.h
-- Installing: /home/user/niceIO/include/IHdfWriteable.h
-- Installing: /home/user/niceIO/include/IHdfReader.h
-- Installing: /home/user/niceIO/include/HdfFileFactory.h
-- Installing: /home/user/niceIO/include/HdfWriterFactory.h
-- Installing: /home/user/niceIO/include/componentVisitor/IComponentVisitor.h
-- Installing: /home/user/niceIO/include/NiCEObject/Persistable.h
-- Installing: /home/user/niceIO/include/NiCEObject/Identifiable.h
-- Installing: /home/user/niceIO/include/updateableComposite/IComponentListener.h
-- Installing: /home/user/niceIO/include/updateableComposite/Component.h
-- Installing: /home/user/niceIO/include/updateableComposite/IUpdateable.h
-- Installing: /home/user/niceIO/include/updateableComposite/Composite.h
-- Installing: /home/user/niceIO/lib/libNiCEReactor.so
-- Removed runtime path from "/home/user/niceIO/lib/libNiCEReactor.so"
-- Installing: /home/user/niceIO/include/UtilityOperations.h
-- Installing: /home/user/niceIO/include/LWRComponent.h
-- Installing: /home/user/niceIO/include/IData.h
-- Installing: /home/user/niceIO/include/Tube.h
-- Installing: /home/user/niceIO/include/LWRComposite.h
-- Installing: /home/user/niceIO/include/LWReactor.h
-- Installing: /home/user/niceIO/include/LWRDataProvider.h
-- Installing: /home/user/niceIO/include/LWRData.h
-- Installing: /home/user/niceIO/include/FeatureSet.h
-- Installing: /home/user/niceIO/include/IGridManager.h
-- Installing: /home/user/niceIO/include/MaterialBlock.h
-- Installing: /home/user/niceIO/include/IDataProvider.h
-- Installing: /home/user/niceIO/include/GridLabelProvider.h
-- Installing: /home/user/niceIO/include/LWRRod.h
-- Installing: /home/user/niceIO/include/GridLocation.h
-- Installing: /home/user/niceIO/include/LWRComponentWriter.h
-- Installing: /home/user/niceIO/include/Ring.h
-- Installing: /home/user/niceIO/include/LWRGridManager.h
-- Installing: /home/user/niceIO/include/LWRComponentReader.h
-- Installing: /home/user/niceIO/include/MaterialType.h
-- Installing: /home/user/niceIO/include/AssemblyType.h
-- Installing: /home/user/niceIO/include/Material.h
-- Installing: /home/user/niceIO/include/HDF5LWRTagType.h
-- Installing: /home/user/niceIO/include/TubeType.h
-- Installing: /home/user/niceIO/include/bwr/BWReactor.h
-- Installing: /home/user/niceIO/include/pwr/PressurizedWaterReactor.h
-- Installing: /home/user/niceIO/include/pwr/PWRAssembly.h
-- Installing: /home/user/niceIO/include/pwr/FuelAssembly.h
-- Installing: /home/user/niceIO/include/pwr/ControlBank.h
-- Installing: /home/user/niceIO/include/pwr/IncoreInstrument.h
-- Installing: /home/user/niceIO/include/pwr/RodClusterAssembly.h
user@localhost ~/nice-trunk/niceIO >
Once you have done this, you have successfully built and installed ICE-IO!
However, if you do not have administrative privileges, there is one last step that will need to be done before proceeding. When linking ICE-IO to a program, the g++ linker may not be able to find ICE-IO in your installation directory (i.e., a folder in your home area). The easiest way to solve this problem is to include the installation path in the LD_LIBRARY_PATH environment variable. You can either run the following command or add it to your .bashrc file (of course, you must substitute in your own ICE-IO installation path):
user@localhost ~ > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/niceIO
Programming a Translator
Under construction...