diff --git a/src/dfpm/1dtransport/diffusion.hpp b/src/dfpm/1dtransport/diffusion.hpp index 27bef83..59dcde9 100644 --- a/src/dfpm/1dtransport/diffusion.hpp +++ b/src/dfpm/1dtransport/diffusion.hpp @@ -1,149 +1,149 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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_DFPM_1DTRANSPORT_DIFFUSION_HPP #define SPECMICP_DFPM_1DTRANSPORT_DIFFUSION_HPP //! \file diffusion.hpp //! \brief A simple diffusion program #include #include "../types.hpp" #include "../types.hpp" #include "../../dfpmsolver/parabolic_program.hpp" #include "../meshes/mesh1dfwd.hpp" namespace specmicp { namespace dfpm { struct SaturatedDiffusion1DParameters; //! \class SaturatedDiffusion1D //! \brief A saturated diffusion equation //! //! This is an example of a dfpm program //! //! \sa SaturatedDiffusion1DParameters -class SaturatedDiffusion1D: public dfpmsolver::ParabolicProgram +class SPECMICP_DLL_PUBLIC SaturatedDiffusion1D: public dfpmsolver::ParabolicProgram { public: SaturatedDiffusion1D( mesh::Mesh1DPtr the_mesh, std::shared_ptr parameters, std::vector list_bcs ); //! \brief Return the number of equations index_t get_neq() const {return m_neq;} //! \brief Return the number of degrees of freedom per node index_t get_ndf() const {return 1;} //! \brief Return the total number of degrees of freedom index_t get_tot_ndf() const {return m_tot_ndf;} //! \brief Return the id of the equation corresponding to the degree of freedom 'id_dof' //! //! Return 'no_equation' if no equation exist index_t id_equation(index_t id_dof) const {return m_id_equations(id_dof);} void element_residuals(index_t element, const Vector& displacement, const Vector& velocity, Vector& element_residual ); //! \brief Compute the residuals void compute_residuals(const Vector& displacement, const Vector& velocity, Vector& residual ); //! \brief Compute the jacobian void compute_jacobian(Vector& displacement, Vector& velocity, Eigen::SparseMatrix& jacobian, scalar_t alphadt ); void element_jacobian( index_t element, Vector& displacement, Vector& velocity, list_triplet_t& jacobian, scalar_t alphadt); //! \brief Update the solutions void update_solution(const Vector& update, scalar_t lambda, scalar_t alpha_dt, Vector& predictor, Vector& displacement, Vector& velocity); //! \brief Apply boundary conditions to the velocity vector //! //! by default do nothing. void apply_bc(scalar_t dt, const Vector& displacement, Vector& velocity) {} //! \brief Return the value of the external flow for dof 'id_dof' scalar_t external_flow(index_t id_dof) const {return m_external_flow(id_dof);} //! \brief Return a reference to the value of the external flow for dof 'id_dof' scalar_t& external_flow(index_t id_dof) {return m_external_flow(id_dof);} //! \brief Return a reference to the vector of external flow Vector& external_flow() {return m_external_flow;} private: - void number_equations(std::vector list_bcs); + void SPECMICP_DLL_LOCAL number_equations(std::vector list_bcs); index_t m_tot_ndf; index_t m_neq; Eigen::VectorXi m_id_equations; mesh::Mesh1DPtr m_mesh; std::shared_ptr m_param; Vector m_internal_flow; Vector m_external_flow; }; } // end namespace dfpm } // end namespace specmicp #endif // SPECMICP_DFPM_1DTRANSPORT_DIFFUSION_HPP diff --git a/src/dfpm/CMakeLists.txt b/src/dfpm/CMakeLists.txt index 9a359a7..85dc4ed 100644 --- a/src/dfpm/CMakeLists.txt +++ b/src/dfpm/CMakeLists.txt @@ -1,64 +1,73 @@ # DFPM # ======== add_custom_target(dfpm_incl SOURCES types.hpp 1dtransport/diffusion_parameters.hpp mesh.hpp meshes/mesh1dfwd.hpp meshes/mesh1d.hpp meshes/uniform_mesh1d.hpp meshes/generic_mesh1d.hpp meshes/axisymmetric_uniform_mesh1d.hpp meshes/axisymmetric_mesh1d.hpp ) set(DFPMLIB - 1dtransport/diffusion.cpp # HELP I'm alooonnnne !!! + io/meshes.cpp + meshes/axisymmetric_mesh1d.cpp + meshes/generic_mesh1d.cpp + 1dtransport/diffusion.cpp ) +set_visibility_hidden_flag( ${DFPMLIB}) + add_library(dfpm SHARED ${DFPMLIB}) install(TARGETS dfpm LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ) # includes # -------- set(DFPM_MESH_INCLUDE_LIST meshes/mesh1dfwd.hpp meshes/mesh1d.hpp meshes/uniform_mesh1d.hpp meshes/generic_mesh1d.hpp meshes/axisymmetric_uniform_mesh1d.hpp meshes/axisymmetric_mesh1d.hpp ) install(FILES types.hpp mesh.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/dfpm ) install(FILES 1dtransport/diffusion_parameters.hpp 1dtransport/diffusion.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/dfpm/1dtransport ) +install(FILES io/meshes.hpp + DESTINATION ${INCLUDE_INSTALL_DIR}/dfpm/io +) + install(FILES ${DFPM_MESH_INCLUDE_LIST} DESTINATION ${INCLUDE_INSTALL_DIR}/dfpm/meshes ) # static libraries # ---------------- if(SPECMICP_BUILD_STATIC) add_library(dfpm_static STATIC ${DFPMLIB}) install(TARGETS dfpm_static ARCHIVE DESTINATION ${STATIC_LIBRARY_INSTALL_DIR} ) else() add_library(dfpm_static EXCLUDE_FROM_ALL STATIC ${DFPMLIB}) endif() set_target_properties(dfpm_static PROPERTIES OUTPUT_NAME dfpm) diff --git a/src/utils/io/meshes.hpp b/src/dfpm/io/meshes.cpp similarity index 79% copy from src/utils/io/meshes.hpp copy to src/dfpm/io/meshes.cpp index f375f04..e48557a 100644 --- a/src/utils/io/meshes.hpp +++ b/src/dfpm/io/meshes.cpp @@ -1,72 +1,69 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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_IO_MESHES_HPP -#define SPECMICP_IO_MESHES_HPP +#include "meshes.hpp" -//! \file utils/io/meshes.hpp -//! \brief Print the meshes #include #include -#include "../../dfpm/meshes/mesh1d.hpp" -#include "../../physics/units.hpp" + +#include "../meshes/mesh1d.hpp" #include "../../utils/io/units.hpp" namespace specmicp { -//! \namespace io print informations and output from the solvers namespace io { -//! \brief Print 'the_mesh' informations in 'output' -inline void print_mesh(std::ostream* output, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) +void print_mesh(std::ostream* output, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) { (*output) << "# dfpm mesh \n"; (*output) << "# units : " << length_unit_to_string(lenght_unit) << "\n"; (*output) << "Node\tDistance\tCell_volume" << std::endl; for (index_t node: the_mesh->range_nodes()) { (*output) << node << "\t" << the_mesh->get_position(node) << "\t" << the_mesh->get_volume_cell(node) << "\n"; } } //! \brief Print 'the_mesh' in the file 'filepath' -inline void print_mesh(std::string filepath, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) +void print_mesh(std::string filepath, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) { std::ofstream outfile(filepath); + if (not outfile) + { + throw std::runtime_error("Cannot open file : '"+filepath+"'."); + } print_mesh(&outfile, the_mesh, lenght_unit); outfile.close(); } -} // end namespace io -} // end namespace specmicp - -#endif // SPECMICP_IO_MESHES_HPP +} //end namespace io +} //end namespace specmicp diff --git a/src/utils/io/meshes.hpp b/src/dfpm/io/meshes.hpp similarity index 68% rename from src/utils/io/meshes.hpp rename to src/dfpm/io/meshes.hpp index f375f04..fc46511 100644 --- a/src/utils/io/meshes.hpp +++ b/src/dfpm/io/meshes.hpp @@ -1,72 +1,58 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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_IO_MESHES_HPP -#define SPECMICP_IO_MESHES_HPP +#ifndef SPECMICP_DFPM_IO_MESHES_HPP +#define SPECMICP_DFPM_IO_MESHES_HPP -//! \file utils/io/meshes.hpp +//! \file dfpm/io/meshes.hpp //! \brief Print the meshes -#include -#include -#include "../../dfpm/meshes/mesh1d.hpp" +#include +#include "../meshes/mesh1dfwd.hpp" #include "../../physics/units.hpp" -#include "../../utils/io/units.hpp" namespace specmicp { //! \namespace io print informations and output from the solvers namespace io { //! \brief Print 'the_mesh' informations in 'output' -inline void print_mesh(std::ostream* output, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) -{ - (*output) << "# dfpm mesh \n"; - (*output) << "# units : " << length_unit_to_string(lenght_unit) << "\n"; - (*output) << "Node\tDistance\tCell_volume" << std::endl; - for (index_t node: the_mesh->range_nodes()) - { - (*output) << node << "\t" << the_mesh->get_position(node) << "\t" << the_mesh->get_volume_cell(node) << "\n"; - } -} +void SPECMICP_DLL_PUBLIC +print_mesh(std::ostream* output, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit); //! \brief Print 'the_mesh' in the file 'filepath' -inline void print_mesh(std::string filepath, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit) -{ - std::ofstream outfile(filepath); - print_mesh(&outfile, the_mesh, lenght_unit); - outfile.close(); -} +void SPECMICP_DLL_PUBLIC +print_mesh(std::string filepath, mesh::Mesh1DPtr the_mesh, units::LengthUnit lenght_unit); } // end namespace io } // end namespace specmicp -#endif // SPECMICP_IO_MESHES_HPP +#endif // SPECMICP_DFPM_IO_MESHES_HPP diff --git a/src/dfpm/meshes/axisymmetric_mesh1d.cpp b/src/dfpm/meshes/axisymmetric_mesh1d.cpp new file mode 100644 index 0000000..87b5773 --- /dev/null +++ b/src/dfpm/meshes/axisymmetric_mesh1d.cpp @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------------- + +Copyright (c) 2015 F. Georget , Princeton University +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. + +-----------------------------------------------------------------------------*/ + +#include "axisymmetric_mesh1d.hpp" + +namespace specmicp { +namespace mesh { + +AxisymmetricMesh1D::AxisymmetricMesh1D(Vector radius, scalar_t height): + Mesh1D(radius.rows()), + m_height(height), + m_data(radius.rows(), 3), + m_face_radius(radius.rows()-1) +{ + // radius + m_data.col(0) = radius; + // Radius of the faces + for (index_t element=0; element( + std::make_shared(radius, height)); + +} + +Mesh1DPtr uniform_axisymmetric_mesh1d(index_t nb_nodes, scalar_t radius, scalar_t dx, scalar_t height) +{ + Vector radius_s(nb_nodes); + for (index_t node=0; node( + std::make_shared(radius_s, height)); + +} + +} //end namespace mesh +} //end namespace specmicp diff --git a/src/dfpm/meshes/axisymmetric_mesh1d.hpp b/src/dfpm/meshes/axisymmetric_mesh1d.hpp index 0b54f90..9c4d3a8 100644 --- a/src/dfpm/meshes/axisymmetric_mesh1d.hpp +++ b/src/dfpm/meshes/axisymmetric_mesh1d.hpp @@ -1,161 +1,117 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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_DFPM_MESHES_AXISYMMETRICMESH1D_HPP #define SPECMICP_DFPM_MESHES_AXISYMMETRICMESH1D_HPP //! \file axisymmetric_mesh1d.hpp //! \brief An axisymmetric 1D mesh #include "mesh1d.hpp" namespace specmicp { namespace mesh { //! \brief A generic Axisymmetric 1D mesh -class AxisymmetricMesh1D: public Mesh1D +class SPECMICP_DLL_PUBLIC AxisymmetricMesh1D: public Mesh1D { public: const index_t radius = 0; const index_t cell_vol_0 = 1; const index_t cell_vol_1 = 2; //! \brief Build an axisymmetric 1D mesh //! //! \param radius is a vector of the position of the nodes //! \param height is the height of the sample (or depth) - AxisymmetricMesh1D(Vector radius, scalar_t height): - Mesh1D(radius.rows()), - m_height(height), - m_data(radius.rows(), 3), - m_face_radius(radius.rows()-1) - { - // radius - m_data.col(0) = radius; - // Radius of the faces - for (index_t element=0; element( - std::make_shared(radius, height)); - -} +Mesh1DPtr SPECMICP_DLL_PUBLIC axisymmetric_mesh1d(Vector radius, scalar_t height); //! \brief Factory method to build a pointer to a uniform axisymmetric 1D mesh //! //! \param nb_nodes number of nodes in the mesh //! \param radius of the first node (biggest radius in the mesh) //! \param dx length of an element //! \param height is the height of the sample (or depth) //! //! Note: this method buil an AxisymmetricMesh1D instance while //! the specmicp::mesh::axisymmetric_uniform_mesh1d method build a //! specmicp::mesh::AxisymmetricUniformMesh1D instance. -inline Mesh1DPtr uniform_axisymmetric_mesh1d(index_t nb_nodes, scalar_t radius, scalar_t dx, scalar_t height) -{ - Vector radius_s(nb_nodes); - for (index_t node=0; node( - std::make_shared(radius_s, height)); - -} +Mesh1DPtr SPECMICP_DLL_PUBLIC uniform_axisymmetric_mesh1d(index_t nb_nodes, scalar_t radius, scalar_t dx, scalar_t height); } // end namespace mesh } // end namespace specmicp #endif // SPECMICP_DFPM_MESHES_AXISYMMETRICMESH1D_HPP diff --git a/src/reactmicp.hpp b/src/dfpm/meshes/generic_mesh1d.cpp similarity index 56% copy from src/reactmicp.hpp copy to src/dfpm/meshes/generic_mesh1d.cpp index 8184a20..d893e04 100644 --- a/src/reactmicp.hpp +++ b/src/dfpm/meshes/generic_mesh1d.cpp @@ -1,62 +1,77 @@ /*------------------------------------------------------------------------------- -Copyright (c) 2014,2015 F. Georget , Princeton University +Copyright (c) 2015 F. Georget , Princeton University 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. -----------------------------------------------------------------------------*/ -//! \file reactmicp.hpp -//! \brief Include this file to use ReactMiCP -//! -//! This file includes the main headers from ReactMiCP. - -#include "types.hpp" - -#include "specmicp.hpp" - -#include "reactmicp/systems/saturated_react/variables.hpp" -#include "reactmicp/systems/saturated_react/equilibrium_stagger.hpp" -#include "reactmicp/systems/saturated_react/transport_stagger.hpp" -#include "reactmicp/systems/saturated_react/init_variables.hpp" - -#include "reactmicp/solver/reactive_transport_solver.hpp" -#include "reactmicp/solver/reactive_transport_solver_structs.hpp" -#include "reactmicp/solver/staggers_base/upscaling_stagger_base.hpp" -#include "reactmicp/solver/staggers_base/stagger_structs.hpp" -#include "reactmicp/solver/timestepper.hpp" - -#include "database/database.hpp" - -#include "dfpm/mesh.hpp" - -#include "reactmicp/solver/runner.hpp" - -#include "utils/io/meshes.hpp" -#include "utils/io/reactive_transport.hpp" -#include "utils/io/saturated_react.hpp" -#include "utils/io/units.hpp" +#include "generic_mesh1d.hpp" + +namespace specmicp { +namespace mesh { + +GenericMesh1D::GenericMesh1D(Vector coords, scalar_t section): + Mesh1D(coords.rows()), + m_section(section), + m_data(coords.rows(), 4), + m_face_coord(coords.rows()-1) +{ + // radius + m_data.col(coord) = coords; + // Radius of the faces + for (index_t element=0; element( + std::make_shared(coords, section)); + +} + + +} //end namespace mesh +} //end namespace specmicp diff --git a/src/dfpm/meshes/generic_mesh1d.hpp b/src/dfpm/meshes/generic_mesh1d.hpp index dec5683..0f8577a 100644 --- a/src/dfpm/meshes/generic_mesh1d.hpp +++ b/src/dfpm/meshes/generic_mesh1d.hpp @@ -1,130 +1,98 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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_DFPM_MESHES_GENERICMESH1D_HPP #define SPECMICP_DFPM_MESHES_GENERICMESH1D_HPP //! \file generic_mesh1d.hpp //! \brief A cartesian 1D mesh #include "mesh1d.hpp" namespace specmicp { namespace mesh { //! \brief A cartesian 1D mesh -class GenericMesh1D: public Mesh1D +class SPECMICP_DLL_PUBLIC GenericMesh1D: public Mesh1D { public: const index_t coord = 0; const index_t cell_vol_0 = 1; const index_t cell_vol_1 = 2; //! \brief Build 1D mesh //! //! \param coords a vector of coordinates //! \param section the section of the mesh - GenericMesh1D(Vector coords, scalar_t section): - Mesh1D(coords.rows()), - m_section(section), - m_data(coords.rows(), 4), - m_face_coord(coords.rows()-1) - { - // radius - m_data.col(coord) = coords; - // Radius of the faces - for (index_t element=0; element( - std::make_shared(coords, section)); - -} +Mesh1DPtr SPECMICP_DLL_PUBLIC generic_mesh1d(Vector coords, scalar_t section); } // end namespace mesh } // end namespace specmicp #endif // SPECMICP_DFPM_MESHES_GENERICMESH1D_HPP diff --git a/src/reactmicp.hpp b/src/reactmicp.hpp index 8184a20..720862a 100644 --- a/src/reactmicp.hpp +++ b/src/reactmicp.hpp @@ -1,62 +1,62 @@ /*------------------------------------------------------------------------------- Copyright (c) 2014,2015 F. Georget , Princeton University 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. -----------------------------------------------------------------------------*/ //! \file reactmicp.hpp //! \brief Include this file to use ReactMiCP //! //! This file includes the main headers from ReactMiCP. #include "types.hpp" #include "specmicp.hpp" #include "reactmicp/systems/saturated_react/variables.hpp" #include "reactmicp/systems/saturated_react/equilibrium_stagger.hpp" #include "reactmicp/systems/saturated_react/transport_stagger.hpp" #include "reactmicp/systems/saturated_react/init_variables.hpp" #include "reactmicp/solver/reactive_transport_solver.hpp" #include "reactmicp/solver/reactive_transport_solver_structs.hpp" #include "reactmicp/solver/staggers_base/upscaling_stagger_base.hpp" #include "reactmicp/solver/staggers_base/stagger_structs.hpp" #include "reactmicp/solver/timestepper.hpp" #include "database/database.hpp" #include "dfpm/mesh.hpp" #include "reactmicp/solver/runner.hpp" -#include "utils/io/meshes.hpp" +#include "dfpm/io/meshes.hpp" #include "utils/io/reactive_transport.hpp" #include "utils/io/saturated_react.hpp" #include "utils/io/units.hpp" diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 971a60d..d5c98ca 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,96 +1,95 @@ add_custom_target(utils_inc SOURCES log.hpp # sparse solvers # -------------- sparse_solvers/sparse_solver_base.hpp sparse_solvers/sparse_solver.hpp sparse_solvers/sparse_solver_structs.hpp sparse_solvers/sparse_qr.hpp sparse_solvers/sparse_lu.hpp sparse_solvers/sparse_bicgstab.hpp sparse_solvers/sparse_gmres.hpp options_handler.hpp perfs_handler.hpp # input/output io/units.hpp - io/meshes.hpp io/reactive_transport.hpp io/saturated_react.hpp ) set(SPECMICP_COMMON_LIBRARY_FILES dateandtime.cpp timer.cpp moving_average.cpp json.cpp ${JSONCPP_DIR}/jsoncpp.cpp ) add_library(specmicp_common SHARED ${SPECMICP_COMMON_LIBRARY_FILES}) install(TARGETS specmicp_common LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ) set(UTILS_INCLUDE_LIST log.hpp options_handler.hpp perfs_handler.hpp moving_average.hpp timer.hpp dateandtime.hpp json.hpp ) set(UTILS_SPARSE_INCLUDE_LIST # sparse solvers # -------------- sparse_solvers/sparse_solver.hpp sparse_solvers/sparse_solver_base.hpp sparse_solvers/sparse_solver_structs.hpp sparse_solvers/sparse_qr.hpp sparse_solvers/sparse_lu.hpp sparse_solvers/sparse_bicgstab.hpp sparse_solvers/sparse_gmres.hpp ) set(UTILS_IO_INCLUDE_LIST io/units.hpp io/meshes.hpp io/reactive_transport.hpp io/saturated_react.hpp ) install(FILES ${UTILS_INCLUDE_LIST} DESTINATION ${INCLUDE_INSTALL_DIR}/utils ) install(FILES ${UTILS_SPARSE_INCLUDE_LIST} DESTINATION ${INCLUDE_INSTALL_DIR}/utils/sparse_solvers ) install(FILES ${UTILS_IO_INCLUDE_LIST} DESTINATION ${INCLUDE_INSTALL_DIR}/utils/io ) # static libraries # ---------------- if(SPECMICP_BUILD_STATIC) add_library(specmicp_common_static STATIC ${SPECMICP_COMMON_LIBRARY_FILES}) install(TARGETS specmicp_common_static ARCHIVE DESTINATION ${STATIC_LIBRARY_INSTALL_DIR} ) else() add_library(specmicp_common_static EXCLUDE_FROM_ALL STATIC ${SPECMICP_COMMON_LIBRARY_FILES}) endif() set_target_properties(specmicp_common_static PROPERTIES OUTPUT_NAME specmicp_common)