15 #if !defined(KRATOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER )
16 #define KRATOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER
20 #include <unordered_set>
23 #ifdef KRATOS_SMP_OPENMP
70 template<
class TSparseSpace,
131 typename TLinearSolver::Pointer pNewLinearSystemSolver,
133 ) :
BaseType(pNewLinearSystemSolver)
144 typename TLinearSolver::Pointer pNewLinearSystemSolver)
161 typename TLinearSolver::Pointer pNewLinearSystemSolver,
165 return Kratos::make_shared<ClassType>(pNewLinearSystemSolver,ThisParameters);
185 typename TSchemeType::Pointer pScheme,
202 const int nelements =
static_cast<int>(r_elements_array.
size());
205 const int nconditions =
static_cast<int>(r_conditions_array.
size());
208 const auto it_elem_begin = r_elements_array.
begin();
209 const auto it_cond_begin = r_conditions_array.
begin();
221 #pragma omp parallel firstprivate(LHS_Contribution, RHS_Contribution, equation_id )
223 #pragma omp for schedule(guided, 512) nowait
224 for (
int k = 0;
k < nelements; ++
k) {
225 auto it_elem = it_elem_begin +
k;
228 if (it_elem->IsActive()) {
230 pScheme->CalculateSystemContributions(*it_elem, LHS_Contribution, RHS_Contribution, equation_id, r_current_process_info);
233 #ifdef USE_LOCKS_IN_ASSEMBLY
234 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, equation_id, mLockArray);
236 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, equation_id);
241 #pragma omp for schedule(guided, 512)
242 for (
int k = 0;
k < nconditions; ++
k) {
243 auto it_cond = it_cond_begin +
k;
246 if (it_cond->IsActive()) {
248 pScheme->CalculateSystemContributions(*it_cond, LHS_Contribution, RHS_Contribution, equation_id, r_current_process_info);
250 #ifdef USE_LOCKS_IN_ASSEMBLY
251 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, equation_id, mLockArray);
253 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, equation_id);
275 typename TSchemeType::Pointer pScheme,
291 const int nelements =
static_cast<int>(r_elements_array.
size());
294 const int nconditions =
static_cast<int>(r_conditions_array.
size());
297 const auto it_elem_begin = r_elements_array.
begin();
298 const auto it_cond_begin = r_conditions_array.
begin();
309 #pragma omp parallel firstprivate(LHS_Contribution, equation_id )
311 #pragma omp for schedule(guided, 512) nowait
312 for (
int k = 0;
k < nelements; ++
k) {
313 auto it_elem = it_elem_begin +
k;
316 if (it_elem->IsActive()) {
318 pScheme->CalculateLHSContribution(*it_elem, LHS_Contribution, equation_id, r_current_process_info);
325 #pragma omp for schedule(guided, 512)
326 for (
int k = 0;
k < nconditions; ++
k) {
327 auto it_cond = it_cond_begin +
k;
330 if (it_cond->IsActive()) {
332 pScheme->CalculateLHSContribution(*it_cond, LHS_Contribution, equation_id, r_current_process_info);
353 typename TSchemeType::Pointer pScheme,
369 const int nelements =
static_cast<int>(r_elements_array.
size());
372 const int nconditions =
static_cast<int>(r_conditions_array.
size());
375 const auto it_elem_begin = r_elements_array.
begin();
376 const auto it_cond_begin = r_conditions_array.
begin();
387 #pragma omp parallel firstprivate(LHS_Contribution, equation_id )
389 #pragma omp for schedule(guided, 512) nowait
390 for (
int k = 0;
k < nelements; ++
k) {
391 auto it_elem = it_elem_begin +
k;
394 if (it_elem->IsActive()) {
396 pScheme->CalculateLHSContribution(*it_elem, LHS_Contribution, equation_id, r_current_process_info);
399 AssembleLHSCompleteOnFreeRows(rA, LHS_Contribution, equation_id);
403 #pragma omp for schedule(guided, 512)
404 for (
int k = 0;
k < nconditions; ++
k) {
405 auto it_cond = it_cond_begin +
k;
408 if (it_cond->IsActive()) {
410 pScheme->CalculateLHSContribution(*it_cond, LHS_Contribution, equation_id, r_current_process_info);
413 AssembleLHSCompleteOnFreeRows(rA, LHS_Contribution, equation_id);
446 TSparseSpace::SetToZero(rDx);
486 TSparseSpace::SetToZero(rDx);
508 typename TSchemeType::Pointer pScheme,
519 Build(pScheme, rModelPart, rA, rb);
526 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolver", ( this->
GetEchoLevel() == 3)) <<
"Before the solution of the system" <<
"\nSystem Matrix = " << rA <<
"\nUnknowns vector = " << rDx <<
"\nRHS vector = " << rb << std::endl;
537 KRATOS_INFO_IF(
"ResidualBasedEliminationBuilderAndSolver", ( this->
GetEchoLevel() == 3)) <<
"After the solution of the system" <<
"\nSystem Matrix = " << rA <<
"\nUnknowns vector = " << rDx <<
"\nRHS vector = " << rb << std::endl;
551 typename TSchemeType::Pointer pScheme,
573 typename TSchemeType::Pointer pScheme,
600 #pragma omp parallel firstprivate( RHS_Contribution, equation_id)
602 const auto it_elem_begin = r_elements_array.
begin();
603 const int nelements =
static_cast<int>(r_elements_array.
size());
604 #pragma omp for schedule(guided, 512) nowait
605 for (
int i = 0;
i < nelements; ++
i) {
606 auto it_elem = it_elem_begin +
i;
609 if (it_elem->IsActive()) {
611 pScheme->CalculateRHSContribution(*it_elem, RHS_Contribution, equation_id, r_current_process_info);
614 AssembleRHS(rb, RHS_Contribution, equation_id);
619 const auto it_cond_begin = r_conditions_array.
begin();
620 const int nconditions =
static_cast<int>(r_conditions_array.
size());
621 #pragma omp for schedule(guided, 512)
622 for (
int i = 0;
i < nconditions; ++
i) {
623 auto it_cond = it_cond_begin +
i;
625 if (it_cond->IsActive()) {
627 pScheme->CalculateRHSContribution(*it_cond, RHS_Contribution, equation_id, r_current_process_info);
630 AssembleRHS(rb, RHS_Contribution, equation_id);
647 typename TSchemeType::Pointer pScheme,
657 const int nelements =
static_cast<int>(r_elements_array.
size());
665 typedef std::unordered_set < NodeType::DofType::Pointer, DofPointerHasher> set_type;
667 std::vector<set_type> dofs_aux_list(nthreads);
669 for (
int i = 0; i < static_cast<int>(nthreads); ++
i) {
670 dofs_aux_list[
i].reserve(nelements);
674 auto it_elem = r_elements_array.
begin() +
Index;
678 pScheme->GetDofList(*it_elem, tls_elemental_dof_list, r_current_process_info);
680 dofs_aux_list[this_thread_id].insert(tls_elemental_dof_list.begin(), tls_elemental_dof_list.end());
684 const int nconditions =
static_cast<int>(r_conditions_array.
size());
687 auto it_cond = r_conditions_array.
begin() +
Index;
691 pScheme->GetDofList(*it_cond, tls_elemental_dof_list, r_current_process_info);
692 dofs_aux_list[this_thread_id].insert(tls_elemental_dof_list.begin(), tls_elemental_dof_list.end());
697 SizeType new_max = ceil(0.5*
static_cast<double>(old_max));
698 while (new_max >= 1 && new_max != old_max) {
700 if (
Index + new_max < old_max) {
701 dofs_aux_list[
Index].insert(dofs_aux_list[
Index + new_max].begin(), dofs_aux_list[
Index + new_max].
end());
702 dofs_aux_list[
Index + new_max].clear();
707 new_max = ceil(0.5*
static_cast<double>(old_max));
713 dof_temp.
reserve(dofs_aux_list[0].size());
714 for (
auto it = dofs_aux_list[0].begin(); it != dofs_aux_list[0].end(); ++it) {
728 #ifdef USE_LOCKS_IN_ASSEMBLY
729 if (mLockArray.size() != 0) {
730 for (
int i = 0; i < static_cast<int>(mLockArray.size());
i++)
731 omp_destroy_lock(&mLockArray[
i]);
736 for (
int i = 0; i < static_cast<int>(mLockArray.size());
i++)
737 omp_init_lock(&mLockArray[
i]);
745 KRATOS_ERROR_IF_NOT(dof_iterator->HasReaction()) <<
"Reaction variable not set for the following : " << std::endl
746 <<
"Node : " << dof_iterator->Id() << std::endl
747 <<
"Dof : " << (*dof_iterator) << std::endl <<
"Not possible to calculate reactions." << std::endl;
772 if (dof_iterator->IsFixed())
773 dof_iterator->SetEquationId(--fix_id);
775 dof_iterator->SetEquationId(free_id++);
789 typename TSchemeType::Pointer pScheme,
803 if (pDx ==
nullptr) {
829 KRATOS_ERROR <<
"The equation system size has changed during the simulation. This is not permitted."<<std::endl;
837 TSparseSpace::SetToZero(rDx);
841 TSparseSpace::SetToZero(rb);
863 typename TSchemeType::Pointer pScheme,
877 i = (*it2)->EquationId();
880 (*it2)->GetSolutionStepReactionValue() = -r_reactions_vector[
i];
898 typename TSchemeType::Pointer pScheme,
946 "name" : "elimination_builder_and_solver",
947 "block_builder" : false,
948 "diagonal_values_for_dirichlet_dofs" : "use_max_diagonal"
954 return default_parameters;
963 return "elimination_builder_and_solver";
979 std::string
Info()
const override
981 return "ResidualBasedEliminationBuilderAndSolver";
1010 #ifdef USE_LOCKS_IN_ASSEMBLY
1011 std::vector<omp_lock_t> mLockArray;
1043 #ifdef USE_LOCKS_IN_ASSEMBLY
1044 ,std::vector< omp_lock_t >& rLockArray
1051 const IndexType i_global = rEquationId[i_local];
1054 #ifdef USE_LOCKS_IN_ASSEMBLY
1055 omp_set_lock(&rLockArray[i_global]);
1056 rb[i_global] += rRHSContribution(i_local);
1058 double& r_a = rb[i_global];
1059 const double& v_a = rRHSContribution(i_local);
1064 #ifdef USE_LOCKS_IN_ASSEMBLY
1065 omp_unset_lock(&rLockArray[i_global]);
1079 typename TSchemeType::Pointer pScheme,
1089 std::vector<std::unordered_set<IndexType> > indices(equation_size);
1091 block_for_each(indices, [](std::unordered_set<IndexType>& rIndices){
1092 rIndices.reserve(40);
1097 #pragma omp parallel firstprivate(ids)
1103 std::vector<std::unordered_set<IndexType> > temp_indexes(equation_size);
1106 for (
int index = 0; index < static_cast<int>(equation_size); ++index)
1107 temp_indexes[index].reserve(30);
1110 const int number_of_elements =
static_cast<int>(rModelPart.
Elements().
size());
1116 #pragma omp for schedule(guided, 512) nowait
1117 for (
int i_elem = 0; i_elem<number_of_elements; ++i_elem) {
1118 auto it_elem = it_elem_begin + i_elem;
1119 pScheme->EquationId( *it_elem, ids, r_current_process_info);
1121 for (
auto& id_i : ids) {
1123 auto& row_indices = temp_indexes[id_i];
1124 for (
auto& id_j : ids)
1126 row_indices.insert(id_j);
1132 const int number_of_conditions =
static_cast<int>(rModelPart.
Conditions().size());
1138 #pragma omp for schedule(guided, 512) nowait
1139 for (
int i_cond = 0; i_cond<number_of_conditions; ++i_cond) {
1140 auto it_cond = it_cond_begin + i_cond;
1141 pScheme->EquationId( *it_cond, ids, r_current_process_info);
1143 for (
auto& id_i : ids) {
1145 auto& row_indices = temp_indexes[id_i];
1146 for (
auto& id_j : ids)
1148 row_indices.insert(id_j);
1154 #pragma omp critical
1156 for (
int i = 0; i < static_cast<int>(temp_indexes.size()); ++
i) {
1157 indices[
i].insert(temp_indexes[
i].begin(), temp_indexes[
i].end());
1165 nnz += indices[
i].size();
1169 double* Avalues = rA.value_data().begin();
1170 std::size_t* Arow_indices = rA.index1_data().begin();
1171 std::size_t* Acol_indices = rA.index2_data().begin();
1174 Arow_indices[0] = 0;
1176 Arow_indices[
i + 1] = Arow_indices[
i] + indices[
i].size();
1182 for (
auto it = indices[
Index].begin(); it != indices[
Index].end(); ++it) {
1183 Acol_indices[
k] = *it;
1188 std::sort(&Acol_indices[row_begin], &Acol_indices[row_end]);
1191 rA.set_filled(indices.size() + 1, nnz);
1211 const IndexType i_global = rEquationId[i_local];
1214 const IndexType j_global = rEquationId[j_local];
1216 rA(i_global, j_global) += rLHSContribution(i_local, j_local);
1235 double* values_vector = rA.value_data().begin();
1236 IndexType* index1_vector = rA.index1_data().begin();
1237 IndexType* index2_vector = rA.index2_data().begin();
1239 const IndexType left_limit = index1_vector[
i];
1251 last_pos =
ForwardFind(j_global,left_limit,index2_vector);
1252 last_found = j_global;
1258 if (
counter <= EquationId.size()) {
1259 #ifndef USE_LOCKS_IN_ASSEMBLY
1260 double& r_a = values_vector[last_pos];
1261 const double& v_a = rALocal(i_local,
counter - 1);
1264 values_vector[last_pos] += rALocal(i_local,
counter - 1);
1271 if(id_to_find > last_found)
1272 pos =
ForwardFind(id_to_find,last_pos+1,index2_vector);
1273 else if(id_to_find < last_found)
1274 pos =
BackwardFind(id_to_find,last_pos-1,index2_vector);
1278 #ifndef USE_LOCKS_IN_ASSEMBLY
1279 double& r = values_vector[pos];
1280 const double&
v = rALocal(i_local,
j);
1283 values_vector[pos] += rALocal(i_local,
j);
1285 last_found = id_to_find;
1297 while(id_to_find != index_vector[pos]) pos++;
1306 while(id_to_find != index_vector[pos]) pos--;
1319 const std::string& r_diagonal_values_for_dirichlet_dofs = ThisParameters[
"diagonal_values_for_dirichlet_dofs"].
GetString();
1321 std::set<std::string> available_options_for_diagonal = {
"no_scaling",
"use_max_diagonal",
"use_diagonal_norm",
"defined_in_process_info"};
1323 if (available_options_for_diagonal.find(r_diagonal_values_for_dirichlet_dofs) == available_options_for_diagonal.end()) {
1324 std::stringstream msg;
1325 msg <<
"Currently prescribed diagonal values for dirichlet dofs : " << r_diagonal_values_for_dirichlet_dofs <<
"\n";
1326 msg <<
"Admissible values for the diagonal scaling are : no_scaling, use_max_diagonal, use_diagonal_norm, or defined_in_process_info" <<
"\n";
1331 if (r_diagonal_values_for_dirichlet_dofs ==
"no_scaling") {
1333 }
else if (r_diagonal_values_for_dirichlet_dofs ==
"use_max_diagonal") {
1335 }
else if (r_diagonal_values_for_dirichlet_dofs ==
"use_diagonal_norm") {
1375 inline void AddUnique(std::vector<std::size_t>&
v,
const std::size_t& candidate)
1377 std::vector<std::size_t>::iterator
i =
v.begin();
1378 std::vector<std::size_t>::iterator endit =
v.end();
1379 while (
i != endit && (*
i) != candidate) {
1383 v.push_back(candidate);
1404 const IndexType i_global = rEquationId[i_local];
1408 double& b_value = rb[i_global];
1409 const double& rhs_value = rRHSContribution[i_local];
1417 const IndexType i_global = rEquationId[i_local];
1421 double& b_value = rb[i_global];
1422 const double& rhs_value = rRHSContribution[i_local];
1427 const double& rhs_value = rRHSContribution[i_local];
1441 void AssembleLHSCompleteOnFreeRows(
1449 const IndexType i_global = rEquationId[i_local];
1452 const IndexType j_global = rEquationId[j_local];
1453 rA(i_global, j_global) += rLHSContribution(i_local, j_local);
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
virtual void AssignSettings(const Parameters ThisParameters)
This method assigns settings to member variables.
Definition: builder_and_solver.h:780
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
virtual Parameters GetDefaultParameters() const
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: builder_and_solver.h:628
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
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
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
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 defines the node.
Definition: node.h:65
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
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
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
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
ptr_iterator ptr_end()
Returns an iterator pointing to the end of the underlying data container.
Definition: pointer_vector_set.h:404
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
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 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.h:462
void SystemSolve(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
This is a call to the linear system solver.
Definition: residualbased_elimination_builder_and_solver.h:427
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: residualbased_elimination_builder_and_solver.h:991
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: residualbased_elimination_builder_and_solver.h:985
BaseType::ElementsContainerType ElementsContainerType
Definition: residualbased_elimination_builder_and_solver.h:114
IndexType ForwardFind(const IndexType id_to_find, const IndexType start, const IndexType *index_vector)
Definition: residualbased_elimination_builder_and_solver.h:1292
void CalculateReactions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
This method computes the reactions.
Definition: residualbased_elimination_builder_and_solver.h:862
void BuildLHS_CompleteOnFreeRows(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA) override
Build a rectangular matrix of size n*N where "n" is the number of unrestrained degrees of freedom and...
Definition: residualbased_elimination_builder_and_solver.h:352
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
ResidualBasedEliminationBuilderAndSolver(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: residualbased_elimination_builder_and_solver.h:130
SCALING_DIAGONAL mScalingDiagonal
The manually set scale factor.
Definition: residualbased_elimination_builder_and_solver.h:1016
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition of the base class.
Definition: residualbased_elimination_builder_and_solver.h:85
BaseType::IndexType IndexType
Definition: residualbased_elimination_builder_and_solver.h:92
~ResidualBasedEliminationBuilderAndSolver() override
Definition: residualbased_elimination_builder_and_solver.h:151
BaseType::Pointer Create(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters) const override
Create method.
Definition: residualbased_elimination_builder_and_solver.h:160
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
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: residualbased_elimination_builder_and_solver.h:100
ResidualBasedEliminationBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > ClassType
The definition of the current class.
Definition: residualbased_elimination_builder_and_solver.h:88
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
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: residualbased_elimination_builder_and_solver.h:101
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
IndexType BackwardFind(const IndexType id_to_find, const IndexType start, const IndexType *index_vector)
Definition: residualbased_elimination_builder_and_solver.h:1301
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.h:897
BaseType::TSchemeType TSchemeType
Definition: residualbased_elimination_builder_and_solver.h:93
double mScaleFactor
Definition: residualbased_elimination_builder_and_solver.h:1014
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedEliminationBuilderAndSolver)
Pointer definition of ResidualBasedEliminationBuilderAndSolverWithConstraints.
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
ResidualBasedEliminationBuilderAndSolver()
Default constructor.
Definition: residualbased_elimination_builder_and_solver.h:123
BaseType::TDataType TDataType
Definition: residualbased_elimination_builder_and_solver.h:94
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_elimination_builder_and_solver.h:97
std::string Info() const override
Turn back information as a string.
Definition: residualbased_elimination_builder_and_solver.h:979
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_elimination_builder_and_solver.h:98
void AssembleLHS(TSystemMatrixType &rA, LocalSystemMatrixType &rLHSContribution, EquationIdVectorType &rEquationId)
This method assembles the LHS of the system.
Definition: residualbased_elimination_builder_and_solver.h:1202
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
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_elimination_builder_and_solver.h:95
void BuildRHSAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Corresponds to the previews, but the System's matrix is considered already built and only the RHS is ...
Definition: residualbased_elimination_builder_and_solver.h:550
BaseType::SizeType SizeType
Definition of the classes from the base class.
Definition: residualbased_elimination_builder_and_solver.h:91
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
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_elimination_builder_and_solver.h:99
BaseType::NodesArrayType NodesArrayType
Containers definition.
Definition: residualbased_elimination_builder_and_solver.h:111
BaseType::ConditionsArrayType ConditionsArrayType
Definition: residualbased_elimination_builder_and_solver.h:113
void Assemble(TSystemMatrixType &rA, TSystemVectorType &rb, const LocalSystemMatrixType &rLHSContribution, const LocalSystemVectorType &rRHSContribution, const Element::EquationIdVectorType &rEquationId)
This method assembles the system.
Definition: residualbased_elimination_builder_and_solver.h:1037
ResidualBasedEliminationBuilderAndSolver(typename TLinearSolver::Pointer pNewLinearSystemSolver)
Constructor.
Definition: residualbased_elimination_builder_and_solver.h:143
void BuildLHS(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA) override
Function to perform the building of the LHS.
Definition: residualbased_elimination_builder_and_solver.h:274
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
BaseType::ElementsArrayType ElementsArrayType
Definition: residualbased_elimination_builder_and_solver.h:112
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: residualbased_elimination_builder_and_solver.h:961
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
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_elimination_builder_and_solver.h:96
int Check(ModelPart &rModelPart) override
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: residualbased_elimination_builder_and_solver.h:930
void SetUpSystem(ModelPart &rModelPart) override
Organises the dofset in order to speed up the building phase.
Definition: residualbased_elimination_builder_and_solver.h:759
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
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
#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_INFO_IF(label, conditional)
Definition: logger.h:251
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
start
Definition: DEM_benchmarks.py:17
end
Definition: DEM_benchmarks.py:180
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
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
SCALING_DIAGONAL
Definition: ublas_space.h:98
@ CONSIDER_PRESCRIBED_DIAGONAL
v
Definition: generate_convection_diffusion_explicit_element.py:114
int local_size
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:17
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17