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

#531 LocalFEltSpace is now in charge of computing local2global for its finite elements.

parent f1ed06ae
......@@ -32,7 +32,6 @@ namespace HappyHeart
const auto& node_list = GetNodeList();
assert(!node_list.empty());
// DEV TMP I AM HERE!
const auto& numbering_subset = GetUnknownAndNumberingSubset().GetNumberingSubset();
const std::size_t Ncomponent = node_list.back()->Ndof();
......
......@@ -57,6 +57,20 @@ namespace HappyHeart
{
return domain.IsGeometricEltInside(local_felt_space.GetGeometricElt());
}
void LocalFEltSpace
::ComputeLocal2Global(DoComputeLocal2GlobalProcessorWise do_compute_local_2_global_processor_wise)
{
const auto& finite_elt_list = GetFiniteEltList();
for (const auto& finite_elt_ptr : finite_elt_list)
{
assert(!(!finite_elt_ptr));
finite_elt_ptr->ComputeLocal2Global(do_compute_local_2_global_processor_wise);
}
}
......
......@@ -97,7 +97,15 @@ namespace HappyHeart
//! Set the list of nodes.
void SetNodeBearerList(NodeBearer::vector_shared_ptr&& node_bearer_list);
/*!
* \brief Compute the local2global array for each finite element.
*
* \param[in] do_compute_local_2_global_processor_wise If yes, compute local -> global processor-wise index. This
* is not necessary for all global operators, so do not clutter space when it doesn't matter.
*/
void ComputeLocal2Global(DoComputeLocal2GlobalProcessorWise do_compute_local_2_global_processor_wise);
private:
......
......@@ -71,13 +71,7 @@ namespace HappyHeart
for (auto local_felt_space_ptr : local_felt_space_list)
{
assert(!(!local_felt_space_ptr));
const auto& finite_elt_list = local_felt_space_ptr->GetFiniteEltList();
for (const auto& finite_elt_ptr : finite_elt_list)
{
assert(!(!finite_elt_ptr));
finite_elt_ptr->ComputeLocal2Global(do_compute_local_2_global_processor_wise);
}
local_felt_space_ptr->ComputeLocal2Global(do_compute_local_2_global_processor_wise);
}
}
}
......
......@@ -61,7 +61,6 @@ namespace HappyHeart
/*!
* \brief Access to one of the unknowns.
*
* There can be at most two unknowns for a given operator,
* It is highly recommanded to define an enum class in each instantiation to determine which is called,
* for instance:
* \code
......@@ -71,7 +70,6 @@ namespace HappyHeart
* vectorial = 1
* };
*
* There is a default value not to bother for all operators that are only related to one unknown.
*/
const Unknown& GetUnknown(std::size_t index = 0) const;
......
......@@ -409,9 +409,15 @@ namespace HappyHeart
AllocateGradientFEltPhi DoAllocateGradientFEltPhi() const;
template<class LinearAlgebraTupleT>
void InjectIntoGlobalLinearAlgebra531(const LocalFEltSpace& local_felt_space,
LocalVariationalOperatorT& local_operator,
GlobalMatrixWithCoefficient& global_linear_algebra) const;
const LinearAlgebraTupleT& global_linear_algebra) const;
void InjectIntoGlobalLinearAlgebra531(const LocalFEltSpace& local_felt_space,
LocalVariationalOperatorT& local_operator,
GlobalMatrixWithCoefficient& global_linear_algebra) const; // \todo #531 remove it
private:
......
......@@ -514,7 +514,7 @@ namespace HappyHeart
template
<
class DerivedT,
class DerivedT,
class LocalVariationalOperatorT,
class UnknownPolicyT
>
......@@ -536,6 +536,32 @@ namespace HappyHeart
}
template
<
class DerivedT,
class LocalVariationalOperatorT,
class UnknownPolicyT
>
template<class LinearAlgebraTupleT>
void GlobalVariationalOperator<DerivedT, LocalVariationalOperatorT, UnknownPolicyT>
::InjectIntoGlobalLinearAlgebra531(const LocalFEltSpace& local_felt_space,
LocalVariationalOperatorT& local_operator,
const LinearAlgebraTupleT& linear_algebra_tuple) const
{
auto& elementary_data = local_operator.GetNonCstElementaryData();
auto& local_matrix = elementary_data.GetNonCstMatrixResult();
const auto& unknown = local_operator.GetUnknown();
const auto& unknown_and_numbering_subset = elementary_data.GetRefFElt(unknown).GetUnknownAndNumberingSubset();
const auto& local2global = local_felt_space.GetFiniteElt(unknown_and_numbering_subset).template GetLocal2Global<MpiScale::program_wise>();
// auto& global_matrix = global_linear_algebra.first;
// Private::ReportValuesInGlobalMatrix(local_matrix, global_linear_algebra.second, local2global, local2global, global_matrix);
}
......
......@@ -128,8 +128,8 @@ namespace HappyHeart
* (which lock and unlock properly the mutex).
*/
template<class LocalOperatorT>
const std::vector<PetscInt>& ComputeAggregateLocal2Global(const LocalFEltSpace& local_felt_space,
const LocalOperatorT& local_operator) const;
const std::vector<PetscInt>& ComputeAggregateLocal2Global(const LocalFEltSpace& local_felt_space,
const LocalOperatorT& local_operator) const;
......
......@@ -25,6 +25,11 @@ namespace HappyHeart
template<class LinearAlgebraTupleT>
void Assembly531(const LinearAlgebraTupleT& linear_algebra_tuple);
template<class LinearAlgebraTupleT>
void InjectInGlobalMatrix(const LinearAlgebraTupleT& linear_algebra_tuple);
} //namespace Private
......
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