13 #if !defined(KRATOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER_WITH_CONSTRAINTS)
14 #define KRATOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER_WITH_CONSTRAINTS
17 #include <unordered_set>
18 #include <unordered_map>
87 template <
class TSparseSpace,
170 typename TLinearSolver::Pointer pNewLinearSystemSolver,
172 ) :
BaseType(pNewLinearSystemSolver)
183 typename TLinearSolver::Pointer pNewLinearSystemSolver,
184 const bool CheckConstraintRelation =
true,
185 const bool ResetRelationMatrixEachIteration =
false
204 typename BuilderAndSolverBaseType::Pointer
Create(
205 typename TLinearSolver::Pointer pNewLinearSystemSolver,
209 return Kratos::make_shared<ClassType>(pNewLinearSystemSolver,ThisParameters);
223 SetUpSystemWithConstraints(rModelPart);
237 typename TSchemeType::Pointer pScheme,
260 typename TSchemeType::Pointer pScheme,
279 typename TSchemeType::Pointer pScheme,
303 typename TSchemeType::Pointer pScheme,
321 "name" : "elimination_builder_and_solver_with_constraints",
322 "check_constraint_relation" : true,
323 "reset_relation_matrix_each_iteration" : true
329 return default_parameters;
338 return "elimination_builder_and_solver_with_constraints";
354 std::string
Info()
const override
356 return "ResidualBasedEliminationBuilderAndSolverWithConstraints";
421 const SizeType local_size_1 = rTransformationMatrix.size1();
423 for (
IndexType i_local = 0; i_local < local_size_1; ++i_local) {
424 IndexType i_global = rSlaveEquationId[i_local];
439 typename TSchemeType::Pointer pScheme,
459 typename TSchemeType::Pointer pScheme,
471 ApplyMasterSlaveRelation(pScheme, rModelPart, rA, rDx, rb);
475 TSparseSpace::SetToZero(dummy_Dx);
476 ComputeEffectiveConstant(pScheme, rModelPart, dummy_Dx);
488 "Before the solution of the system" <<
"\nSystem Matrix = " << rA <<
"\nUnknowns vector = " << rDx <<
"\nRHS vector = " << rb << std::endl;
492 const double start_solve =
timer.ElapsedSeconds();
497 const double stop_solve =
timer.ElapsedSeconds();
500 ComputeEffectiveConstant(pScheme, rModelPart, rDx);
503 const double start_reconstruct_slaves =
timer.ElapsedSeconds();
504 ReconstructSlaveSolutionAfterSolve(pScheme, rModelPart, rA, rDx, rb);
506 const double stop_reconstruct_slaves =
timer.ElapsedSeconds();
507 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", (this->
GetEchoLevel() >= 1 && rModelPart.
GetCommunicator().
MyPID() == 0)) <<
"Reconstruct slaves time: " << stop_reconstruct_slaves - start_reconstruct_slaves << std::endl;
513 "After the solution of the system" <<
"\nSystem Matrix = " << rA <<
"\nUnknowns vector = " << rDx <<
"\nRHS vector = " << rb << std::endl;
525 typename TSchemeType::Pointer pScheme,
542 ApplyDirichletConditionsRHS(pScheme, rModelPart, rb);
559 if (is_master_fixed || is_slave) {
560 const IndexType equation_id = r_dof.EquationId();
568 "After the solution of the system" <<
"\nRHS vector = " << rb << std::endl;
578 typename TSchemeType::Pointer pScheme,
588 typedef std::unordered_set < DofPointerType, DofPointerHasher> set_type;
591 DofsArrayType dof_temp_all, dof_temp_solvable, dof_temp_slave;
602 set_type dof_global_set, dof_global_slave_set;
604 #pragma omp parallel firstprivate(dof_list, second_dof_list)
609 set_type dofs_tmp_set, dof_temp_slave_set;
610 dofs_tmp_set.reserve(20000);
611 dof_temp_slave_set.reserve(200);
615 const int number_of_elements =
static_cast<int>(r_elements_array.
size());
616 #pragma omp for schedule(guided, 512) nowait
617 for (
int i = 0;
i < number_of_elements; ++
i) {
618 auto it_elem = r_elements_array.
begin() +
i;
621 pScheme->GetDofList(*it_elem, dof_list, r_current_process_info);
622 dofs_tmp_set.insert(dof_list.begin(), dof_list.end());
627 const int number_of_conditions =
static_cast<int>(r_conditions_array.
size());
628 #pragma omp for schedule(guided, 512) nowait
629 for (
int i = 0;
i < number_of_conditions; ++
i) {
630 auto it_cond = r_conditions_array.
begin() +
i;
633 pScheme->GetDofList(*it_cond, dof_list, r_current_process_info);
634 dofs_tmp_set.insert(dof_list.begin(), dof_list.end());
639 const int number_of_constraints =
static_cast<int>(r_constraints_array.size());
640 #pragma omp for schedule(guided, 512) nowait
641 for (
int i = 0;
i < number_of_constraints; ++
i) {
642 auto it_const = r_constraints_array.begin() +
i;
645 it_const->GetDofList(dof_list, second_dof_list, r_current_process_info);
646 dofs_tmp_set.insert(dof_list.begin(), dof_list.end());
647 dofs_tmp_set.insert(second_dof_list.begin(), second_dof_list.end());
648 dof_temp_slave_set.insert(dof_list.begin(), dof_list.end());
654 dof_global_set.insert(dofs_tmp_set.begin(), dofs_tmp_set.end());
655 dof_global_slave_set.insert(dof_temp_slave_set.begin(), dof_temp_slave_set.end());
659 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", ( this->
GetEchoLevel() > 2)) <<
"Initializing ordered array filling\n" << std::endl;
662 dof_temp_all.
reserve(dof_global_set.size());
663 for (
auto p_dof : dof_global_set) {
669 dof_temp_slave.
reserve(dof_global_slave_set.size());
670 for (
auto p_dof : dof_global_slave_set) {
673 dof_temp_slave.
Sort();
686 #ifdef USE_LOCKS_IN_ASSEMBLY
687 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", ( this->
GetEchoLevel() > 2)) <<
"Initializing lock array" << std::endl;
689 if (BaseType::mLockArray.size() != 0) {
690 for (
int i = 0; i < static_cast<int>(BaseType::mLockArray.size()); ++
i) {
691 omp_destroy_lock(&BaseType::mLockArray[
i]);
696 for (
int i = 0; i < static_cast<int>(BaseType::mLockArray.size()); ++
i) {
697 omp_init_lock(&BaseType::mLockArray[
i]);
700 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", ( this->
GetEchoLevel() > 2)) <<
"End of setup dof set\n" << std::endl;
708 KRATOS_ERROR_IF_NOT(dof_iterator->HasReaction()) <<
"Reaction variable not set for the following : " << std::endl
709 <<
"Node : " << dof_iterator->Id() << std::endl
710 <<
"Dof : " << (*dof_iterator) << std::endl <<
"Not possible to calculate reactions." << std::endl;
761 TSparseSpace::SetToZero(rDx);
778 typename TSchemeType::Pointer pScheme,
790 std::vector<IndexSetType> indices(equation_size);
794 rIndices.reserve(40);
801 #pragma omp parallel firstprivate(ids, second_ids)
807 std::vector<IndexSetType> temp_indexes(equation_size);
810 for (
int index = 0; index < static_cast<int>(equation_size); ++index)
811 temp_indexes[index].reserve(30);
814 const int number_of_elements =
static_cast<int>(rModelPart.
Elements().
size());
820 #pragma omp for schedule(guided, 512) nowait
821 for (
int i_elem = 0; i_elem<number_of_elements; ++i_elem) {
822 auto it_elem = el_begin + i_elem;
823 pScheme->EquationId(*it_elem, ids, r_current_process_info);
825 for (
auto& id_i : ids) {
827 auto& row_indices = temp_indexes[id_i];
828 for (
auto& id_j : ids) {
830 row_indices.insert(id_j);
838 const int number_of_conditions =
static_cast<int>(rModelPart.
Conditions().size());
844 #pragma omp for schedule(guided, 512) nowait
845 for (
int i_cond = 0; i_cond<number_of_conditions; ++i_cond) {
846 auto it_cond = cond_begin + i_cond;
847 pScheme->EquationId(*it_cond, ids, r_current_process_info);
848 for (
auto& id_i : ids) {
850 auto& row_indices = temp_indexes[id_i];
851 for (
auto& id_j : ids) {
853 row_indices.insert(id_j);
867 #pragma omp for schedule(guided, 512) nowait
868 for (
int i_const = 0; i_const < number_of_constraints; ++i_const) {
869 auto it_const = const_begin + i_const;
872 if(it_const->IsActive()) {
873 it_const->EquationIdVector(ids, second_ids, r_current_process_info);
875 for (
auto& id_i : ids) {
877 auto& row_indices = temp_indexes[id_i];
878 for (
auto& id_j : ids) {
880 row_indices.insert(id_j);
886 for (
auto& id_i : second_ids) {
888 auto& row_indices = temp_indexes[id_i];
889 for (
auto& id_j : second_ids) {
891 row_indices.insert(id_j);
902 for (
int i = 0; i < static_cast<int>(temp_indexes.size()); ++
i) {
903 indices[
i].insert(temp_indexes[
i].begin(), temp_indexes[
i].end());
911 nnz += indices[
i].size();
915 double *Avalues = rA.value_data().begin();
916 IndexType *Arow_indices = rA.index1_data().begin();
917 IndexType *Acol_indices = rA.index2_data().begin();
921 for (
int i = 0; i < static_cast<int>(rA.size1());
i++)
922 Arow_indices[
i + 1] = Arow_indices[
i] + indices[
i].size();
928 for (
auto it = indices[
Index].begin(); it != indices[
Index].end(); ++it) {
929 Acol_indices[
k] = *it;
934 indices[
Index].clear();
936 std::sort(&Acol_indices[row_begin], &Acol_indices[row_end]);
939 rA.set_filled(indices.size() + 1, nnz);
951 typename TSchemeType::Pointer pScheme,
960 std::unordered_map<IndexType, IndexSetType> master_indices;
963 typedef std::pair<IndexType, IndexType> IndexIndexPairType;
964 typedef std::pair<IndexType, IndexSetType> IndexIndexSetPairType;
971 solvable_dof_reorder.insert(IndexIndexPairType(equation_id,
counter));
975 master_indices.insert(IndexIndexSetPairType(equation_id,
IndexSetType({})));
990 for (
int i_const = 0; i_const < number_of_constraints; ++i_const) {
991 auto it_const = it_const_begin + i_const;
994 if(it_const->IsActive()) {
995 it_const->EquationIdVector(ids, second_ids, r_current_process_info);
996 for (
auto& slave_id : ids) {
998 auto it_slave = solvable_dof_reorder.find(slave_id);
999 if (it_slave == solvable_dof_reorder.end()) {
1000 for (
auto& master_id : second_ids) {
1002 auto& master_row_indices = master_indices[slave_id];
1003 master_row_indices.insert(solvable_dof_reorder[master_id]);
1017 nnz += master_indices[
i].size();
1022 double *Tvalues = rT.value_data().begin();
1023 IndexType *Trow_indices = rT.index1_data().begin();
1024 IndexType *Tcol_indices = rT.index2_data().begin();
1027 Trow_indices[0] = 0;
1029 Trow_indices[
i + 1] = Trow_indices[
i] + master_indices[
i].size();
1037 for (
auto it = master_indices[
Index].begin(); it != master_indices[
Index].end(); ++it) {
1038 Tcol_indices[
k] = *it;
1043 master_indices[
Index].clear();
1045 std::sort(&Tcol_indices[row_begin], &Tcol_indices[row_end]);
1050 for (
auto& solv_dof : solvable_dof_reorder) {
1051 rT(solv_dof.first, solv_dof.second) = 1.0;
1067 typename TSchemeType::Pointer pScheme,
1071 const bool UseBaseBuild =
true
1080 BuildWithoutConstraints(pScheme, rModelPart, rA, rb);
1093 ResetConstraintSystem();
1099 SparseMatrixMultiplicationUtility::TransposeMatrix<TSystemMatrixType, TSystemMatrixType>(T_transpose_matrix, rTMatrix, 1.0);
1120 (*mpOldAMatrix).swap(rA);
1130 auxiliar_A_matrix.resize(0, 0,
false);
1131 T_transpose_matrix.resize(0, 0,
false);
1133 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", this->
GetEchoLevel() >= 1) <<
"Constraint relation build time and multiplication: " <<
timer.ElapsedSeconds() << std::endl;
1135 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", this->
GetEchoLevel() > 2) <<
"Finished parallel building with constraints" << std::endl;
1148 typename TSchemeType::Pointer pScheme,
1166 ResetConstraintSystem();
1172 SparseMatrixMultiplicationUtility::TransposeMatrix<TSystemMatrixType, TSystemMatrixType>(T_transpose_matrix, rTMatrix, 1.0);
1179 BuildWithoutConstraints(pScheme, rModelPart,
A, rb);
1181 BuildRHSNoDirichletWithoutConstraints(pScheme, rModelPart, rb);
1199 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", this->
GetEchoLevel() >= 1) <<
"Constraint relation build time and multiplication: " << timer.ElapsedSeconds() << std::endl;
1201 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", this->
GetEchoLevel() > 2) <<
"Finished parallel building with constraints" << std::endl;
1215 typename TSchemeType::Pointer pScheme,
1229 if (rReactionsVector.size() != reactions_vector_size)
1230 rReactionsVector.resize(reactions_vector_size,
false);
1263 KRATOS_ERROR <<
"The equation system size has changed during the simulation. This is not permitted."<<std::endl;
1276 KRATOS_ERROR <<
"The equation system size has changed during the simulation. This is not permitted."<<std::endl;
1287 KRATOS_ERROR <<
"The equation system size has changed during the simulation. This is not permitted."<<std::endl;
1304 typename TSchemeType::Pointer pScheme,
1326 KRATOS_CATCH(
"ResidualBasedEliminationBuilderAndSolverWithConstraints::CalculateReactions failed ..");
1339 typename TSchemeType::Pointer pScheme,
1356 auto it_dof = it_dof_begin +
i;
1357 const IndexType equation_id = it_dof->EquationId();
1364 scaling_factors[
counter] = 1.0;
1372 double* Avalues = rA.value_data().begin();
1373 IndexType* Arow_indices = rA.index1_data().begin();
1374 IndexType* Acol_indices = rA.index2_data().begin();
1377 const double zero_tolerance = std::numeric_limits<double>::epsilon();
1380 #pragma omp parallel for
1386 if(std::abs(Avalues[
j]) > zero_tolerance) {
1401 const double k_factor = scaling_factors[
Index];
1402 if (k_factor == 0) {
1405 if (Acol_indices[
j] !=
Index )
1413 if(scaling_factors[ Acol_indices[
j] ] == 0 ) {
1449 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolverWithConstraints", this->
GetEchoLevel() > 1) <<
"Clear Function called" << std::endl;
1497 void SetUpSystemWithConstraints(
ModelPart& rModelPart)
1518 typedef std::unordered_set < DofPointerType, DofPointerHasher> set_type;
1519 set_type dof_global_fixed_master_set;
1524 #pragma omp parallel firstprivate(slave_dof_list, master_dof_list)
1527 set_type dof_temp_fixed_master_set;
1528 dof_temp_fixed_master_set.reserve(2000);
1530 #pragma omp for schedule(guided, 512) nowait
1531 for (
int i_const = 0; i_const < number_of_constraints; ++i_const) {
1532 auto it_const = it_const_begin + i_const;
1535 if (it_const->IsActive()) {
1536 it_const->GetDofList(slave_dof_list, master_dof_list, r_current_process_info);
1539 for (
auto& master_dof : master_dof_list) {
1540 if (master_dof->IsFixed()) {
1541 dof_temp_fixed_master_set.insert(master_dof);
1548 #pragma omp critical
1550 dof_global_fixed_master_set.insert(dof_temp_fixed_master_set.begin(), dof_temp_fixed_master_set.end());
1554 dof_temp_fixed_master.reserve(dof_global_fixed_master_set.size());
1555 for (
auto p_dof : dof_global_fixed_master_set) {
1556 dof_temp_fixed_master.push_back( p_dof );
1558 dof_temp_fixed_master.Sort();
1566 if (
dof.IsFixed()) {
1569 dof.SetEquationId(--fix_id);
1571 dof.SetEquationId(free_id++);
1574 dof.SetEquationId(free_id++);
1599 if (is_master_fixed || is_slave) {
1605 KRATOS_CATCH(
"ResidualBasedEliminationBuilderAndSolverWithConstraints::SetUpSystemWithConstraints failed ..");
1616 void ApplyMasterSlaveRelation(
1617 typename TSchemeType::Pointer pScheme,
1618 ModelPart& rModelPart,
1642 bool CheckMasterSlaveRelation(
1643 typename TSchemeType::Pointer pScheme,
1644 ModelPart& rModelPart,
1660 auto it_dof = it_dof_begin +
i;
1661 const IndexType equation_id = it_dof->EquationId();
1665 current_solution[
counter] = it_dof->GetSolutionStepValue() + rDxSolved[
counter];
1672 const IndexType equation_id = rDof.EquationId();
1674 residual_solution[equation_id] = rDof.GetSolutionStepValue() + rDx[equation_id];
1683 ComputeConstraintContribution(pScheme, rModelPart,
false,
true);
1692 if (std::abs(residual_solution[
k]) > std::numeric_limits<double>::epsilon())
return false;
1708 void ReconstructSlaveSolutionAfterSolve(
1709 typename TSchemeType::Pointer pScheme,
1710 ModelPart& rModelPart,
1734 KRATOS_ERROR_IF_NOT(CheckMasterSlaveRelation(pScheme, rModelPart, rDx, Dx_copy)) <<
"The relation between master/slave dofs is not respected" << std::endl;
1746 KRATOS_CATCH(
"ResidualBasedEliminationBuilderAndSolverWithConstraints::ReconstructSlaveSolutionAfterSolve failed ..");
1756 void BuildWithoutConstraints(
1757 typename TSchemeType::Pointer pScheme,
1758 ModelPart& rModelPart,
1764 const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
1780 #pragma omp parallel firstprivate( lhs_contribution, rhs_contribution, equation_id)
1783 const auto it_elem_begin = r_elements_array.begin();
1784 const int nelements =
static_cast<int>(r_elements_array.size());
1785 #pragma omp for schedule(guided, 512) nowait
1786 for (
int i = 0;
i<nelements; ++
i) {
1787 auto it_elem = it_elem_begin +
i;
1789 if (it_elem->IsActive()) {
1791 pScheme->CalculateSystemContributions(*it_elem, lhs_contribution, rhs_contribution, equation_id, r_current_process_info);
1794 AssembleWithoutConstraints(rA, rb, lhs_contribution, rhs_contribution, equation_id);
1799 const auto it_cond_begin = r_conditons_array.begin();
1800 const int nconditions =
static_cast<int>(r_conditons_array.size());
1801 #pragma omp for schedule(guided, 512)
1802 for (
int i = 0;
i<nconditions; ++
i) {
1803 auto it_cond = it_cond_begin +
i;
1805 if (it_cond->IsActive()) {
1807 pScheme->CalculateSystemContributions(*it_cond, lhs_contribution, rhs_contribution, equation_id, r_current_process_info);
1810 AssembleWithoutConstraints(rA, rb, lhs_contribution, rhs_contribution, equation_id);
1823 void BuildRHSNoDirichletWithoutConstraints(
1824 typename TSchemeType::Pointer pScheme,
1825 ModelPart& rModelPart,
1830 const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
1845 #pragma omp parallel firstprivate( rhs_contribution, equation_id)
1848 const auto it_elem_begin = r_elements_array.begin();
1849 const int nelements =
static_cast<int>(r_elements_array.size());
1850 #pragma omp for schedule(guided, 512) nowait
1851 for (
int i = 0;
i<nelements; ++
i) {
1852 auto it_elem = it_elem_begin +
i;
1854 if (it_elem->IsActive()) {
1856 pScheme->CalculateRHSContribution(*it_elem, rhs_contribution, equation_id, r_current_process_info);
1859 AssembleRHSWithoutConstraints(rb, rhs_contribution, equation_id);
1864 const auto it_cond_begin = r_conditons_array.begin();
1865 const int nconditions =
static_cast<int>(r_conditons_array.size());
1866 #pragma omp for schedule(guided, 512)
1867 for (
int i = 0;
i<nconditions; ++
i) {
1868 auto it_cond = it_cond_begin +
i;
1870 if (it_cond->IsActive()) {
1872 pScheme->CalculateRHSContribution(*it_cond, rhs_contribution, equation_id, r_current_process_info);
1875 AssembleRHSWithoutConstraints(rb, rhs_contribution, equation_id);
1885 void AssembleWithoutConstraints(
1896 AssembleRHSWithoutConstraints(rb, rRHSContribution, rEquationId);
1900 const IndexType i_global = rEquationId[i_local];
1913 void AssembleRHSWithoutConstraints(
1923 const IndexType i_global = rEquationId[i_local];
1927 double& r_b_value = rb[i_global];
1928 const double rhs_value = rRHSContribution[i_local];
1936 const IndexType i_global = rEquationId[i_local];
1941 if (is_master_fixed || is_slave) {
1943 const double rhs_value = rRHSContribution[i_local];
1946 }
else if (it_dof->IsFree()) {
1948 double& r_b_value = rb[i_global];
1949 const double& rhs_value = rRHSContribution[i_local];
1960 void ResetConstraintSystem()
1963 double *Tvalues = rTMatrix.value_data().begin();
1965 IndexPartition<std::size_t>(rTMatrix.nnz()).for_each([&Tvalues](std::size_t
Index){
1966 Tvalues[
Index] = 0.0;
1972 typedef std::pair<IndexType, IndexType> IndexIndexPairType;
1979 solvable_dof_reorder.insert(IndexIndexPairType(equation_id,
counter));
1986 for (
auto& solv_dof : solvable_dof_reorder) {
1987 rTMatrix(solv_dof.first, solv_dof.second) = 1.0;
1992 TSparseSpace::SetToZero(rConstantVector);
2002 void ApplyDirichletConditionsRHS(
2003 typename TSchemeType::Pointer pScheme,
2004 ModelPart& rModelPart,
2015 auto it_dof = it_dof_begin +
Index;
2019 if(mDoFMasterFixedSet.find(*it_dof) != mDoFMasterFixedSet.end()) {
2038 bool ComputeConstraintContribution(
2039 typename TSchemeType::Pointer pScheme,
2040 ModelPart& rModelPart,
2041 const bool ComputeTranslationMatrix =
false,
2042 const bool ComputeConstantVector =
false
2048 TSystemMatrixType& rTMatrix = *mpTMatrix;
2049 TSystemVectorType& rConstantVector = *mpConstantVector;
2052 if (ComputeConstantVector) {
2053 IndexPartition<std::size_t>(this->mEquationSystemSize).for_each([&rConstantVector](std::size_t
Index){
2054 rConstantVector[
Index] = 0.0;
2059 IndexMapType solvable_dof_reorder;
2062 typedef std::pair<IndexType, IndexType> IndexIndexPairType;
2064 for (
auto&
dof : BaseType::mDofSet) {
2065 if (
dof.EquationId() < BaseType::mEquationSystemSize) {
2067 auto it = mDoFSlaveSet.
find(
dof);
2068 if (it == mDoFSlaveSet.
end()) {
2069 solvable_dof_reorder.insert(IndexIndexPairType(equation_id,
counter));
2076 const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
2079 double aux_constant_value = 0.0;
2082 LocalSystemMatrixType transformation_matrix = LocalSystemMatrixType(0, 0);
2083 LocalSystemVectorType constant_vector = LocalSystemVectorType(0);
2086 EquationIdVectorType slave_equation_id, master_equation_id;
2088 const int number_of_constraints =
static_cast<int>(rModelPart.MasterSlaveConstraints().size());
2090 std::unordered_set<IndexType> auxiliar_constant_equations_ids;
2092 #pragma omp parallel firstprivate(transformation_matrix, constant_vector, slave_equation_id, master_equation_id)
2094 std::unordered_set<IndexType> auxiliar_temp_constant_equations_ids;
2095 auxiliar_temp_constant_equations_ids.reserve(2000);
2097 #pragma omp for schedule(guided, 512)
2098 for (
int i_const = 0; i_const < number_of_constraints; ++i_const) {
2099 auto it_const = rModelPart.MasterSlaveConstraints().begin() + i_const;
2102 if (it_const->IsActive()) {
2103 it_const->CalculateLocalSystem(transformation_matrix, constant_vector, r_current_process_info);
2104 it_const->EquationIdVector(slave_equation_id, master_equation_id, r_current_process_info);
2107 for (
auto&
id : master_equation_id) {
2108 id = solvable_dof_reorder[id];
2111 if (ComputeConstantVector) {
2112 for (
IndexType i = 0;
i < slave_equation_id.size(); ++
i) {
2113 const IndexType i_global = slave_equation_id[
i];
2114 if (i_global < BaseType::mEquationSystemSize) {
2115 const double constant_value = constant_vector[
i];
2116 if (std::abs(constant_value) > 0.0) {
2117 auxiliar_temp_constant_equations_ids.insert(i_global);
2118 double& r_value = rConstantVector[i_global];
2124 for (
IndexType i = 0;
i < slave_equation_id.size(); ++
i) {
2125 const IndexType i_global = slave_equation_id[
i];
2126 if (i_global < BaseType::mEquationSystemSize) {
2127 const double constant_value = constant_vector[
i];
2128 AtomicAdd(aux_constant_value, std::abs(constant_value));
2133 if (ComputeTranslationMatrix) {
2135 AssembleRelationMatrix(rTMatrix, transformation_matrix, slave_equation_id, master_equation_id);
2141 #pragma omp critical
2143 auxiliar_constant_equations_ids.insert(auxiliar_temp_constant_equations_ids.begin(), auxiliar_temp_constant_equations_ids.end());
2147 return aux_constant_value > std::numeric_limits<double>::epsilon() ? true :
false;
2158 void ComputeEffectiveConstant(
2159 typename TSchemeType::Pointer pScheme,
2160 ModelPart& rModelPart,
2161 TSystemVectorType& rDxSolved
2164 if (mComputeConstantContribution) {
2166 const TSystemMatrixType& rTMatrix = *mpTMatrix;
2167 TSystemVectorType& rConstantVector = *mpConstantVector;
2168 TSystemVectorType& rDeltaConstantVector = *mpDeltaConstantVector;
2169 TSparseSpace::Copy(rConstantVector, rDeltaConstantVector);
2172 TSystemVectorType Dx(BaseType::mEquationSystemSize);
2177 const auto it_dof_begin = BaseType::mDofSet.begin();
2179 TSystemVectorType
u(BaseType::mEquationSystemSize);
2182 const IndexType equation_id = rDof.EquationId();
2183 if (equation_id < this->mEquationSystemSize ) {
2184 u[equation_id] = rDof.GetSolutionStepValue() + Dx[equation_id];
2188 TSystemVectorType u_bar(mDoFToSolveSystemSize);
2190 for (
IndexType i = 0;
i < BaseType::mDofSet.size(); ++
i) {
2191 auto it_dof = it_dof_begin +
i;
2192 const IndexType equation_id = it_dof->EquationId();
2193 if (equation_id < BaseType::mEquationSystemSize ) {
2195 auto it = mDoFSlaveSet.
find(*it_dof);
2196 if (it == mDoFSlaveSet.
end()) {
2197 u_bar[
counter] = it_dof->GetSolutionStepValue() + rDxSolved[
counter];
2202 TSystemVectorType u_bar_complete(BaseType::mEquationSystemSize);
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
std::size_t IndexType
Definition of the index type.
Definition: builder_and_solver.h:76
bool mDofSetIsInitialized
If the matrix is reshaped each step.
Definition: builder_and_solver.h:743
TSparseSpace::VectorType TSystemVectorType
Definition of the vector size.
Definition: builder_and_solver.h:85
bool GetCalculateReactionsFlag() const
This method returns the flag mCalculateReactionsFlag.
Definition: builder_and_solver.h:184
TSparseSpace::MatrixType TSystemMatrixType
Definition of the sparse matrix.
Definition: builder_and_solver.h:82
TSystemVectorPointerType mpReactionsVector
Definition: builder_and_solver.h:751
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: builder_and_solver.h:767
bool GetReshapeMatrixFlag() const
This method returns the flag mReshapeMatrixFlag.
Definition: builder_and_solver.h:220
TDenseSpace::MatrixType LocalSystemMatrixType
The local matrix definition.
Definition: builder_and_solver.h:94
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition of the pointer to the vector.
Definition: builder_and_solver.h:91
TSparseSpace::DataType TDataType
Definition of the data type.
Definition: builder_and_solver.h:79
TLinearSolver::Pointer mpLinearSystemSolver
Definition: builder_and_solver.h:737
DofsArrayType mDofSet
Pointer to the linear solver.
Definition: builder_and_solver.h:739
TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: builder_and_solver.h:97
TSparseSpace::MatrixPointerType TSystemMatrixPointerType
Definition of the pointer to the sparse matrix.
Definition: builder_and_solver.h:88
std::size_t SizeType
Definition of the size type.
Definition: builder_and_solver.h:73
bool mCalculateReactionsFlag
Flag taking care if the dof set was initialized ot not.
Definition: builder_and_solver.h:745
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
unsigned int mEquationSystemSize
Flag taking in account if it is needed or not to calculate the reactions.
Definition: builder_and_solver.h:747
Definition: builtin_timer.h:26
virtual int MyPID() const
Definition: communicator.cpp:91
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
A class that implements the interface for different master-slave constraints to be applied on a syste...
Definition: master_slave_constraint.h:76
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
MasterSlaveConstraintContainerType & MasterSlaveConstraints(IndexType ThisIndex=0)
Definition: model_part.h:654
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
Communicator & GetCommunicator()
Definition: model_part.h:1821
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
void Sort()
Sort the elements in the set.
Definition: pointer_vector_set.h:753
void push_back(TPointerType x)
Adds a pointer to the end of the set.
Definition: pointer_vector_set.h:544
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
iterator find(const key_type &Key)
Find an element with the specified key.
Definition: pointer_vector_set.h:678
void reserve(int reservedsize)
Reserves memory for a specified number of elements.
Definition: pointer_vector_set.h:733
iterator end()
Returns an iterator pointing to the end of the container.
Definition: pointer_vector_set.h:314
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Current class provides an implementation for standard elimination builder and solving operations.
Definition: residualbased_elimination_builder_and_solver.h:76
Element::DofsVectorType DofsVectorType
Definition: residualbased_elimination_builder_and_solver.h:105
void BuildRHS(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb) override
Function to perform the build of the RHS.
Definition: residualbased_elimination_builder_and_solver.h:572
void AssembleRowContributionFreeDofs(TSystemMatrixType &rA, const Matrix &rALocal, const IndexType i, const IndexType i_local, const Element::EquationIdVectorType &EquationId)
This function is equivalent to the AssembleRowContribution of the block builder and solver.
Definition: residualbased_elimination_builder_and_solver.h:1227
void BuildAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Function to perform the building and solving phase at the same time.
Definition: residualbased_elimination_builder_and_solver.h:507
Element::EquationIdVectorType EquationIdVectorType
Definition of the equation id vector.
Definition: residualbased_elimination_builder_and_solver.h:104
void Build(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
Function to perform the build of the RHS. The vector could be sized as the total number of dofs or as...
Definition: residualbased_elimination_builder_and_solver.h:184
void ResizeAndInitializeVectors(typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &pA, TSystemVectorPointerType &pDx, TSystemVectorPointerType &pb, ModelPart &rModelPart) override
This method resize and initializes the system of euqations.
Definition: residualbased_elimination_builder_and_solver.h:788
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_elimination_builder_and_solver.h:942
void SetUpDofSet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: residualbased_elimination_builder_and_solver.h:646
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: residualbased_elimination_builder_and_solver.h:912
Node NodeType
Node definition.
Definition: residualbased_elimination_builder_and_solver.h:108
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_elimination_builder_and_solver.h:1314
virtual void ConstructMatrixStructure(typename TSchemeType::Pointer pScheme, TSystemMatrixType &rA, ModelPart &rModelPart)
This method constructs the relationship between the DoF.
Definition: residualbased_elimination_builder_and_solver.h:1078
void SetUpSystem(ModelPart &rModelPart) override
Organises the dofset in order to speed up the building phase.
Definition: residualbased_elimination_builder_and_solver.h:759
Current class provides an implementation for standard builder and solving operations.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:93
void BuildRHS(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &b) override
Function to perform the build of the RHS.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:278
ResidualBasedEliminationBuilderAndSolverWithConstraints(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:169
void Build(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
Function to perform the build of the RHS. The vector could be sized as the total number of dofs or as...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:236
PointerVectorSet< Element, IndexedObject > ElementsContainerType
Additional definitions.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:130
void BuildAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function to perform the building and solving phase at the same time.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:259
MasterSlaveConstraint::Pointer MasterSlaveConstraintPointerType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:147
boost::numeric::ublas::compressed_matrix< double > CompressedMatrixType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:133
Vector VectorType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:149
Element::EquationIdVectorType EquationIdVectorType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:131
void SetUpDofSet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:302
bool mComputeConstantContribution
If we reset the relation matrix at each iteration.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:396
void BuildWithConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb, const bool UseBaseBuild=true)
This function is exactly same as the Build() function in base class except that the function.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1066
void ConstructMatrixStructure(typename TSchemeType::Pointer pScheme, TSystemMatrixType &rA, ModelPart &rModelPart) override
This method constructs the relationship between the DoF.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:438
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:122
std::unordered_set< IndexType > IndexSetType
Set definition.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:140
bool mCheckConstraintRelation
In order to know the corresponding EquaionId for each component of the reaction vector.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:393
void BuildRHSNoDirichlet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb)
Function to perform the build of the RHS.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1147
DofType::Pointer DofPointerType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:137
ResidualBasedEliminationBuilderAndSolverWithConstraints< TSparseSpace, TDenseSpace, TLinearSolver > ClassType
The definition of the current class.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:108
BaseType::TDataType TDataType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:116
MasterSlaveConstraint MasterSlaveConstraintType
MPC definitions.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:146
void ApplyDirichletConditions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Applies the dirichlet conditions. This operation may be very heavy or completely unexpensive dependin...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1338
ResidualBasedEliminationBuilderAndSolverWithConstraints()
Default constructor.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:162
BaseType::NodesArrayType NodesArrayType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:125
bool mCleared
If we compute the constant contribution of the MPC.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:397
void SetUpSystem(ModelPart &rModelPart) override
Organises the dofset in order to speed up the building phase.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:220
BaseType::ConditionsArrayType ConditionsArrayType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:127
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1427
BaseType::ElementsArrayType ElementsArrayType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:126
Element::DofsVectorType DofsVectorType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:132
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:119
ResidualBasedEliminationBuilderAndSolverWithConstraints(typename TLinearSolver::Pointer pNewLinearSystemSolver, const bool CheckConstraintRelation=true, const bool ResetRelationMatrixEachIteration=false)
Default constructor.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:182
bool mResetRelationMatrixEachIteration
If we do a constraint check relation.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:394
TSystemMatrixPointerType mpOldAMatrix
This is matrix containing the global relation for the constraints.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:385
void ResizeAndInitializeVectors(typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &pA, TSystemVectorPointerType &pDx, TSystemVectorPointerType &pb, ModelPart &rModelPart) override
This method resize and initializes the system of euqations.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1214
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:121
void SystemSolveWithPhysics(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, ModelPart &rModelPart)
This is a call to the linear system solver (taking into account some physical particularities of the ...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:725
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedEliminationBuilderAndSolverWithConstraints)
Pointer definition of ResidualBasedEliminationBuilderAndSolverWithConstraints.
ResidualBasedEliminationBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition of the base class.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:105
std::unordered_map< IndexType, IndexType > IndexMapType
Map definition.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:143
DofsArrayType mDoFMasterFixedSet
This is vector contains the effective constant displacement.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:388
void CalculateReactions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It computes the reactions of the system.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1303
std::size_t IndexType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:112
BaseType::TSchemeType TSchemeType
Definition of the classes from the base class.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:115
TSystemVectorPointerType mpDeltaConstantVector
This is vector containing the rigid movement of the constraint.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:387
SizeType mDoFToSolveSystemSize
The set containing the slave DoF of the system.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:390
virtual void ConstructMatrixStructureWithConstraints(typename TSchemeType::Pointer pScheme, TSystemMatrixType &rA, ModelPart &rModelPart)
This function is exactly same as the ConstructMatrixStructure() function in base class except that th...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:777
void AssembleRelationMatrix(TSystemMatrixType &rT, const LocalSystemMatrixType &rTransformationMatrix, const EquationIdVectorType &rSlaveEquationId, const EquationIdVectorType &rMasterEquationId)
This method assembles the global relation matrix (T matrix used to impose the MPC)
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:414
BuilderAndSolverBaseType::Pointer Create(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters) const override
Create method.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:204
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BuilderAndSolverBaseType
Definition of the base class.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:102
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:360
TSystemMatrixPointerType mpTMatrix
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:384
DofsArrayType mDoFSlaveSet
The set containing the fixed master DoF of the system.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:389
TSystemVectorPointerType mpConstantVector
This is matrix containing the old LHS structure.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:386
BaseType::NodeType NodeType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:124
NodeType::DofType DofType
DoF types definition.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:136
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:317
IndexMapType mReactionEquationIdMap
Number of degrees of freedom of the problem to actually be solved.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:391
virtual void ConstructRelationMatrixStructure(typename TSchemeType::Pointer pScheme, TSystemMatrixType &rT, ModelPart &rModelPart)
This function is exactly same as the ConstructMatrixStructure() function in base class except that th...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:950
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:1456
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:123
std::vector< IndexType > VectorIndexType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:148
void SetUpDofSetWithConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart)
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:577
std::string Info() const override
Turn back information as a string.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:354
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:117
std::size_t SizeType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:111
void BuildAndSolveWithConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb)
The same methods as the base class but with constraints.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:458
void BuildRHSWithConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb)
The same methods as the base class but with constraints.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:524
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:120
~ResidualBasedEliminationBuilderAndSolverWithConstraints() override
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:195
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:336
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:118
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: residualbased_elimination_builder_and_solver_with_constraints.h:366
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
static void MatrixMultiplication(const AMatrix &rA, const BMatrix &rB, CMatrix &rC)
Matrix-matrix product C = A·B @detail This method uses a template for each matrix.
Definition: sparse_matrix_multiplication_utility.h:117
static void Start(std::string const &rIntervalName)
This method starts the timer meassures.
Definition: timer.cpp:109
static void Stop(std::string const &rIntervalName)
This method stops the timer meassures.
Definition: timer.cpp:125
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
void ApplyConstraints(ModelPart &rModelPart)
This method resets the values of the slave dofs.
Definition: constraint_utilities.cpp:159
void ResetSlaveDofs(ModelPart &rModelPart)
This method resets the values of the slave dofs.
Definition: constraint_utilities.cpp:136
double TwoNorm(SparseSpaceType &dummy, SparseSpaceType::VectorType &x)
Definition: add_strategies_to_python.cpp:164
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
void UnaliasedAdd(TSpaceType &dummy, typename TSpaceType::VectorType &x, const double A, const typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:170
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void AtomicAdd(TDataType &target, const TDataType &value)
Definition: atomic_utilities.h:55
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
ProcessInfo
Definition: edgebased_PureConvection.py:116
int local_size
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:17
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
u
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:30
int dof
Definition: ode_solve.py:393
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17