Commit d869299f authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#9 - #882 FiniteElement/FiniteElementSpace: modify all Private namespace so...

#9 - #882 FiniteElement/FiniteElementSpace: modify all Private namespace so that everything is in Internal/FEltSpaceNS. Use that fact to beautify FElt space module documentation.
parent cba138be
......@@ -13,7 +13,7 @@
/// \namespace HappyHeart::Internal::BoundaryConditionNS
/// \brief Namespace that enclose internals related to boundary conditions.
/// \namespace HappyHeart::Private::FEltSpaceNS
/// \namespace HappyHeart::Internal::FEltSpaceNS
/// \brief Namespace that enclose library's developer tools related to \a FEltSpace.
......
......@@ -56,14 +56,21 @@ namespace HappyHeart
} // namespace RefFEltNS
namespace Private
namespace Internal
{
class CreateNodeListHelper;
namespace FEltSpaceNS
{
class CreateNodeListHelper;
} // namespace FEltSpaceNS
} // namespace Private
} // namespace Internal
......@@ -99,7 +106,7 @@ namespace HappyHeart
friend class FEltSpace;
//! Friendship to the only class entitled to add finite elements to the local felt space.
friend class Private::CreateNodeListHelper;
friend class Internal::FEltSpaceNS::CreateNodeListHelper;
//! Convenient storage: key is the index of the geometric element, value the actual pointer to the LocalFEltSpace.
using per_geom_elt_index = std::unordered_map<unsigned int, LocalFEltSpace::shared_ptr>;
......
......@@ -225,7 +225,7 @@ namespace HappyHeart
felt_list_per_type.push_back(std::make_pair(std::move(ref_felt_space_ptr), local_felt_space_list));
}
felt_storage_ = std::make_unique<Private::FEltSpaceNS::Storage>(MpiHappyHeart(),
felt_storage_ = std::make_unique<Internal::FEltSpaceNS::Storage>(MpiHappyHeart(),
std::move(felt_list_per_type));
}
......@@ -474,7 +474,7 @@ namespace HappyHeart
// Create an helper object which retains all relevant informations to perform the move during the course
// of the time iterations.
auto&& helper_per_numbering_subset =
std::make_pair(numbering_subset.GetUniqueId(), FEltSpaceNS::Private::MovemeshHelper(god_of_dof,
std::make_pair(numbering_subset.GetUniqueId(), Internal::FEltSpaceNS::MovemeshHelper(god_of_dof,
extended_unknown
#ifndef NDEBUG
, felt_space_dof_list
......@@ -489,7 +489,7 @@ namespace HappyHeart
}
const FEltSpaceNS::Private::MovemeshHelper& FEltSpace::GetMovemeshHelper(const GlobalVector& vector) const noexcept
const Internal::FEltSpaceNS::MovemeshHelper& FEltSpace::GetMovemeshHelper(const GlobalVector& vector) const noexcept
{
const auto& movemesh_helper_data = GetMovemeshHelperStorage();
......
......@@ -85,14 +85,21 @@ namespace HappyHeart
} // namespace ConformInterpolatorNS
namespace Private
namespace Internal
{
struct ReduceToProcessorWise;
namespace FEltSpaceNS
{
struct ReduceToProcessorWise;
} // namespace FEltSpaceNS
} // namespace Private
} // namespace Internal
......@@ -158,7 +165,7 @@ namespace HappyHeart
*
* I do not want this method to be public: this access is quite insecure!
*/
friend struct Private::ReduceToProcessorWise;
friend struct Internal::FEltSpaceNS::ReduceToProcessorWise;
/*!
......@@ -188,7 +195,7 @@ namespace HappyHeart
//! Friendship to GodOfDof (which stores the FEltSpace defined on its related mesh).
friend GodOfDof;
//! Friendship to AtDof parameter policy, which requires access to \a BasicRefFElt \as ShapeFunction() method.
//! Friendship to AtDof parameter policy, which requires access to \a BasicRefFElt \a ShapeFunction() method.
template
<
ParameterNS::Type TypeT,
......@@ -471,10 +478,10 @@ namespace HappyHeart
//! Get access to the object in charge of finite element storage.
const Private::FEltSpaceNS::Storage& GetFEltStorage() const;
const Internal::FEltSpaceNS::Storage& GetFEltStorage() const;
//! Get non constant access to the object in charge of finite element storage.
Private::FEltSpaceNS::Storage& GetNonCstFEltStorage();
Internal::FEltSpaceNS::Storage& GetNonCstFEltStorage();
# ifndef NDEBUG
//! Assert GodOfDof has been properly initialized.
......@@ -482,13 +489,13 @@ namespace HappyHeart
# endif // NDEBUG
//! Access to useful data when a mesh must be moved according to (felt_space, numbering subset) data.
const std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper>& GetMovemeshHelperStorage() const noexcept;
const std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper>& GetMovemeshHelperStorage() const noexcept;
//! Access to useful data when a mesh must be moved according to (felt_space, numbering subset) data.
std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper>& GetNonCstMovemeshHelperStorage() noexcept;
std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper>& GetNonCstMovemeshHelperStorage() noexcept;
//! Access to the movemesh helper related to a given vector.
const FEltSpaceNS::Private::MovemeshHelper& GetMovemeshHelper(const GlobalVector& vector) const noexcept;
const Internal::FEltSpaceNS::MovemeshHelper& GetMovemeshHelper(const GlobalVector& vector) const noexcept;
private:
......@@ -502,7 +509,7 @@ namespace HappyHeart
* upon which the whole finite element space is built.
*
*/
Private::FEltSpaceNS::Storage::const_unique_ptr felt_storage_ = nullptr;
Internal::FEltSpaceNS::Storage::const_unique_ptr felt_storage_ = nullptr;
//! Dimension considered within the FEltSpace.
unsigned int dimension_ = NumericNS::UninitializedIndex<unsigned int>();
......@@ -535,7 +542,7 @@ namespace HappyHeart
*
* Relevant only for numbering subsets for which do_move_mesh is true.
*/
std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper> movemesh_helper_data_;
std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper> movemesh_helper_data_;
//! List of processor-wise dofs (ghost excluded).
Dof::vector_shared_ptr dof_list_;
......
......@@ -41,7 +41,7 @@ namespace HappyHeart
}
inline const Private::FEltSpaceNS::Storage& FEltSpace::GetFEltStorage() const
inline const Internal::FEltSpaceNS::Storage& FEltSpace::GetFEltStorage() const
{
assert(!(!felt_storage_));
# ifndef NDEBUG
......@@ -52,9 +52,9 @@ namespace HappyHeart
}
inline Private::FEltSpaceNS::Storage& FEltSpace::GetNonCstFEltStorage()
inline Internal::FEltSpaceNS::Storage& FEltSpace::GetNonCstFEltStorage()
{
return const_cast<Private::FEltSpaceNS::Storage&>(GetFEltStorage());
return const_cast<Internal::FEltSpaceNS::Storage&>(GetFEltStorage());
}
......@@ -116,29 +116,29 @@ namespace HappyHeart
}
inline const std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper>& FEltSpace
inline const std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper>& FEltSpace
::GetMovemeshHelperStorage() const noexcept
{
return movemesh_helper_data_;
}
inline std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper>& FEltSpace
inline std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper>& FEltSpace
::GetNonCstMovemeshHelperStorage() noexcept
{
return const_cast<std::map<unsigned int, FEltSpaceNS::Private::MovemeshHelper>&>(GetMovemeshHelperStorage());
return const_cast<std::map<unsigned int, Internal::FEltSpaceNS::MovemeshHelper>&>(GetMovemeshHelperStorage());
}
inline void FEltSpace::MoveMesh(const GlobalVector& vector) const
{
GetMovemeshHelper(vector).Movemesh(vector, FEltSpaceNS::Private::MovemeshHelper::From::current_mesh);
GetMovemeshHelper(vector).Movemesh(vector, Internal::FEltSpaceNS::MovemeshHelper::From::current_mesh);
}
inline void FEltSpace::MoveMeshFromInitialPosition(const GlobalVector& vector) const
{
GetMovemeshHelper(vector).Movemesh(vector, FEltSpaceNS::Private::MovemeshHelper::From::initial_mesh);
GetMovemeshHelper(vector).Movemesh(vector, Internal::FEltSpaceNS::MovemeshHelper::From::initial_mesh);
}
......
......@@ -62,7 +62,7 @@ namespace HappyHeart
: Crtp::HappyHeartMpi<GodOfDof>(mpi),
unique_id_parent(mesh.GetUniqueId()),
mesh_(mesh),
quadrature_rule_tracker_(std::make_unique<Private::QuadratureRuleTracker>())
quadrature_rule_tracker_(std::make_unique<Internal::FEltSpaceNS::QuadratureRuleTracker>())
{ }
......@@ -116,9 +116,9 @@ namespace HappyHeart
// Program-wise numbering is also applied: each of them gets as program-wise index its position in the new
// vector.
if (mpi.Nprocessor<int>() > 1)
Private::PreparePartition(mpi,
GetFEltSpaceList(),
node_bearer_list);
Internal::FEltSpaceNS::PreparePartition(mpi,
GetFEltSpaceList(),
node_bearer_list);
else
{
for (auto& node_bearer_ptr : node_bearer_list)
......@@ -137,15 +137,16 @@ namespace HappyHeart
{
unsigned int current_index = 0u;
Private::ComputeDofIndexesForNumberingSubset<MpiScale::program_wise>(node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_index);
Internal::FEltSpaceNS
::ComputeDofIndexesForNumberingSubset<MpiScale::program_wise>(node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_index);
}
}
// Compute the number of program- and processor- wise dofs.
Ndof_holder_ = std::make_unique<Private::NdofHolder>(node_bearer_list, numbering_subset_list, rank);
Ndof_holder_ = std::make_unique<Internal::FEltSpaceNS::NdofHolder>(node_bearer_list, numbering_subset_list, rank);
}
......@@ -163,18 +164,19 @@ namespace HappyHeart
// Reduce the list of node bearers.
Private::ReduceNodeBearerList(rank, GetNonCstNodeBearerList());
Internal::FEltSpaceNS::ReduceNodeBearerList(rank, GetNonCstNodeBearerList());
// Compute the pattern of the global matrix.
const auto& felt_space_list = GetFEltSpaceList();
const auto& node_bearer_list = GetNodeBearerList();
const auto& numbering_subset_list = GetNumberingSubsetList();
matrix_pattern_per_numbering_subset_ = Private::ComputeMatrixPattern::Perform(rank,
felt_space_list,
node_bearer_list,
numbering_subset_list,
GetNdofHolder());
matrix_pattern_per_numbering_subset_ =
Internal::FEltSpaceNS::ComputeMatrixPattern::Perform(rank,
felt_space_list,
node_bearer_list,
numbering_subset_list,
GetNdofHolder());
// - Reduce the list of finite elements in each finite element space to the processor-wise ones only.
// - Compute the ghost node bearers for each finite element space.
......@@ -262,7 +264,7 @@ namespace HappyHeart
{
const auto& boundary_condition_list = DirichletBoundaryConditionManager::GetInstance().GetList();
Private::CreateNodeListHelper node_helper(node_bearer_list_);
Internal::FEltSpaceNS::CreateNodeListHelper node_helper(node_bearer_list_);
#ifdef HAPPY_HEART_DEBUG_FILES
const int rank = MpiHappyHeart().Rank<int>();
......@@ -339,10 +341,11 @@ namespace HappyHeart
auto& processor_wise_dof_list = GetNonCstProcessorWiseDofList();
Private::ComputeProcessorWiseDofIndexes(node_bearer_list,
CurrentDofNumberingScheme(),
current_processor_wise_or_ghost_dof_index,
processor_wise_dof_list);
Internal::FEltSpaceNS
::ComputeProcessorWiseDofIndexes(node_bearer_list,
CurrentDofNumberingScheme(),
current_processor_wise_or_ghost_dof_index,
processor_wise_dof_list);
assert(NprocessorWiseDof() == current_processor_wise_or_ghost_dof_index);
......@@ -351,10 +354,11 @@ namespace HappyHeart
auto& ghosted_dof_list = GetNonCstGhostedDofList();
Private::ComputeProcessorWiseDofIndexes(ghost_node_bearer_list,
CurrentDofNumberingScheme(),
current_processor_wise_or_ghost_dof_index,
ghosted_dof_list);
Internal::FEltSpaceNS
::ComputeProcessorWiseDofIndexes(ghost_node_bearer_list,
CurrentDofNumberingScheme(),
current_processor_wise_or_ghost_dof_index,
ghosted_dof_list);
// Less<Dof> sort the Dofs per program-wise index, but per construct program-wise and processor-wise indexes
// get the same relative ordering.
......@@ -375,18 +379,20 @@ namespace HappyHeart
unsigned int current_processor_wise_or_ghost_dof_index = 0u;
{
Private::ComputeDofIndexesForNumberingSubset<MpiScale::processor_wise>(node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_processor_wise_or_ghost_dof_index);
Internal::FEltSpaceNS
::ComputeDofIndexesForNumberingSubset<MpiScale::processor_wise>(node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_processor_wise_or_ghost_dof_index);
}
// Ghost dofs are created similarly; the same index keeps being used (so we get first all processor-wise dofs
// and then all ghost in a Petsc parallel vector).
Private::ComputeDofIndexesForNumberingSubset<MpiScale::processor_wise>(ghost_node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_processor_wise_or_ghost_dof_index);
Internal::FEltSpaceNS
::ComputeDofIndexesForNumberingSubset<MpiScale::processor_wise>(ghost_node_bearer_list,
CurrentDofNumberingScheme(),
numbering_subset_ptr,
current_processor_wise_or_ghost_dof_index);
}
}
......@@ -399,11 +405,11 @@ namespace HappyHeart
NodeBearer::vector_shared_ptr processor_wise_node_bearer_list;
Private::ReduceToProcessorWise::Perform(mpi,
GetFEltSpaceList(),
processor_wise_node_bearer_list,
GetNonCstGhostNodeBearerList(),
GetNonCstGeometricMeshRegion());
Internal::FEltSpaceNS::ReduceToProcessorWise::Perform(mpi,
GetFEltSpaceList(),
processor_wise_node_bearer_list,
GetNonCstGhostNodeBearerList(),
GetNonCstGeometricMeshRegion());
}
......
......@@ -460,13 +460,13 @@ namespace HappyHeart
void PrepareOutput();
//! Accessor to NdofHolder.
const Private::NdofHolder& GetNdofHolder() const;
const Internal::FEltSpaceNS::NdofHolder& GetNdofHolder() const;
//! Accessor to the object that stores all the quadrature rules related to the GodOfDof.
Private::QuadratureRuleTracker& GetNonCstQuadratureRuleTracker() const noexcept;
Internal::FEltSpaceNS::QuadratureRuleTracker& GetNonCstQuadratureRuleTracker() const noexcept;
//! Accessor to the object that stores all the quadrature rules related to the GodOfDof.
const Private::QuadratureRuleTracker& GetQuadratureRuleTracker() const noexcept;
const Internal::FEltSpaceNS::QuadratureRuleTracker& GetQuadratureRuleTracker() const noexcept;
/*!
......@@ -555,7 +555,7 @@ namespace HappyHeart
NodeBearer::vector_shared_ptr ghost_node_bearer_list_;
//! Objects that counts the number of dofs in several configurations.
Private::NdofHolder::const_unique_ptr Ndof_holder_ = nullptr;
Internal::FEltSpaceNS::NdofHolder::const_unique_ptr Ndof_holder_ = nullptr;
/*!
* \brief List of processor-wise dofs.
......@@ -576,7 +576,7 @@ namespace HappyHeart
Dof::vector_shared_ptr ghosted_dof_list_;
//! CSR Pattern of the matrix.
Private::MatrixPattern::vector_const_unique_ptr matrix_pattern_per_numbering_subset_;
Internal::FEltSpaceNS::MatrixPattern::vector_const_unique_ptr matrix_pattern_per_numbering_subset_;
//! Path to the output directory into which god of dof data are written.
std::string output_directory_;
......@@ -590,7 +590,7 @@ namespace HappyHeart
* \internal <b><tt>[internal]</tt></b> The data is mutable because the registration occurs in operators, which otherwise should only
* be allowed to read data from both finite element space and god of dof.
*/
mutable Private::QuadratureRuleTracker::unique_ptr quadrature_rule_tracker_ = nullptr;
mutable Internal::FEltSpaceNS::QuadratureRuleTracker::unique_ptr quadrature_rule_tracker_ = nullptr;
# ifndef NDEBUG
......
......@@ -36,7 +36,8 @@ namespace HappyHeart
template<class InputParameterDataT>
void GodOfDof::Init2(const InputParameterDataT& input_parameter_data)
{
Private::SetFromInputParameterData<Private::DofProgramWiseIndexListPerVertexCoordIndexManager>(input_parameter_data, *this);
using type = Internal::FEltSpaceNS::DofProgramWiseIndexListPerVertexCoordIndexManager;
Private::SetFromInputParameterData<type>(input_parameter_data, *this);
}
......@@ -176,7 +177,7 @@ namespace HappyHeart
}
inline const Private::NdofHolder& GodOfDof::GetNdofHolder() const
inline const Internal::FEltSpaceNS::NdofHolder& GodOfDof::GetNdofHolder() const
{
assert(!(!Ndof_holder_));
return *Ndof_holder_;
......@@ -195,16 +196,16 @@ namespace HappyHeart
}
inline const Private::QuadratureRuleTracker& GodOfDof::GetQuadratureRuleTracker() const noexcept
inline const Internal::FEltSpaceNS::QuadratureRuleTracker& GodOfDof::GetQuadratureRuleTracker() const noexcept
{
assert(!(!quadrature_rule_tracker_));
return *quadrature_rule_tracker_;
}
inline Private::QuadratureRuleTracker& GodOfDof::GetNonCstQuadratureRuleTracker() const noexcept
inline Internal::FEltSpaceNS::QuadratureRuleTracker& GodOfDof::GetNonCstQuadratureRuleTracker() const noexcept
{
return const_cast<Private::QuadratureRuleTracker&>(GetQuadratureRuleTracker());
return const_cast<Internal::FEltSpaceNS::QuadratureRuleTracker&>(GetQuadratureRuleTracker());
}
......
......@@ -16,30 +16,37 @@ namespace HappyHeart
{
namespace Private
namespace Internal
{
unsigned int GetUniqueId(const GodOfDof& god_of_dof)
namespace FEltSpaceNS
{
return god_of_dof.GetUniqueId();
}
const GeometricMeshRegion& GetGeometricMeshRegion(const GodOfDof& god_of_dof)
{
return god_of_dof.GetGeometricMeshRegion();
}
const Wrappers::Mpi& GetMpi(const GodOfDof& god_of_dof)
{
return god_of_dof.MpiHappyHeart();
}
unsigned int GetUniqueId(const GodOfDof& god_of_dof)
{
return god_of_dof.GetUniqueId();
}
const GeometricMeshRegion& GetGeometricMeshRegion(const GodOfDof& god_of_dof)
{
return god_of_dof.GetGeometricMeshRegion();
}
const Wrappers::Mpi& GetMpi(const GodOfDof& god_of_dof)
{
return god_of_dof.MpiHappyHeart();
}
} // namespace FEltSpaceNS
} // namespace Private
} // namespace Internal
} // namespace HappyHeart
......@@ -29,64 +29,65 @@ namespace HappyHeart
class GodOfDof;
// ============================
// End of forward declarations.
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
// ============================
namespace Private
namespace Internal
{
/// \addtogroup FElt
///@{
/*!
* \class doxygen_hide_break_circular_dependancy_text
*
* This merely calls the \a GodOfDof namesake method, but this allows to do so without breaking
* the cycling dependancy between \a GodOfDof and \a FEltSpace.
*
* \param[in] god_of_dof God of dof which member quantity is required.
*/
/*!
* \brief Return the id of \a god_of_dof.
*
* \copydoc doxygen_hide_break_circular_dependancy_text
*
* \return Unique identifier of the \a god_of_dof.
*/
unsigned int GetUniqueId(const GodOfDof& god_of_dof);
namespace FEltSpaceNS
{
/*!
* \class doxygen_hide_break_circular_dependancy_text
*
* This merely calls the \a GodOfDof namesake method, but this allows to do so without breaking
* the cycling dependancy between \a GodOfDof and \a FEltSpace.
*
* \param[in] god_of_dof God of dof which member quantity is required.
*/
/*!
* \brief Return the id of \a god_of_dof.
*
* \copydoc doxygen_hide_break_circular_dependancy_text
*
* \return Unique identifier of the \a god_of_dof.
*/
unsigned int GetUniqueId(const GodOfDof& god_of_dof);
/*!
* \brief Return the geometric mesh region of a god of dof.
*
* \copydoc doxygen_hide_break_circular_dependancy_text
*
* \return GeometricMeshRegion related to the \a god_of_dof.
*/
const GeometricMeshRegion& GetGeometricMeshRegion(const GodOfDof& god_of_dof);
/*!
* \brief Return the geometric mesh region of a god of dof.