Commit e84976b7 authored by GILLES Sebastien's avatar GILLES Sebastien

#1526 Add GeometricElt related to boundary conditions to the list of those...

#1526 Add GeometricElt related to boundary conditions to the list of those concerned after reduction. Don 't forget in the process their Coords - they may not be used in the finite element aspect of the code but they aere nonetheless needed to retain internal consistency of the geometric elements.
parent f891fcd3
......@@ -106,6 +106,10 @@ namespace MoReFEM
//! \unique_id_param_in_accessor{GodOfDof}
GodOfDof::shared_ptr GetGodOfDofPtr(unsigned int unique_id) const;
//! Fetch the god of dof object associated with \a Mesh.
//! \param[in] mesh Mesh associated to the \a GodOfDof (by construct both share the same unique id).
const GodOfDof& GetGodOfDof(const Mesh& mesh) const;
//! Access to the storage.
const auto& GetStorage() const noexcept;
......
......@@ -44,6 +44,12 @@ namespace MoReFEM
}
inline const GodOfDof& GodOfDofManager::GetGodOfDof(const Mesh& mesh) const
{
return GetGodOfDof(mesh.GetUniqueId());
}
inline const auto& GodOfDofManager::GetStorage() const noexcept
{
return list_;
......
......@@ -16,7 +16,10 @@
#include "Geometry/Mesh/Mesh.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComputeGeometricEltList.hpp"
#include "FiniteElement/FiniteElementSpace/FEltSpace.hpp"
#include "FiniteElement/BoundaryConditions/DirichletBoundaryConditionManager.hpp"
#include "FiniteElement/FiniteElementSpace/Internal/Impl/AttributeProcessorHelper.hpp"
#include "FiniteElement/FiniteElementSpace/Internal/ReduceToProcessorWise.hpp"
......@@ -215,11 +218,46 @@ namespace MoReFEM
}
}
}
// Don't forget boundary condition geometric elements..
Coords::vector_shared_ptr bc_coords_list;
{
decltype(auto) bc_manager = DirichletBoundaryConditionManager::GetInstance(__FILE__, __LINE__);
decltype(auto) bc_list = bc_manager.GetList();
for (const auto& bc_ptr : bc_list)
{
assert(!(!bc_ptr));
const auto& bc = *bc_ptr;
const auto boundary_condition_geom_elt_list =
Internal::BoundaryConditionNS::ComputeGeometricEltList(mesh, bc);
assert(std::none_of(boundary_condition_geom_elt_list.cbegin(),
boundary_condition_geom_elt_list.cend(),
Utilities::IsNullptr<GeometricElt::shared_ptr>));
std::copy(boundary_condition_geom_elt_list.cbegin(),
boundary_condition_geom_elt_list.cend(),
std::back_inserter(processor_wise_geo_element));
for (const auto& geom_elt_ptr : boundary_condition_geom_elt_list)
{
assert(!(!geom_elt_ptr));
decltype(auto) coords_list = geom_elt_ptr->GetCoordsList();
std::copy(coords_list.begin(),
coords_list.end(),
std::back_inserter(bc_coords_list));
}
}
}
Utilities::EliminateDuplicate(processor_wise_geo_element,
Utilities::PointerComparison::Less<GeometricElt::shared_ptr>(),
Utilities::PointerComparison::Equal<GeometricElt::shared_ptr>());
// Extract the list of \a Coords from the node bearer lists.
Coords::vector_shared_ptr processor_wise_coords_list;
Coords::vector_shared_ptr ghosted_coords_list;
......@@ -227,6 +265,21 @@ namespace MoReFEM
CoordsListHelper(processor_wise_node_bearer_list, processor_wise_coords_list);
CoordsListHelper(ghost_node_bearer_list, ghosted_coords_list);
Utilities::EliminateDuplicate(bc_coords_list,
Utilities::PointerComparison::Less<Coords::shared_ptr>(),
Utilities::PointerComparison::Equal<Coords::shared_ptr>());
// If a \a Coord is not in processor_wise_coords_list, add it to the ghost list (regardless of whether
// it is already there or not: we will simply discard duplicate anyway).
std::set_difference(bc_coords_list.begin(),
bc_coords_list.end(),
processor_wise_coords_list.begin(),
processor_wise_coords_list.end(),
std::back_inserter(ghosted_coords_list),
Utilities::PointerComparison::Less<Coords::shared_ptr>());
Utilities::EliminateDuplicate(processor_wise_coords_list,
Utilities::PointerComparison::Less<Coords::shared_ptr>(),
Utilities::PointerComparison::Equal<Coords::shared_ptr>());
......
......@@ -76,8 +76,9 @@ namespace MoReFEM
const unsigned int Ngeometric_element = static_cast<unsigned int>(unsort_list.size());
indexes.reserve(Ngeometric_element);
for (auto geometric_element : unsort_list)
for (const auto& geometric_element : unsort_list)
{
assert(!(!geometric_element));
data_.push_back(geometric_element);
indexes.push_back(geometric_element->GetIndex());
}
......
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