← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/trunk] Rev 7202: merge phdf5 branch

 

On Tue, Dec 11, 2012 at 12:14 PM, Johannes Ring <johannr@xxxxxxxxx> wrote:
> Was the changes to CMakeLists.txt in this merge made on purpose?
>

No - sorry.

Garth

> Johannes
>
> On Fri, Dec 7, 2012 at 4:59 PM,  <noreply@xxxxxxxxxxxxx> wrote:
>> Merge authors:
>>   Chris Richardson (chris-bpi)
>>   Garth Wells (garth-wells)
>> ------------------------------------------------------------
>> revno: 7202 [merge]
>> committer: Garth N. Wells <gnw20@xxxxxxxxx>
>> branch nick: clean_test
>> timestamp: Fri 2012-12-07 15:57:55 +0000
>> message:
>>   merge phdf5 branch
>> modified:
>>   CMakeLists.txt
>>   dolfin/graph/GraphBuilder.cpp
>>   dolfin/io/HDF5File.cpp
>>   dolfin/io/HDF5File.h
>>   dolfin/io/HDF5Interface.cpp
>>   dolfin/io/HDF5Interface.h
>>   dolfin/io/XDMFFile.cpp
>>   test/unit/io/python/HDF5.py
>>
>>
>> --
>> lp:dolfin
>> https://code.launchpad.net/~dolfin-core/dolfin/trunk
>>
>> Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
>> To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/trunk/+edit-subscription
>>
>> === modified file 'CMakeLists.txt'
>> --- CMakeLists.txt      2012-12-05 10:44:03 +0000
>> +++ CMakeLists.txt      2012-12-07 15:09:46 +0000
>> @@ -215,18 +215,16 @@
>>  set(Boost_USE_MULTITHREADED $ENV{BOOST_USE_MULTITHREADED})
>>  set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0 1.44 1.44.0 1.45 1.45.0 1.46 1.46.0 1.46.1 1.47 1.47.0 1.48 1.48.0 1.49 1.49.0 1.50 1.50.0)
>>
>> -find_package(Boost 1.36 QUIET REQUIRED)
>> -
>> -set(DOLFIN_BOOST_COMPONENTS filesystem program_options system thread iostreams math_tr1)
>>  if (DOLFIN_ENABLE_MPI AND MPI_CXX_FOUND)
>> -  list(APPEND DOLFIN_BOOST_COMPONENTS mpi serialization)
>> +  find_package(Boost 1.36 COMPONENTS filesystem program_options system thread iostreams math_tr1 mpi serialization REQUIRED)
>> +else()
>> +  find_package(Boost 1.36 COMPONENTS filesystem program_options system thread iostreams math_tr1 REQUIRED)
>>  endif()
>>
>>  # Boost timer was not a separate Boost component until version 1.48
>> -if ("${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}" VERSION_GREATER "1.47")
>> -  list(APPEND DOLFIN_BOOST_COMPONENTS timer)
>> -endif()
>> -find_package(Boost COMPONENTS ${DOLFIN_BOOST_COMPONENTS} REQUIRED)
>> +# if ("${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}" VERSION_GREATER "1.47")
>> +#   find_package(Boost COMPONENTS timer REQUIRED)
>> +# endif()
>>
>>  # Check for required package UFC
>>  find_package(UFC 2.0.2 QUIET HINTS ${UFC_DIR})
>>
>> === modified file 'dolfin/graph/GraphBuilder.cpp'
>> --- dolfin/graph/GraphBuilder.cpp       2012-12-06 21:40:39 +0000
>> +++ dolfin/graph/GraphBuilder.cpp       2012-12-07 15:09:46 +0000
>> @@ -18,7 +18,7 @@
>>  // Modified by Chris Richardson, 2012
>>  //
>>  // First added:  2010-02-19
>> -// Last changed: 2012-11-24
>> +// Last changed: 2012-12-07
>>
>>  #include <algorithm>
>>  #include <numeric>
>> @@ -372,8 +372,6 @@
>>    double tt = time();
>>
>>    // Create mapping from facets (vector) to cells
>> -  // FIXME: potential speedup by using a hash directly for the map key
>> -  //        instead of a vector
>>    typedef boost::unordered_map<std::vector<std::size_t>, std::size_t> vectormap;
>>    vectormap facet_cell;
>>
>> @@ -451,7 +449,8 @@
>>      }
>>
>>      // Go through local facets, looking for a matching facet in othermap
>> -    for(vectormap::iterator fcell = facet_cell.begin(); fcell != facet_cell.end(); ++fcell)
>> +    vectormap::iterator fcell = facet_cell.begin();
>> +    while(fcell != facet_cell.end())
>>      {
>>        vectormap::iterator join_cell = othermap.find(fcell->first);
>>        if (join_cell != othermap.end())
>> @@ -460,10 +459,13 @@
>>          // from both maps
>>          local_graph[fcell->second].insert(join_cell->second);
>>          ghost_vertices.insert(join_cell->second);
>> -        facet_cell.erase(fcell);
>> +        facet_cell.erase(fcell++);
>>          othermap.erase(join_cell);
>>        }
>> +      else
>> +        ++fcell;
>>      }
>> +
>>    }
>>
>>    // remaining facets are exterior boundary - could be useful
>>
>> === modified file 'dolfin/io/HDF5File.cpp'
>> --- dolfin/io/HDF5File.cpp      2012-12-04 11:29:59 +0000
>> +++ dolfin/io/HDF5File.cpp      2012-12-04 22:20:41 +0000
>> @@ -18,7 +18,7 @@
>>  // Modified by Garth N. Wells, 2012
>>  //
>>  // First added:  2012-06-01
>> -// Last changed: 2012-11-27
>> +// Last changed: 2012-12-04
>>
>>  #ifdef HAS_HDF5
>>
>> @@ -54,7 +54,7 @@
>>  using namespace dolfin;
>>
>>  //-----------------------------------------------------------------------------
>> -HDF5File::HDF5File(const std::string filename, bool truncate, bool use_mpiio)
>> +HDF5File::HDF5File(const std::string filename, const std::string file_mode, bool use_mpiio)
>>    : hdf5_file_open(false), hdf5_file_id(0),
>>      mpi_io(MPI::num_processes() > 1 && use_mpiio ? true : false)
>>  {
>> @@ -62,7 +62,7 @@
>>    parameters.add("chunking", false);
>>
>>    // OPen HDF5 file
>> -  hdf5_file_id = HDF5Interface::open_file(filename, truncate, mpi_io);
>> +  hdf5_file_id = HDF5Interface::open_file(filename, file_mode, mpi_io);
>>    hdf5_file_open = true;
>>  }
>>  //-----------------------------------------------------------------------------
>> @@ -121,7 +121,7 @@
>>  //-----------------------------------------------------------------------------
>>  void HDF5File::write(const Mesh& mesh, std::size_t cell_dim, const std::string name)
>>  {
>> -  warning("Writing mesh with global index - not suitable for visualisation");
>> +  warning("Writing globally indexed mesh - not suitable for visualisation");
>>
>>    dolfin_assert(hdf5_file_open);
>>
>> @@ -357,7 +357,6 @@
>>  void HDF5File::read(Mesh& input_mesh, const std::string name)
>>  {
>>    warning("HDF5 Mesh input is still experimental");
>> -  warning("HDF5 Mesh input will always repartition the mesh");
>>
>>    dolfin_assert(hdf5_file_open);
>>
>> @@ -391,8 +390,6 @@
>>                                       const std::string coordinates_name,
>>                                       const std::string topology_name)
>>  {
>> -  // FIXME: should not call repartition if running serial
>> -  warning("HDF5 Mesh read will repartition this mesh");
>>    Timer t("HDF5: ReadMesh");
>>
>>    // Structure to store local mesh
>>
>> === modified file 'dolfin/io/HDF5File.h'
>> --- dolfin/io/HDF5File.h        2012-12-04 11:29:59 +0000
>> +++ dolfin/io/HDF5File.h        2012-12-04 22:20:41 +0000
>> @@ -18,7 +18,7 @@
>>  // Modified by Garth N. Wells, 2012
>>  //
>>  // First added:  2012-05-22
>> -// Last changed: 2012-11-27
>> +// Last changed: 2012-12-04
>>
>>  #ifndef __DOLFIN_HDF5FILE_H
>>  #define __DOLFIN_HDF5FILE_H
>> @@ -47,7 +47,7 @@
>>    public:
>>
>>      /// Constructor
>> -    HDF5File(const std::string filename, bool truncate, bool use_mpiio=true);
>> +    HDF5File(const std::string filename, const std::string file_mode, bool use_mpiio=true);
>>
>>      /// Destructor
>>      ~HDF5File();
>>
>> === modified file 'dolfin/io/HDF5Interface.cpp'
>> --- dolfin/io/HDF5Interface.cpp 2012-12-04 11:29:59 +0000
>> +++ dolfin/io/HDF5Interface.cpp 2012-12-04 22:20:41 +0000
>> @@ -18,7 +18,7 @@
>>  // Modified by Johannes Ring, 2012
>>  //
>>  // First Added: 2012-09-21
>> -// Last Changed: 2012-10-12
>> +// Last Changed: 2012-12-04
>>
>>  #include <boost/filesystem.hpp>
>>
>> @@ -36,7 +36,7 @@
>>  using namespace dolfin;
>>
>>  //-----------------------------------------------------------------------------
>> -hid_t HDF5Interface::open_file(const std::string filename, const bool truncate,
>> +hid_t HDF5Interface::open_file(const std::string filename, const std::string mode,
>>                                 const bool use_mpi_io)
>>  {
>>    // Set parallel access with communicator
>> @@ -55,10 +55,10 @@
>>      #endif
>>    }
>>
>> -  hid_t file_id;
>> -  if (truncate)
>> +  hid_t file_id = HDF5_FAIL;
>> +  if (mode=="w")
>>    {
>> -    // Create file, (overwriting existing file, if present)
>> +    // Create file for write, (overwriting existing file, if present)
>>      file_id = H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT,
>>                          plist_id);
>>    }
>> @@ -72,8 +72,22 @@
>>                     "File does not exist");
>>      }
>>
>> -    // Open file existing file
>> -    file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id);
>> +    if(mode=="a")
>> +    {
>> +      // Open file existing file for append
>> +      file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id);
>> +    }
>> +    else if(mode=="r")
>> +    {
>> +      file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, plist_id);
>> +    }
>> +    else
>> +    {
>> +      dolfin_error("HDF5Interface.cpp",
>> +                   "open HDF5 file",
>> +                   "Unknown file mode \"%s\"", mode.c_str());
>> +    }
>> +
>>    }
>>    dolfin_assert(file_id != HDF5_FAIL);
>>
>>
>> === modified file 'dolfin/io/HDF5Interface.h'
>> --- dolfin/io/HDF5Interface.h   2012-12-04 11:29:59 +0000
>> +++ dolfin/io/HDF5Interface.h   2012-12-04 22:20:41 +0000
>> @@ -44,7 +44,7 @@
>>    public:
>>
>>      /// Open HDF5 and return file descriptor
>> -    static hid_t open_file(const std::string filename, const bool truncate,
>> +    static hid_t open_file(const std::string filename, const std::string mode,
>>                             const bool use_mpi_io);
>>
>>
>>
>> === modified file 'dolfin/io/XDMFFile.cpp'
>> --- dolfin/io/XDMFFile.cpp      2012-12-04 20:34:24 +0000
>> +++ dolfin/io/XDMFFile.cpp      2012-12-04 22:20:41 +0000
>> @@ -18,7 +18,7 @@
>>  // Modified by Garth N. Wells, 2012
>>  //
>>  // First added:  2012-05-28
>> -// Last changed: 2012-11-26
>> +// Last changed: 2012-12-04
>>
>>  #ifdef HAS_HDF5
>>
>> @@ -55,7 +55,7 @@
>>    hdf5_filename = p.string();
>>
>>    // Create HDF5 file (truncate)
>> -  hdf5_file.reset(new HDF5File(hdf5_filename, true));
>> +  hdf5_file.reset(new HDF5File(hdf5_filename, "w"));
>>
>>    // Re-write mesh (true, false or auto, with auto based on detecting
>>    // changes in a hash key)
>>
>> === modified file 'test/unit/io/python/HDF5.py'
>> --- test/unit/io/python/HDF5.py 2012-12-03 21:36:45 +0000
>> +++ test/unit/io/python/HDF5.py 2012-12-04 14:28:03 +0000
>> @@ -30,20 +30,20 @@
>>          def test_save_vector(self):
>>              x = Vector(305)
>>              x[:] = 1.0
>> -            vector_file = HDF5File("x.h5", True)
>> +            vector_file = HDF5File("x.h5", "w")
>>              vector_file.write(x, "my_vector")
>>
>>          def test_save_and_read_vector(self):
>>              # Write to file
>>              x = Vector(305)
>>              x[:] = 1.2
>> -            vector_file = HDF5File("vector.h5", True)
>> +            vector_file = HDF5File("vector.h5", "w")
>>              vector_file.write(x, "my_vector")
>>              del vector_file
>>
>>              # Read from file
>>              y = Vector()
>> -            vector_file = HDF5File("vector.h5", False)
>> +            vector_file = HDF5File("vector.h5", "r")
>>              vector_file.read(y, "my_vector")
>>              self.assertEqual(y.size(), x.size())
>>              self.assertEqual((x - y).norm("l1"), 0.0)
>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References