Page MenuHomec4science

hdf5_chloride.hpp
No OneTemporary

File Metadata

Created
Tue, Sep 10, 07:40

hdf5_chloride.hpp

/* =============================================================================
Copyright (c) 2014-2017 F. Georget <fabieng@princeton.edu> Princeton University
Copyright (c) 2017-2018 F. Georget <fabien.georget@epfl.ch> EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
============================================================================= */
#ifndef SPECMICP_REACTMICP_IO_HDF5CHLORIDE_HPP
#define SPECMICP_REACTMICP_IO_HDF5CHLORIDE_HPP
#include "specmicp_common/types.hpp"
#include "specmicp_common/pimpl_ptr.hpp"
#include "specmicp_database/database_fwd.hpp"
#include "dfpm/meshes/mesh1dfwd.hpp"
#include <memory>
namespace specmicp {
struct AdimensionalSystemSolution;
namespace units {
struct UnitsSet;
} // namespace units
namespace reactmicp {
namespace systems {
namespace chloride {
class ChlorideVariables;
} // namespace chloride
} // namespace systems
} // namespace reactmicp
namespace io {
class HDF5Timesteps;
//! \brief Save a chloride simulation into HDF5 format
class SPECMICP_DLL_PUBLIC ChlorideHDF5Saver
{
public:
ChlorideHDF5Saver(
const std::string& filepath,
std::shared_ptr<specmicp::reactmicp::systems::chloride::ChlorideVariables> vars
);
~ChlorideHDF5Saver();
void save_timestep(scalar_t timestep);
private:
struct SPECMICP_DLL_LOCAL ChlorideHDF5SaverImpl;
utils::pimpl_ptr<ChlorideHDF5SaverImpl> m_impl;
// delete copy and assignement operator, no need for them
ChlorideHDF5Saver(const ChlorideHDF5Saver& other) = delete;
ChlorideHDF5Saver& operator= (const ChlorideHDF5Saver& other) = delete;
};
//! \brief Read data from HDF5 file from chloride system
class SPECMICP_DLL_PUBLIC ChlorideHDF5Reader
{
public:
ChlorideHDF5Reader(
const std::string& filepath,
RawDatabasePtr t_database
);
~ChlorideHDF5Reader();
const HDF5Timesteps& get_timesteps() const;
units::UnitsSet get_units();
//! \brief Return a SpecMiCP solution
AdimensionalSystemSolution get_adim_solution(
std::string timestep,
index_t node
);
//! \brief Return the mesh saved in the file
mesh::Mesh1DPtr get_mesh();
//! \brief Return a SpecMiCP solution
AdimensionalSystemSolution get_adim_solution(
scalar_t timestep,
index_t node
);
//! \brief Return a main variable as function of x
Vector main_variable_vs_x(
const std::string& timestep,
index_t ndof,
const std::string& variables
);
//! \brief Return a main variable as function of x
Vector main_variable_vs_x(
scalar_t timestep,
index_t ndof,
const std::string& variables
);
//! \brief Return a total mobile concentration as a function of x
Vector total_mobile_concentration_vs_x(
scalar_t timestep,
const std::string& component
);
//! \brief Return the potential as a function of x
Vector potential_vs_x(scalar_t timestep);
//! \brief Return a main variables as a function of time
Vector main_variable_vs_t(
index_t node,
index_t ndof,
const std::string& variables
);
//! \brief Return a total mobile concentration as a function of time
Vector total_mobile_concentration_vs_t(
index_t node,
const std::string& component
);
//! \brief Return the potential as a function of time
Vector potential_vs_t(
index_t node
);
//! \brief Return the current as a function of time
Vector current_vs_t(index_t node);
// all access
private:
struct SPECMICP_DLL_LOCAL ChlorideHDF5ReaderImpl;
utils::pimpl_ptr<ChlorideHDF5ReaderImpl> m_impl;
};
} // namespace io
} // namespace specmicp
#endif // SPECMICP_REACTMICP_IO_HDF5CHLORIDE_HPP

Event Timeline