10 #if !defined(KRATOS_BLOCK_BUILDER_AND_SOLVER_H_INCLUDED)
11 #define KRATOS_BLOCK_BUILDER_AND_SOLVER_H_INCLUDED
21 #ifdef USE_GOOGLE_HASH
22 #include "sparsehash/dense_hash_set"
24 #include <unordered_set>
53 template<
class TSparseSpace,
143 this->
Build(pScheme, rModelPart, rA,
tmp);
158 BuildRHSNoDirichlet(pScheme,rModelPart,rb);
160 const int ndofs =
static_cast<int>(this->
mDofSet.
size());
163 #pragma omp parallel for firstprivate(ndofs)
164 for (
int k = 0;
k<ndofs;
k++)
167 const std::size_t
i = dof_iterator->EquationId();
169 if (dof_iterator->IsFixed())
192 const int nelements =
static_cast<int>(rModelPart.
Elements().size());
195 const int nconditions =
static_cast<int>(rModelPart.
Conditions().size());
198 ModelPart::ElementsContainerType::iterator el_begin = rModelPart.
ElementsBegin();
199 ModelPart::ConditionsContainerType::iterator cond_begin = rModelPart.
ConditionsBegin();
211 #pragma omp parallel firstprivate(nelements,nconditions, LHS_Contribution, RHS_Contribution, EquationId )
213 # pragma omp for schedule(guided, 512) nowait
214 for (
int k = 0;
k < nelements;
k++)
216 ModelPart::ElementsContainerType::iterator it = el_begin +
k;
220 bool element_is_active =
true;
222 element_is_active = (it)->
Is(ACTIVE);
224 if (element_is_active)
227 pScheme->CalculateSystemContributions(*(it.base()), LHS_Contribution, RHS_Contribution, EquationId, rCurrentProcessInfo);
230 #ifdef USE_LOCKS_IN_ASSEMBLY
231 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId, mlock_array);
233 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId);
236 pScheme->Clear(*(it.base()));
243 #pragma omp for schedule(guided, 512)
244 for (
int k = 0;
k < nconditions;
k++)
246 ModelPart::ConditionsContainerType::iterator it = cond_begin +
k;
250 bool condition_is_active =
true;
252 condition_is_active = (it)->
Is(ACTIVE);
254 if (condition_is_active)
257 pScheme->Condition_CalculateSystemContributions(*(it.base()), LHS_Contribution, RHS_Contribution, EquationId, rCurrentProcessInfo);
260 #ifdef USE_LOCKS_IN_ASSEMBLY
261 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId, mlock_array);
263 Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId);
267 pScheme->Clear(*(it.base()));
305 TSparseSpace::SetToZero(rDx);
329 Build(pScheme, rModelPart, rA, rb);
339 KRATOS_INFO(
"LHS before solve") <<
"Matrix = " << rA << std::endl;
340 KRATOS_INFO(
"Dx before solve") <<
"Solution = " << rDx << std::endl;
341 KRATOS_INFO(
"RHS before solve") <<
"Vector = " << rb << std::endl;
354 KRATOS_INFO(
"LHS after solve") <<
"Matrix = " << rA << std::endl;
355 KRATOS_INFO(
"Dx after solve") <<
"Solution = " << rDx << std::endl;
356 KRATOS_INFO(
"RHS after solve") <<
"Vector = " << rb << std::endl;
394 std::size_t system_size = rA.size1();
395 std::vector<double> scaling_factors (system_size, 0.0f);
397 const int ndofs =
static_cast<int>(this->
mDofSet.
size());
400 #pragma omp parallel for firstprivate(ndofs)
401 for(
int k = 0;
k<ndofs;
k++)
404 if(dof_iterator->IsFixed())
405 scaling_factors[
k] = 0.0f;
407 scaling_factors[
k] = 1.0f;
411 double* Avalues = rA.value_data().begin();
412 std::size_t* Arow_indices = rA.index1_data().begin();
413 std::size_t* Acol_indices = rA.index2_data().begin();
416 #pragma omp parallel for firstprivate(system_size)
417 for(
int k = 0; k < static_cast<int>(system_size); ++
k)
419 std::size_t col_begin = Arow_indices[
k];
420 std::size_t col_end = Arow_indices[
k+1];
422 for (std::size_t
j = col_begin;
j < col_end; ++
j)
424 if(Avalues[
j] != 0.0)
438 #pragma omp parallel for
439 for (
int k = 0; k < static_cast<int>(system_size); ++
k)
441 std::size_t col_begin = Arow_indices[
k];
442 std::size_t col_end = Arow_indices[
k+1];
443 double k_factor = scaling_factors[
k];
447 for (std::size_t
j = col_begin;
j < col_end; ++
j)
448 if (
static_cast<int>(Acol_indices[
j]) !=
k )
457 for (std::size_t
j = col_begin;
j < col_end; ++
j)
458 if(scaling_factors[ Acol_indices[
j] ] == 0 )
475 KRATOS_INFO(
"setting_dofs") <<
"SetUpDofSet starts" << std::endl;
480 const int nelements =
static_cast<int>(rElements.size());
488 #ifdef USE_GOOGLE_HASH
489 typedef google::dense_hash_set < Node::DofType::Pointer, dof_iterator_hash> set_type;
491 typedef std::unordered_set < Node::DofType::Pointer, dof_iterator_hash> set_type;
494 std::vector<set_type> dofs_aux_list(nthreads);
498 KRATOS_INFO(
"setting_dofs") <<
"Number of threads:" << nthreads << std::endl;
501 for (
int i = 0; i < static_cast<int>(nthreads);
i++)
503 #ifdef USE_GOOGLE_HASH
506 dofs_aux_list[
i].reserve(nelements);
512 KRATOS_INFO(
"setting_dofs") <<
"initialize_elements" << std::endl;
515 #pragma omp parallel firstprivate(nelements, ElementalDofList)
517 #pragma omp for schedule(guided, 512) nowait
518 for (
int i = 0;
i < nelements;
i++)
520 typename ElementsContainerType::iterator it = rElements.begin() +
i;
524 pScheme->GetElementalDofList(*(it.base()), ElementalDofList, rCurrentProcessInfo);
526 dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
531 KRATOS_INFO(
"setting_dofs") <<
"initialize_conditions" << std::endl;
535 const int nconditions =
static_cast<int>(rConditions.size());
536 #pragma omp for schedule(guided, 512)
537 for (
int i = 0;
i < nconditions;
i++)
539 typename ConditionsContainerType::iterator it = rConditions.begin() +
i;
543 pScheme->GetConditionDofList(*(it.base()), ElementalDofList, rCurrentProcessInfo);
544 dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
551 KRATOS_INFO(
"setting_dofs") <<
"initialize tree reduction" << std::endl;
555 unsigned int old_max = nthreads;
556 unsigned int new_max = ceil(0.5*
static_cast<double>(old_max));
557 while (new_max>=1 && new_max != old_max)
562 KRATOS_INFO(
"setting_dofs") <<
"old_max" << old_max <<
" new_max:" << new_max << std::endl;
563 for (
int i = 0; i < static_cast<int>(new_max);
i++)
565 if (
i + new_max < old_max)
567 KRATOS_INFO(
"setting_dofs") <<
i <<
" - " <<
i+new_max << std::endl;
572 #pragma omp parallel for
573 for (
int i = 0; i < static_cast<int>(new_max);
i++)
575 if (
i + new_max < old_max)
577 dofs_aux_list[
i].insert(dofs_aux_list[
i+new_max].begin(), dofs_aux_list[
i+new_max].end());
578 dofs_aux_list[
i+new_max].clear();
583 new_max = ceil(0.5*
static_cast<double>(old_max));
589 KRATOS_INFO(
"setting_dofs") <<
"initializing ordered array filling" << std::endl;
595 Doftemp.
reserve(dofs_aux_list[0].size());
596 for (
auto it= dofs_aux_list[0].begin(); it!= dofs_aux_list[0].end(); it++)
616 KRATOS_INFO(
"setting_dofs") <<
"Finished setting up the dofs" << std::endl;
621 KRATOS_INFO(
"setting_dofs") <<
"Initializing lock array" << std::endl;
625 if (mlock_array.size() != 0)
627 for (
int i = 0; i < static_cast<int>(mlock_array.size());
i++)
629 omp_destroy_lock(&mlock_array[
i]);
634 for (
int i = 0; i < static_cast<int>(mlock_array.size());
i++)
636 omp_init_lock(&mlock_array[
i]);
642 KRATOS_INFO(
"setting_dofs") <<
"End of setupdofset" << std::endl;
645 this->
Set(LocalFlagType::DOFS_INITIALIZED,
true);
658 int ndofs =
static_cast<int>(this->
mDofSet.
size());
660 #pragma omp parallel for firstprivate(ndofs)
661 for (
int i = 0; i < static_cast<int>(ndofs);
i++)
664 dof_iterator->SetEquationId(
i);
701 if (rA.size1() == 0 || this->mOptions.Is(LocalFlagType::REFORM_DOFS))
708 if (rA.size1() != this->mEquationSystemSize || rA.size2() != this->mEquationSystemSize)
710 KRATOS_WARNING(
"block builder resize") <<
"it should not come here -> this is SLOW" << std::endl;
715 if (rDx.size() != this->mEquationSystemSize)
717 if (rb.size() != this->mEquationSystemSize)
785 TSparseSpace::SetToZero(rb);
788 BuildRHSNoDirichlet(pScheme, rModelPart, rb);
790 const int ndofs =
static_cast<int>(this->
mDofSet.
size());
793 #pragma omp parallel for firstprivate(ndofs)
794 for (
int k = 0;
k<ndofs;
k++)
798 const int i = (dof_iterator)->EquationId();
799 if ( (dof_iterator)->IsFixed() ) {
800 (dof_iterator)->GetSolutionStepReactionValue() = -rb[
i];
802 (dof_iterator)->GetSolutionStepReactionValue() = 0.0;
819 for (
int i = 0; i < static_cast<int>(mlock_array.size());
i++)
820 omp_destroy_lock(&mlock_array[
i]);
821 mlock_array.resize(0);
865 std::vector< omp_lock_t > mlock_array;
900 TSparseSpace::SetToZero(rDx);
901 KRATOS_WARNING(
"RHS") <<
"ATTENTION! setting the RHS to zero!" << std::endl;
925 #ifdef USE_GOOGLE_HASH
926 std::vector<google::dense_hash_set<std::size_t> > indices(equation_size);
927 const std::size_t empty_key = 2*equation_size + 10;
929 std::vector<std::unordered_set<std::size_t> > indices(equation_size);
932 #pragma omp parallel for firstprivate(equation_size)
933 for (
int iii = 0; iii < static_cast<int>(equation_size); iii++)
935 #ifdef USE_GOOGLE_HASH
936 indices[iii].set_empty_key(empty_key);
938 indices[iii].reserve(40);
944 const int nelements =
static_cast<int>(rElements.size());
945 #pragma omp parallel for firstprivate(nelements, ids)
946 for(
int iii=0; iii<nelements; iii++)
948 typename ElementsContainerType::iterator i_element = rElements.begin() + iii;
949 pScheme->EquationId( *(i_element.base()) , ids, rCurrentProcessInfo);
950 for (std::size_t
i = 0;
i < ids.size();
i++)
953 omp_set_lock(&mlock_array[ids[
i]]);
955 auto& row_indices = indices[ids[
i]];
956 row_indices.insert(ids.begin(), ids.end());
959 omp_unset_lock(&mlock_array[ids[
i]]);
965 const int nconditions =
static_cast<int>(rConditions.size());
966 #pragma omp parallel for firstprivate(nconditions, ids)
967 for (
int iii = 0; iii<nconditions; iii++)
969 typename ConditionsContainerType::iterator i_condition = rConditions.begin() + iii;
970 pScheme->Condition_EquationId( *(i_condition.base()), ids, rCurrentProcessInfo);
971 for (std::size_t
i = 0;
i < ids.size();
i++)
974 omp_set_lock(&mlock_array[ids[
i]]);
976 auto& row_indices = indices[ids[
i]];
977 row_indices.insert(ids.begin(), ids.end());
979 omp_unset_lock(&mlock_array[ids[
i]]);
985 unsigned int nnz = 0;
986 for (
unsigned int i = 0;
i < indices.size();
i++)
987 nnz += indices[
i].size();
989 rA = boost::numeric::ublas::compressed_matrix<double>(indices.size(), indices.size(), nnz);
991 double* Avalues = rA.value_data().begin();
992 std::size_t* Arow_indices = rA.index1_data().begin();
993 std::size_t* Acol_indices = rA.index2_data().begin();
997 for (
int i = 0; i < static_cast<int>(rA.size1());
i++)
998 Arow_indices[
i+1] = Arow_indices[
i] + indices[
i].size();
1001 #pragma omp parallel for
1002 for (
int i = 0; i < static_cast<int>(rA.size1());
i++)
1004 const unsigned int row_begin = Arow_indices[
i];
1005 const unsigned int row_end = Arow_indices[
i+1];
1006 unsigned int k = row_begin;
1007 for (
auto it = indices[
i].begin(); it != indices[
i].end(); it++)
1009 Acol_indices[
k] = *it;
1016 std::sort(&Acol_indices[row_begin], &Acol_indices[row_end]);
1020 rA.set_filled(indices.size()+1, nnz);
1033 unsigned int local_size = rLHS_Contribution.size1();
1035 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1037 unsigned int i_global = rEquationId[i_local];
1039 for (
unsigned int j_local = 0; j_local <
local_size; j_local++)
1041 unsigned int j_global = rEquationId[j_local];
1043 rA(i_global, j_global) += rLHS_Contribution(i_local, j_local);
1053 unsigned int local_size = rRHS_Contribution.size();
1055 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1057 unsigned int i_global = rEquationId[i_local];
1060 double& b_value = rb[i_global];
1061 const double& rhs_value = rRHS_Contribution[i_local];
1064 b_value += rhs_value;
1073 #ifdef USE_LOCKS_IN_ASSEMBLY
1074 ,std::vector< omp_lock_t >& lock_array
1078 unsigned int local_size = rLHS_Contribution.size1();
1080 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1082 unsigned int i_global = rEquationId[i_local];
1084 #ifdef USE_LOCKS_IN_ASSEMBLY
1085 omp_set_lock(&lock_array[i_global]);
1086 b[i_global] += rRHS_Contribution(i_local);
1088 double& r_a = rb[i_global];
1089 const double& v_a = rRHS_Contribution(i_local);
1094 AssembleRowContribution(rA, rLHS_Contribution, i_global, i_local, rEquationId);
1096 #ifdef USE_LOCKS_IN_ASSEMBLY
1097 omp_unset_lock(&lock_array[i_global]);
1133 inline void AddUnique(std::vector<std::size_t>&
v,
const std::size_t& candidate)
1135 std::vector<std::size_t>::iterator
i =
v.begin();
1136 std::vector<std::size_t>::iterator endit =
v.end();
1137 while (
i != endit && (*
i) != candidate)
1143 v.push_back(candidate);
1149 ModelPart& rModelPart,
1160 ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
1173 const int nelements =
static_cast<int>(rElements.size());
1174 #pragma omp parallel firstprivate(nelements, RHS_Contribution, EquationId)
1176 #pragma omp for schedule(guided, 512) nowait
1177 for(
int i=0;
i<nelements;
i++)
1179 typename ElementsContainerType::iterator it = rElements.begin() +
i;
1182 bool element_is_active =
true;
1183 if( (it)->IsDefined(ACTIVE) )
1184 element_is_active = (it)->Is(ACTIVE);
1186 if(element_is_active)
1189 pScheme->Calculate_RHS_Contribution(*(it.base()), RHS_Contribution, EquationId, rCurrentProcessInfo);
1196 LHS_Contribution.resize(0, 0,
false);
1197 RHS_Contribution.resize(0,
false);
1201 const int nconditions =
static_cast<int>(ConditionsArray.size());
1203 #pragma omp for schedule(guided, 512)
1204 for (
int i = 0;
i<nconditions;
i++)
1206 auto it = ConditionsArray.begin() +
i;
1209 bool condition_is_active =
true;
1210 if( (it)->IsDefined(ACTIVE) )
1211 condition_is_active = (it)->Is(ACTIVE);
1213 if(condition_is_active)
1216 pScheme->Condition_Calculate_RHS_Contribution(*(it.base()), RHS_Contribution, EquationId, rCurrentProcessInfo);
1228 inline void CreatePartition(
unsigned int number_of_threads,
1229 const int number_of_rows,
1230 vector<unsigned int>& partitions)
1232 partitions.resize(number_of_threads + 1);
1233 int partition_size = number_of_rows / number_of_threads;
1235 partitions[number_of_threads] = number_of_rows;
1236 for (
unsigned int i = 1;
i < number_of_threads;
i++)
1237 partitions[
i] = partitions[
i - 1] + partition_size;
1242 const unsigned int i,
1243 const unsigned int i_local,
1246 double* values_vector = rA.value_data().begin();
1247 std::size_t* index1_vector = rA.index1_data().begin();
1248 std::size_t* index2_vector = rA.index2_data().begin();
1250 size_t left_limit = index1_vector[
i];
1254 size_t last_pos = ForwardFind(rEquationId[0],left_limit,index2_vector);
1255 size_t last_found = rEquationId[0];
1257 #ifndef USE_LOCKS_IN_ASSEMBLY
1258 double& r_a = values_vector[last_pos];
1259 const double& v_a = rAlocal(i_local,0);
1263 values_vector[last_pos] += rAlocal(i_local,0);
1268 for(
unsigned int j=1;
j<rEquationId.size();
j++)
1270 unsigned int id_to_find = rEquationId[
j];
1271 if(id_to_find > last_found)
1272 pos = ForwardFind(id_to_find,last_pos+1,index2_vector);
1274 pos = BackwardFind(id_to_find,last_pos-1,index2_vector);
1276 #ifndef USE_LOCKS_IN_ASSEMBLY
1277 double& r = values_vector[pos];
1278 const double&
v = rAlocal(i_local,
j);
1282 values_vector[pos] += rAlocal(i_local,
j);
1285 last_found = id_to_find;
1290 inline unsigned int ForwardFind(
const unsigned int id_to_find,
1291 const unsigned int start,
1292 const size_t* index_vector)
1294 unsigned int pos =
start;
1295 while(id_to_find != index_vector[pos]) pos++;
1299 inline unsigned int BackwardFind(
const unsigned int id_to_find,
1300 const unsigned int start,
1301 const size_t* index_vector)
1303 unsigned int pos =
start;
1304 while(id_to_find != index_vector[pos]) pos--;
Solution Buider and Solver based on block matrix.
Definition: block_builder_and_solver.hpp:58
ModelPart::ElementsContainerType ElementsContainerType
Definition: block_builder_and_solver.hpp:82
void InitializeSolutionStep(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixPointerType &pA, SystemVectorPointerType &pDx, SystemVectorPointerType &pb) override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: block_builder_and_solver.hpp:729
BaseType::SystemVectorType SystemVectorType
Definition: block_builder_and_solver.hpp:75
BaseType::SystemMatrixPointerType SystemMatrixPointerType
Definition: block_builder_and_solver.hpp:76
void SetUpSystemMatrices(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixPointerType &pA, SystemVectorPointerType &pDx, SystemVectorPointerType &pb) override
Resizes and Initializes the system vectors and matrices after SetUpDofSet and SetUpSytem has been cal...
Definition: block_builder_and_solver.hpp:672
void SystemSolveWithPhysics(SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb, ModelPart &rModelPart)
Definition: block_builder_and_solver.hpp:876
BlockBuilderAndSolver(LinearSolverPointerType pLinearSystemSolver)
Default Constructor.
Definition: block_builder_and_solver.hpp:113
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: block_builder_and_solver.hpp:83
BaseType::LocalFlagType LocalFlagType
Definition: block_builder_and_solver.hpp:71
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: block_builder_and_solver.hpp:78
void SetUpDofSet(SchemePointerType pScheme, ModelPart &rModelPart) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: block_builder_and_solver.hpp:468
void AssembleLHS(SystemMatrixType &rA, LocalSystemMatrixType &rLHS_Contribution, Element::EquationIdVectorType &rEquationId)
Definition: block_builder_and_solver.hpp:1029
BaseType::SystemVectorPointerType SystemVectorPointerType
Definition: block_builder_and_solver.hpp:77
void BuildRHSAndSolve(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
Function to perform the building of the RHS and solving phase at the same time.
Definition: block_builder_and_solver.hpp:366
void BuildAndSolve(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
Function to perform the building and solving phase at the same time.
Definition: block_builder_and_solver.hpp:320
virtual void ConstructMatrixStructure(SchemePointerType pScheme, SystemMatrixType &rA, ElementsContainerType &rElements, ConditionsContainerType &rConditions, ProcessInfo &rCurrentProcessInfo)
Definition: block_builder_and_solver.hpp:914
BaseType::DofsArrayType DofsArrayType
Definition: block_builder_and_solver.hpp:72
BaseType::LinearSolverPointerType LinearSolverPointerType
Definition: block_builder_and_solver.hpp:86
int Check(ModelPart &r_mUSE_GOOGLE_HASHodel_part) override
Definition: block_builder_and_solver.hpp:833
void BuildRHS(SchemePointerType pScheme, ModelPart &rModelPart, SystemVectorType &rb) override
Function to perform the build of the RHS.
Definition: block_builder_and_solver.hpp:152
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: block_builder_and_solver.hpp:79
ModelPart::NodesContainerType NodesContainerType
Definition: block_builder_and_solver.hpp:81
void ApplyDirichletConditions(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
applies the dirichlet conditions.
Definition: block_builder_and_solver.hpp:388
void SetUpSystem() override
organises the dofset in order to speed up the building phase
Definition: block_builder_and_solver.hpp:653
BaseType::SchemePointerType SchemePointerType
Definition: block_builder_and_solver.hpp:85
void FinalizeSolutionStep(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixPointerType &pA, SystemVectorPointerType &pDx, SystemVectorPointerType &pb) override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: block_builder_and_solver.hpp:761
SolutionBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: block_builder_and_solver.hpp:67
void AssembleRHS(SystemVectorType &rb, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId)
Definition: block_builder_and_solver.hpp:1049
void SystemSolve(SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
This is a call to the linear system solver.
Definition: block_builder_and_solver.hpp:287
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: block_builder_and_solver.hpp:813
void BuildLHS(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA) override
Function to perform the building of the LHS,.
Definition: block_builder_and_solver.hpp:136
BaseType::SystemMatrixType SystemMatrixType
Definition: block_builder_and_solver.hpp:74
void Assemble(SystemMatrixType &rA, SystemVectorType &rb, const LocalSystemMatrixType &rLHS_Contribution, const LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId)
Definition: block_builder_and_solver.hpp:1068
BaseType::Pointer BasePointerType
Definition: block_builder_and_solver.hpp:69
void Build(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rb) override
Function to perform the building of the LHS and RHS.
Definition: block_builder_and_solver.hpp:181
KRATOS_CLASS_POINTER_DEFINITION(BlockBuilderAndSolver)
Pointer definition of BlockBuilderAndSolver.
void CalculateReactions(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
Calculates system reactions.
Definition: block_builder_and_solver.hpp:779
~BlockBuilderAndSolver() override
Destructor.
Definition: block_builder_and_solver.hpp:119
virtual int MyPID() const
Definition: communicator.cpp:91
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
const VariableData & GetVariable() const
Definition: dof.h:303
IndexType Id() const
Definition: dof.h:292
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool IsDefined(Flags const &rOther) const
Definition: flags.h:279
bool Is(Flags const &rOther) const
Definition: flags.h:274
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
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
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
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
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
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
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Solution Buider and Solver base class.
Definition: solution_builder_and_solver.hpp:63
unsigned int mEquationSystemSize
Definition: solution_builder_and_solver.hpp:479
virtual void Clear()
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: solution_builder_and_solver.hpp:305
TSparseSpace::MatrixPointerType SystemMatrixPointerType
Definition: solution_builder_and_solver.hpp:78
TSparseSpace::VectorType SystemVectorType
Definition: solution_builder_and_solver.hpp:76
TDenseSpace::VectorType LocalSystemVectorType
Definition: solution_builder_and_solver.hpp:82
TSparseSpace::MatrixType SystemMatrixType
Definition: solution_builder_and_solver.hpp:75
virtual void FinalizeSolutionStep(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixPointerType &pA, SystemVectorPointerType &pDx, SystemVectorPointerType &pb)
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: solution_builder_and_solver.hpp:281
virtual void InitializeSolutionStep(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixPointerType &pA, SystemVectorPointerType &pDx, SystemVectorPointerType &pb)
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: solution_builder_and_solver.hpp:269
DofsArrayType mDofSet
Definition: solution_builder_and_solver.hpp:473
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solution_builder_and_solver.hpp:81
TLinearSolver::Pointer LinearSolverPointerType
Definition: solution_builder_and_solver.hpp:87
TSparseSpace::VectorPointerType SystemVectorPointerType
Definition: solution_builder_and_solver.hpp:79
LinearSolverPointerType mpLinearSystemSolver
Definition: solution_builder_and_solver.hpp:470
int mEchoLevel
Definition: solution_builder_and_solver.hpp:482
SchemeType::Pointer SchemePointerType
Definition: solution_builder_and_solver.hpp:85
Solver local flags class definition.
Definition: solution_local_flags.hpp:48
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
void HashCombine(HashType &Seed, const TClassType &Value)
This method creates an "unique" hash for the input value.
Definition: key_hash.h:56
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_WARNING(label)
Definition: logger.h:265
start
Definition: DEM_benchmarks.py:17
int seed
Definition: GenerateWind.py:138
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
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
ProcessInfo
Definition: edgebased_PureConvection.py:116
v
Definition: generate_convection_diffusion_explicit_element.py:114
int local_size
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:17
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17
Definition: block_builder_and_solver.hpp:100
size_t operator()(const Node::DofType::Pointer &it1, const Node::DofType::Pointer &it2) const
Definition: block_builder_and_solver.hpp:101
Definition: block_builder_and_solver.hpp:89
size_t operator()(const Node::DofType::Pointer &it) const
Definition: block_builder_and_solver.hpp:90