Commit 93860216 authored by GILLES Sebastien's avatar GILLES Sebastien

#1443 Move a function from Model to FiniteElementSpace whereit truly belongs.

parent ac95b828
......@@ -1417,6 +1417,8 @@
BEA4AF2C2462AABD00669BBB /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEC37E0617DDC0210021BFB7 /* Accelerate.framework */; };
BEA5FA8D248F74100032F3DB /* Model.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BED97774201F7936004C346D /* Model.cpp */; };
BEA5FA8E248F74160032F3DB /* CreateMeshDataDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA5FA7B248F73830032F3DB /* CreateMeshDataDirectory.cpp */; };
BEA7AA7124AA46DE002A569F /* CreateFEltSpaceList.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEA7AA6E24AA46DE002A569F /* CreateFEltSpaceList.hxx */; };
BEA7AA7224AA46DE002A569F /* CreateFEltSpaceList.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEA7AA6F24AA46DE002A569F /* CreateFEltSpaceList.hpp */; };
BEAA181B20ADD42A0070343F /* PetscVec.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEC1FC7418C470C500A4EB89 /* PetscVec.hpp */; };
BEAB45AD24727EAB00B8C6F2 /* TwoStepsParallelism.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEAB45AC24727EAB00B8C6F2 /* TwoStepsParallelism.cpp */; };
BEABCEDE1AE66F4900817D37 /* libFormulationSolver.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEABCEBD1AE65A9A00817D37 /* libFormulationSolver.a */; };
......@@ -4328,7 +4330,7 @@
BE9E2E7724A0CB3700AA6678 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
BE9E2E7824A0CC4700AA6678 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = CMakeLists.txt; path = Sources/Test/ThirdParty/PETSc/Matrix/MatEqual/CMakeLists.txt; sourceTree = SOURCE_ROOT; };
BE9E2E7924A0CC8B00AA6678 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = Sources/Test/ThirdParty/PETSc/Matrix/MatEqual/main.cpp; sourceTree = SOURCE_ROOT; };
BE9E2E7A24A0CCA500AA6678 /* demo.lua */ = {isa = PBXFileReference; lastKnownFileType = file; name = demo.lua; path = Sources/Test/ThirdParty/PETSc/Matrix/MatEqual/demo.lua; sourceTree = SOURCE_ROOT; };
BE9E2E7A24A0CCA500AA6678 /* demo.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = demo.lua; path = Sources/Test/ThirdParty/PETSc/Matrix/MatEqual/demo.lua; sourceTree = SOURCE_ROOT; };
BE9EA61A1C89F50900836E0E /* ParameterAtDof.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ParameterAtDof.hpp; sourceTree = "<group>"; };
BE9FE80918CE0A6900177F79 /* Libmesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Libmesh.cpp; sourceTree = "<group>"; };
BE9FE80A18CE0A6900177F79 /* Libmesh.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Libmesh.hpp; sourceTree = "<group>"; };
......@@ -4369,6 +4371,8 @@
BEA5FA7B248F73830032F3DB /* CreateMeshDataDirectory.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CreateMeshDataDirectory.cpp; sourceTree = "<group>"; };
BEA5FA7D248F73830032F3DB /* CreateMeshDataDirectory.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CreateMeshDataDirectory.hpp; sourceTree = "<group>"; };
BEA5FA82248F73B50032F3DB /* libModel.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libModel.a; sourceTree = BUILT_PRODUCTS_DIR; };
BEA7AA6E24AA46DE002A569F /* CreateFEltSpaceList.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CreateFEltSpaceList.hxx; sourceTree = "<group>"; };
BEA7AA6F24AA46DE002A569F /* CreateFEltSpaceList.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CreateFEltSpaceList.hpp; sourceTree = "<group>"; };
BEA8A379177AD4FE009436C9 /* libUtilities.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libUtilities.a; sourceTree = BUILT_PRODUCTS_DIR; };
BEA9618B1EC223900003BCFD /* InputData.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InputData.hpp; sourceTree = "<group>"; };
BEA9618C1EC223900003BCFD /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
......@@ -9996,6 +10000,8 @@
BEA4AF0F246059D200669BBB /* WritePrepartitionedData.cpp */,
BEA4AF11246059D200669BBB /* WritePrepartitionedData.hpp */,
BEA4AF10246059D200669BBB /* WritePrepartitionedData.hxx */,
BEA7AA6F24AA46DE002A569F /* CreateFEltSpaceList.hpp */,
BEA7AA6E24AA46DE002A569F /* CreateFEltSpaceList.hxx */,
BEBEB21D19C849C200E4EA1D /* Impl */,
);
path = Internal;
......@@ -11489,6 +11495,7 @@
BE2B66581A2778C700E80864 /* BasicRefFEltFactory.hpp in Headers */,
BEDEB9521C3C0A4F00B1C71B /* DofProgramWiseIndexListPerVertexCoordIndexList.hpp in Headers */,
BE2B66451A2778C700E80864 /* Spectral.hpp in Headers */,
BEA7AA7124AA46DE002A569F /* CreateFEltSpaceList.hxx in Headers */,
BE2ED6BE1CB3E15600D00CBF /* DofStorage.hxx in Headers */,
BE2B664C1A2778C700E80864 /* TriangleP1.hpp in Headers */,
BE510D901CB3D44900E953FE /* Comp3.hpp in Headers */,
......@@ -11536,6 +11543,7 @@
BE44ECC51AC9463D00561634 /* GodOfDofManager.hxx in Headers */,
BE0170801B208C7C0058FAB1 /* TriangleP0.hpp in Headers */,
BE90E06B1A2491AE00CCAFDE /* FEltSpaceStorage.hxx in Headers */,
BEA7AA7224AA46DE002A569F /* CreateFEltSpaceList.hpp in Headers */,
BE4A09BE1C6B46E6002799C0 /* MovemeshHelper.hpp in Headers */,
BE9BB77E1CCF67550056B1B8 /* QuadratureRulePerTopology.hpp in Headers */,
BEDEB9531C3C0A4F00B1C71B /* DofProgramWiseIndexListPerVertexCoordIndexList.hxx in Headers */,
//! \file
//
//
// CreateFEltSpaceList.hpp
// MoReFEM
//
// Created by sebastien on 29/06/2020.
//Copyright © 2020 Inria. All rights reserved.
//
#ifndef MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HPP_
# define MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HPP_
# include <map>
# include "FiniteElement/FiniteElementSpace/FEltSpace.hpp"
namespace MoReFEM::Internal::FEltSpaceNS
{
/*!
* \brief Create all the \a FEltSpace objects from the input data file.
*
* \internal <b><tt>[internal]</tt></b> Should not be called outside of InitGodOfDof().
* \endinternal
*
* \copydoc doxygen_hide_input_data_arg
* \returnThe list of all \a FEltSpace detailed in the input
* data file and store them in this container which key is the index of the \a GodOfDof (which are
* not yet created when this function is called - hence the index rather than the pointer of the object).
*/
template<class InputDataT>
std::map<unsigned int, FEltSpace::vector_unique_ptr> CreateFEltSpaceList(const InputDataT& input_data);
} // namespace MoReFEM::Internal::FEltSpaceNS
# include "FiniteElement/FiniteElementSpace/Internal/CreateFEltSpaceList.hxx"
#endif // MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HPP_
//! \file
//
//
// CreateFEltSpaceList.hxx
// MoReFEM
//
// Created by sebastien on 29/06/2020.
//Copyright © 2020 Inria. All rights reserved.
//
#ifndef MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HXX_
# define MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HXX_
namespace MoReFEM::Internal::FEltSpaceNS
{
template<class InputDataT>
std::map<unsigned int, FEltSpace::vector_unique_ptr> CreateFEltSpaceList(const InputDataT& input_data)
{
std::map<unsigned int, FEltSpace::vector_unique_ptr> ret;
auto create =[&ret](const auto& section) -> void
{
namespace ipl = Internal::InputDataNS;
using section_type = std::decay_t<decltype(section)>;
const auto unique_id = section.GetUniqueId();
decltype(auto) god_of_dof_index = ipl::ExtractParameter<typename section_type::GodOfDofIndex>(section);
decltype(auto) domain_index = ipl::ExtractParameter<typename section_type::DomainIndex>(section);
auto&& extended_unknown_list =
MoReFEM::Internal::FEltSpaceNS::ExtractExtendedUnknownList(section);
decltype(auto) god_of_dof_ptr = GodOfDofManager::GetInstance(__FILE__, __LINE__).GetGodOfDofPtr(god_of_dof_index);
decltype(auto) domain_manager = DomainManager::GetInstance(__FILE__, __LINE__);
try
{
const auto& domain = domain_manager.GetDomain(domain_index, __FILE__, __LINE__);
auto felt_space_ptr = std::make_unique<FEltSpace>(god_of_dof_ptr,
domain,
unique_id,
std::move(extended_unknown_list));
ret[god_of_dof_index].emplace_back(std::move(felt_space_ptr));
}
catch(const Exception& e)
{
std::ostringstream oconv;
oconv << "Ill-defined finite element space " << unique_id << ": " << e.GetRawMessage();
throw Exception(oconv.str(), __FILE__, __LINE__);
}
};
using input_data_tuple_iteration =
Internal::InputDataNS::TupleIteration
<
typename InputDataT::Tuple,
0,
std::tuple_size<typename InputDataT::Tuple>::value
>;
input_data_tuple_iteration
::template ActIfSection<::MoReFEM::InputDataNS::BaseNS::FEltSpace>(input_data.GetTuple(),
create);
return ret;
}
} // namespace MoReFEM::Internal::FEltSpaceNS
#endif // MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CREATE_F_ELT_SPACE_LIST_HXX_
......@@ -31,6 +31,8 @@ target_sources(${MOREFEM_FELT}
"${CMAKE_CURRENT_LIST_DIR}/ComputeMatrixPattern.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Connectivity.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Connectivity.hxx"
"${CMAKE_CURRENT_LIST_DIR}/CreateFEltSpaceList.hpp"
"${CMAKE_CURRENT_LIST_DIR}/CreateFEltSpaceList.hxx"
"${CMAKE_CURRENT_LIST_DIR}/CreateNodeListHelper.hpp"
"${CMAKE_CURRENT_LIST_DIR}/CreateNodeListHelper.hxx"
"${CMAKE_CURRENT_LIST_DIR}/DofComputations.hpp"
......
......@@ -24,6 +24,7 @@
# include "FiniteElement/BoundaryConditions/DirichletBoundaryConditionManager.hpp"
# include "FiniteElement/FiniteElementSpace/FEltSpace.hpp"
# include "FiniteElement/FiniteElementSpace/GodOfDofManager.hpp"
# include "FiniteElement/FiniteElementSpace/Internal/CreateFEltSpaceList.hpp"
namespace MoReFEM
......@@ -63,22 +64,6 @@ namespace MoReFEM
void InitMostSingletonManager(const MoReDEMDataT& morefem_data);
/*!
* \brief Create all the finite element spaces.
*
* \internal <b><tt>[internal]</tt></b> Should not be called outside of InitGodOfDof().
* \endinternal
*
* \copydoc doxygen_hide_input_data_arg
* \param[out] felt_space_list_per_god_of_dof_index Instantiate all \a FEltSpace detailed in the input
* parameter file and store them in this container which key is the index of the \a GodOfDof (which are
* not yet created when this function is called).
*/
template<class InputDataT>
void CreateFEltSpaceList(const InputDataT& input_data,
std::map<unsigned int, FEltSpace::vector_unique_ptr>& felt_space_list_per_god_of_dof_index);
/*!
* \brief Init each god of dof with its finite element spaces.
*
......
......@@ -112,9 +112,8 @@ namespace MoReFEM
std::map<unsigned int, ::MoReFEM::FilesystemNS::Directory::const_unique_ptr>&&
mesh_output_directory_storage)
{
std::map<unsigned int, FEltSpace::vector_unique_ptr> felt_space_list_per_god_of_dof_index;
CreateFEltSpaceList(morefem_data.GetInputData(), felt_space_list_per_god_of_dof_index);
auto felt_space_list_per_god_of_dof_index =
FEltSpaceNS::CreateFEltSpaceList(morefem_data.GetInputData());
InitEachGodOfDof(morefem_data,
felt_space_list_per_god_of_dof_index,
......@@ -123,60 +122,6 @@ namespace MoReFEM
}
template<class InputDataT>
void CreateFEltSpaceList(const InputDataT& input_data,
std::map<unsigned int, FEltSpace::vector_unique_ptr>& felt_space_list_per_god_of_dof_index)
{
auto create =[&felt_space_list_per_god_of_dof_index](const auto& section) -> void
{
namespace ipl = Internal::InputDataNS;
using section_type = std::decay_t<decltype(section)>;
const auto unique_id = section.GetUniqueId();
decltype(auto) god_of_dof_index = ipl::ExtractParameter<typename section_type::GodOfDofIndex>(section);
decltype(auto) domain_index = ipl::ExtractParameter<typename section_type::DomainIndex>(section);
auto&& extended_unknown_list =
MoReFEM::Internal::FEltSpaceNS::ExtractExtendedUnknownList(section);
decltype(auto) god_of_dof_ptr = GodOfDofManager::GetInstance(__FILE__, __LINE__).GetGodOfDofPtr(god_of_dof_index);
decltype(auto) domain_manager = DomainManager::GetInstance(__FILE__, __LINE__);
try
{
const auto& domain = domain_manager.GetDomain(domain_index, __FILE__, __LINE__);
auto felt_space_ptr = std::make_unique<FEltSpace>(god_of_dof_ptr,
domain,
unique_id,
std::move(extended_unknown_list));
felt_space_list_per_god_of_dof_index[god_of_dof_index].emplace_back(std::move(felt_space_ptr));
}
catch(const Exception& e)
{
std::ostringstream oconv;
oconv << "Ill-defined finite element space " << unique_id << ": " << e.GetRawMessage();
throw Exception(oconv.str(), __FILE__, __LINE__);
}
};
using input_data_tuple_iteration =
Internal::InputDataNS::TupleIteration
<
typename InputDataT::Tuple,
0,
std::tuple_size<typename InputDataT::Tuple>::value
>;
input_data_tuple_iteration
::template ActIfSection<::MoReFEM::InputDataNS::BaseNS::FEltSpace>(input_data.GetTuple(),
create);
}
} // namespace ModelNS
......
......@@ -21,12 +21,14 @@ target_sources(${MOREFEM_UTILITIES}
"${CMAKE_CURRENT_LIST_DIR}/newline-eof.hpp"
"${CMAKE_CURRENT_LIST_DIR}/non-virtual-dtor.hpp"
"${CMAKE_CURRENT_LIST_DIR}/redundant-parens.hpp"
"${CMAKE_CURRENT_LIST_DIR}/reorder.hpp"
"${CMAKE_CURRENT_LIST_DIR}/reserved-id-macro.hpp"
"${CMAKE_CURRENT_LIST_DIR}/shadow-field-in-constructor.hpp"
"${CMAKE_CURRENT_LIST_DIR}/shadow-field.hpp"
"${CMAKE_CURRENT_LIST_DIR}/shorten-64-to-32.hpp"
"${CMAKE_CURRENT_LIST_DIR}/sometimes-uninitialized.hpp"
"${CMAKE_CURRENT_LIST_DIR}/undef.hpp"
"${CMAKE_CURRENT_LIST_DIR}/unused-local-typedef.hpp"
"${CMAKE_CURRENT_LIST_DIR}/unused-template.hpp"
"${CMAKE_CURRENT_LIST_DIR}/used-but-marked-unused.hpp"
"${CMAKE_CURRENT_LIST_DIR}/weak-vtables.hpp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment