KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
reduction_builder_and_solver.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosSolidMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: March 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_REDUCTION_BUILDER_AND_SOLVER_H_INCLUDED)
11 #define KRATOS_REDUCTION_BUILDER_AND_SOLVER_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 #include "includes/key_hash.h"
20 
21 #ifdef USE_GOOGLE_HASH
22 #include "sparsehash/dense_hash_set" //included in external libraries
23 #else
24 #include <unordered_set>
25 #endif
26 
27 
28 namespace Kratos
29 {
30 
33 
37 
41 
45 
49 
50 template<class TSparseSpace,
51  class TDenseSpace, //= DenseSpace<double>,
52  class TLinearSolver //= LinearSolver<TSparseSpace,TDenseSpace>
53  >
54 class ReductionBuilderAndSolver : public SolutionBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
55 {
56  public:
59 
62 
64  typedef typename BaseType::Pointer BasePointerType;
65 
68 
75 
79 
82 
84  {
85  size_t operator()(const Node::DofType::Pointer& it) const
86  {
87  std::size_t seed = 0;
88  HashCombine(seed, it->Id());
89  HashCombine(seed, (it->GetVariable()).Key());
90  return seed;
91  }
92  };
93 
95  {
96  size_t operator()(const Node::DofType::Pointer& it1, const Node::DofType::Pointer& it2) const
97  {
98  return (((it1->Id() == it2->Id() && (it1->GetVariable()).Key()) == (it2->GetVariable()).Key()));
99  }
100  };
101 
105 
108  : BaseType(pLinearSystemSolver)
109  {
110  }
111 
114  {
115  }
116 
120 
124 
131  ModelPart& rModelPart,
132  SystemMatrixType& rA) override
133  {
134  KRATOS_TRY
135 
136  //getting the elements from the model
137  ElementsContainerType& rElements = rModelPart.Elements();
138 
139  //getting the array of the conditions
140  ConditionsContainerType& rConditions = rModelPart.Conditions();
141 
142  //resetting to zero the vector of reactions
143  TSparseSpace::SetToZero(*(this->mpReactionsVector));
144 
145  //contributions to the system
146  LocalSystemMatrixType LHS_Contribution = LocalSystemMatrixType(0, 0);
147 
148  //vector containing the localization in the system of the different
149  //terms
151 
152  ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
153 
154  // assemble all elements
155  for (typename ElementsContainerType::ptr_iterator it = rElements.ptr_begin(); it != rElements.ptr_end(); ++it)
156  {
157  //calculate elemental contribution
158  pScheme->Calculate_LHS_Contribution(*it, LHS_Contribution, EquationId, rCurrentProcessInfo);
159 
160  //assemble the elemental contribution
161  AssembleLHS(rA, LHS_Contribution, EquationId);
162 
163  // clean local elemental memory
164  pScheme->Clear(*it);
165  }
166 
167  LHS_Contribution.resize(0, 0, false);
168 
169  // assemble all conditions
170  for (typename ConditionsContainerType::ptr_iterator it = rConditions.ptr_begin(); it != rConditions.ptr_end(); ++it)
171  {
172  //calculate elemental contribution
173  pScheme->Condition_Calculate_LHS_Contribution(*it, LHS_Contribution, EquationId, rCurrentProcessInfo);
174 
175  //assemble the elemental contribution
176  AssembleLHS(rA, LHS_Contribution, EquationId);
177  }
178 
179  KRATOS_CATCH("")
180 
181  }
182 
188  ModelPart& rModelPart,
189  SystemVectorType& rb) override
190  {
191  KRATOS_TRY
192 
193  //resetting to zero the vector of reactions
194 
195  if(this->mOptions.Is(LocalFlagType::COMPUTE_REACTIONS))
196  {
197  TSparseSpace::SetToZero(*(this->mpReactionsVector));
198  }
199 
200  //Getting the Elements
201  ElementsContainerType& rElements = rModelPart.Elements();
202 
203  //getting the array of the conditions
204  ConditionsContainerType& rConditions = rModelPart.Conditions();
205 
206  ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
207 
208  //contributions to the system
209  LocalSystemVectorType RHS_Contribution = LocalSystemVectorType(0);
210 
211  //vector containing the localization in the system of the different terms
213 
214  // assemble all elements
215 
216 #pragma omp parallel firstprivate( RHS_Contribution, EquationId)
217  {
218  const int nelements = static_cast<int>(rElements.size());
219 #pragma omp for schedule(guided, 512) nowait
220  for (int i = 0; i<nelements; i++)
221  {
222  typename ElementsContainerType::iterator it = rElements.begin() + i;
223  //detect if the element is active or not. If the user did not make any choice the element
224  //is active by default
225  bool element_is_active = true;
226  if ((it)->IsDefined(ACTIVE))
227  element_is_active = (it)->Is(ACTIVE);
228 
229  if (element_is_active)
230  {
231  //calculate elemental Right Hand Side Contribution
232  pScheme->Calculate_RHS_Contribution(*(it.base()), RHS_Contribution, EquationId, rCurrentProcessInfo);
233 
234  //assemble the elemental contribution
235  AssembleRHS(rb, RHS_Contribution, EquationId);
236  }
237  }
238 
239  // assemble all conditions
240  const int nconditions = static_cast<int>(rConditions.size());
241 #pragma omp for schedule(guided, 512)
242  for (int i = 0; i<nconditions; i++)
243  {
244  auto it = rConditions.begin() + i;
245  //detect if the element is active or not. If the user did not make any choice the element
246  //is active by default
247  bool condition_is_active = true;
248  if ((it)->IsDefined(ACTIVE))
249  condition_is_active = (it)->Is(ACTIVE);
250 
251  if (condition_is_active)
252  {
253  //calculate elemental contribution
254  pScheme->Condition_Calculate_RHS_Contribution(*(it.base()), RHS_Contribution, EquationId, rCurrentProcessInfo);
255 
256  //assemble the elemental contribution
257  AssembleRHS(rb, RHS_Contribution, EquationId);
258  }
259  }
260  }
261 
262 
263  KRATOS_CATCH("")
264  }
265 
270  void Build(SchemePointerType pScheme,
271  ModelPart& rModelPart,
272  SystemMatrixType& rA,
273  SystemVectorType& rb) override
274  {
275  KRATOS_TRY
276 
277  if (!pScheme)
278  KRATOS_ERROR << "No scheme provided!" << std::endl;
279 
280  //getting the elements from the model
281  const int nelements = static_cast<int>(rModelPart.Elements().size());
282 
283  //getting the array of the conditions
284  const int nconditions = static_cast<int>(rModelPart.Conditions().size());
285 
286  ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
287  ModelPart::ElementsContainerType::iterator el_begin = rModelPart.ElementsBegin();
288  ModelPart::ConditionsContainerType::iterator cond_begin = rModelPart.ConditionsBegin();
289 
290  //contributions to the system
291  LocalSystemMatrixType LHS_Contribution = LocalSystemMatrixType(0, 0);
292  LocalSystemVectorType RHS_Contribution = LocalSystemVectorType(0);
293 
294  //vector containing the localization in the system of the different
295  //terms
297 
298  // assemble all elements
299  // double start_build = OpenMPUtils::GetCurrentTime();
300 
301 #pragma omp parallel firstprivate(nelements, nconditions, LHS_Contribution, RHS_Contribution, EquationId )
302  {
303 #pragma omp for schedule(guided, 512) nowait
304  for (int k = 0; k < nelements; k++)
305  {
306  ModelPart::ElementsContainerType::iterator it = el_begin + k;
307 
308  //detect if the element is active or not. If the user did not make any choice the element
309  //is active by default
310  bool element_is_active = true;
311  if ((it)->IsDefined(ACTIVE))
312  element_is_active = (it)->Is(ACTIVE);
313 
314  if (element_is_active)
315  {
316  //calculate elemental contribution
317  pScheme->CalculateSystemContributions(*(it.base()), LHS_Contribution, RHS_Contribution, EquationId, rCurrentProcessInfo);
318 
319  //assemble the elemental contribution
320 #ifdef _OPENMP
321  Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId, mlock_array);
322 #else
323  Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId);
324 #endif
325  // clean local elemental memory
326  pScheme->Clear(*(it.base()));
327 
328  }
329 
330  }
331 
332 #pragma omp for schedule(guided, 512)
333  for (int k = 0; k < nconditions; k++)
334  {
335  ModelPart::ConditionsContainerType::iterator it = cond_begin + k;
336 
337  //detect if the element is active or not. If the user did not make any choice the element
338  //is active by default
339  bool condition_is_active = true;
340  if ((it)->IsDefined(ACTIVE))
341  condition_is_active = (it)->Is(ACTIVE);
342 
343  if (condition_is_active)
344  {
345  //calculate elemental contribution
346  pScheme->Condition_CalculateSystemContributions(*(it.base()), LHS_Contribution, RHS_Contribution, EquationId, rCurrentProcessInfo);
347 
348 #ifdef _OPENMP
349  Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId, mlock_array);
350 #else
351  Assemble(rA, rb, LHS_Contribution, RHS_Contribution, EquationId);
352 #endif
353 
354  // clean local elemental memory
355  pScheme->Clear(*(it.base()));
356  }
357  }
358  }
359 
360  // double stop_build = OpenMPUtils::GetCurrentTime();
361  // if (this->mEchoLevel > 2 && rModelPart.GetCommunicator().MyPID() == 0)
362  // KRATOS_INFO("parallel_build_time") << stop_build - start_build << std::endl;
363 
364  if (this->mEchoLevel > 2 && rModelPart.GetCommunicator().MyPID() == 0){
365  KRATOS_INFO("parallel_build") << "finished" << std::endl;
366  }
367 
368  KRATOS_CATCH("")
369 
370  }
371 
376  SystemVectorType& rDx,
377  SystemVectorType& rb) override
378  {
379  KRATOS_TRY
380 
381  double norm_b;
382  if (TSparseSpace::Size(rb) != 0)
383  norm_b = TSparseSpace::TwoNorm(rb);
384  else
385  norm_b = 0.00;
386 
387  if (norm_b != 0.00)
388  {
389  //do solve
390  this->mpLinearSystemSolver->Solve(rA, rDx, rb);
391  }
392  else
393  TSparseSpace::SetToZero(rDx);
394 
395  //prints informations about the current time
396  if (this->GetEchoLevel() > 1)
397  {
398  KRATOS_INFO("linear_solver") << *(this->mpLinearSystemSolver) << std::endl;
399  }
400 
401  KRATOS_CATCH("")
402 
403  }
404 
410  ModelPart& rModelPart,
411  SystemMatrixType& rA,
412  SystemVectorType& rDx,
413  SystemVectorType& rb) override
414  {
415  KRATOS_TRY
416 
417  // double begin_time = OpenMPUtils::GetCurrentTime();
418  Build(pScheme, rModelPart, rA, rb);
419  // double end_time = OpenMPUtils::GetCurrentTime();
420 
421  // if (this->mEchoLevel > 1 && rModelPart.GetCommunicator().MyPID() == 0)
422  // KRATOS_INFO("system_build_time") << end_time - begin_time << std::endl;
423 
424  ApplyDirichletConditions(pScheme, rModelPart, rA, rDx, rb);
425 
426  if (this->mEchoLevel == 3)
427  {
428  KRATOS_INFO("LHS before solve") << "Matrix = " << rA << std::endl;
429  KRATOS_INFO("Dx before solve") << "Solution = " << rDx << std::endl;
430  KRATOS_INFO("RHS before solve") << "Vector = " << rb << std::endl;
431  }
432 
433  // begin_time = OpenMPUtils::GetCurrentTime();
434  SystemSolveWithPhysics(rA, rDx, rb, rModelPart);
435  // end_time = OpenMPUtils::GetCurrentTime();
436 
437 
438  // if (this->mEchoLevel > 1 && rModelPart.GetCommunicator().MyPID() == 0)
439  // KRATOS_INFO("system_solve_time") << end_time - begin_time << std::endl;
440 
441  if (this->mEchoLevel == 3)
442  {
443  KRATOS_INFO("LHS after solve") << "Matrix = " << rA << std::endl;
444  KRATOS_INFO("Dx after solve") << "Solution = " << rDx << std::endl;
445  KRATOS_INFO("RHS after solve") << "Vector = " << rb << std::endl;
446  }
447 
448  KRATOS_CATCH("")
449  }
450 
456  ModelPart& rModelPart,
457  SystemMatrixType& rA,
458  SystemVectorType& rDx,
459  SystemVectorType& rb) override
460  {
461  KRATOS_TRY
462 
463  BuildRHS(pScheme, rModelPart, rb);
464  SystemSolve(rA, rDx, rb);
465 
466  KRATOS_CATCH("")
467  }
468 
469 
478  ModelPart& rModelPart,
479  SystemMatrixType& rA,
480  SystemVectorType& rDx,
481  SystemVectorType& rb) override
482  {
483  }
484 
490  ModelPart& rModelPart) override
491  {
492  KRATOS_TRY
493 
494  if( this->mEchoLevel > 1 && rModelPart.GetCommunicator().MyPID() == 0)
495  {
496  KRATOS_INFO("setting_dofs") << "SetUpDofSet starts" << std::endl;
497  }
498 
499  //Gets the array of elements from the modeler
500  ElementsContainerType& rElements = rModelPart.Elements();
501  const int nelements = static_cast<int>(rElements.size());
502 
503  Element::DofsVectorType ElementalDofList;
504 
505  ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
506 
507  unsigned int nthreads = ParallelUtilities::GetNumThreads();
508 
509 #ifdef USE_GOOGLE_HASH
510  typedef google::dense_hash_set < Node::DofType::Pointer, dof_iterator_hash> set_type;
511 #else
512  typedef std::unordered_set < Node::DofType::Pointer, dof_iterator_hash> set_type;
513 #endif
514 
515  std::vector<set_type> dofs_aux_list(nthreads);
516 
517  if( this->mEchoLevel > 2)
518  {
519  KRATOS_INFO("setting_dofs") << "Number of threads:" << nthreads << std::endl;
520  }
521 
522  for (int i = 0; i < static_cast<int>(nthreads); i++)
523  {
524 #ifdef USE_GOOGLE_HASH
525  dofs_aux_list[i].set_empty_key(Node::DofType::Pointer());
526 #else
527  dofs_aux_list[i].reserve(nelements);
528 #endif
529  }
530 
531  if( this->mEchoLevel > 2)
532  {
533  KRATOS_INFO("setting_dofs") << "initialize_elements" << std::endl;
534  }
535 
536 #pragma omp parallel for firstprivate(nelements, ElementalDofList)
537  for (int i = 0; i < static_cast<int>(nelements); i++)
538  {
539  typename ElementsContainerType::iterator it = rElements.begin() + i;
540  const unsigned int this_thread_id = OpenMPUtils::ThisThread();
541 
542  // gets list of Dof involved on every element
543  pScheme->GetElementalDofList(*(it.base()), ElementalDofList, rCurrentProcessInfo);
544 
545  dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
546  }
547 
548  if( this->mEchoLevel > 2)
549  {
550  KRATOS_INFO("setting_dofs") << "initialize_conditions" << std::endl;
551  }
552 
553  ConditionsContainerType& rConditions = rModelPart.Conditions();
554  const int nconditions = static_cast<int>(rConditions.size());
555 #pragma omp parallel for firstprivate(nconditions, ElementalDofList)
556  for (int i = 0; i < nconditions; i++)
557  {
558  typename ConditionsContainerType::iterator it = rConditions.begin() + i;
559  const unsigned int this_thread_id = OpenMPUtils::ThisThread();
560 
561  // gets list of Dof involved on every condition
562  pScheme->GetConditionDofList(*(it.base()), ElementalDofList, rCurrentProcessInfo);
563  dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
564 
565  }
566 
567  if( this->mEchoLevel > 2)
568  {
569  KRATOS_INFO("setting_dofs") << "initialize tree reduction" << std::endl;
570  }
571 
572  //here we do a reduction in a tree so to have everything on thread 0
573  unsigned int old_max = nthreads;
574  unsigned int new_max = ceil(0.5*static_cast<double>(old_max));
575  while (new_max >= 1 && new_max != old_max)
576  {
577  if( this->mEchoLevel > 2)
578  {
579  //just for debugging
580  KRATOS_INFO("setting_dofs") << "old_max" << old_max << " new_max:" << new_max << std::endl;
581  for (int i = 0; i < static_cast<int>(new_max); i++)
582  {
583  if (i + new_max < old_max)
584  {
585  KRATOS_INFO("setting_dofs") << i << " - " << i+new_max << std::endl;
586  }
587  }
588  }
589 
590 #pragma omp parallel for
591  for (int i = 0; i < static_cast<int>(new_max); i++)
592  {
593  if (i + new_max < old_max)
594  {
595  dofs_aux_list[i].insert(dofs_aux_list[i + new_max].begin(), dofs_aux_list[i + new_max].end());
596  dofs_aux_list[i + new_max].clear();
597  }
598  }
599 
600  old_max = new_max;
601  new_max = ceil(0.5*static_cast<double>(old_max));
602 
603  }
604 
605  if( this->mEchoLevel > 2)
606  {
607  KRATOS_INFO("setting_dofs") << "initializing ordered array filling" << std::endl;
608  }
609 
610  DofsArrayType Doftemp;
611  this->mDofSet = DofsArrayType();
612 
613  Doftemp.reserve(dofs_aux_list[0].size());
614  for (auto it = dofs_aux_list[0].begin(); it != dofs_aux_list[0].end(); it++)
615  {
616  Doftemp.push_back(*it);
617  }
618  Doftemp.Sort();
619 
620  this->mDofSet = Doftemp;
621 
622  //Throws an exception if there are no Degrees Of Freedom involved in the analysis
623  if (this->mDofSet.size() == 0)
624  {
625  KRATOS_ERROR << "No degrees of freedom!" << std::endl;
626  }
627  if( this->mEchoLevel > 2)
628  {
629  KRATOS_INFO("Dofs size") << this->mDofSet.size() << std::endl;
630  }
631 
632  if( this->mEchoLevel > 2 && rModelPart.GetCommunicator().MyPID() == 0)
633  {
634  KRATOS_INFO("setting_dofs") << "Finished setting up the dofs" << std::endl;
635  }
636 
637  if( this->mEchoLevel > 2)
638  {
639  KRATOS_INFO("setting_dofs") << "Initializing lock array" << std::endl;
640  }
641 
642 #ifdef _OPENMP
643  if (mlock_array.size() != 0)
644  {
645  for (int i = 0; i < static_cast<int>(mlock_array.size()); i++)
646  omp_destroy_lock(&mlock_array[i]);
647  }
648 
649  mlock_array.resize(this->mDofSet.size());
650 
651  for (int i = 0; i < static_cast<int>(mlock_array.size()); i++)
652  omp_init_lock(&mlock_array[i]);
653 #endif
654 
655  if( this->mEchoLevel > 2)
656  {
657  KRATOS_INFO("setting_dofs") << "End of setupdofset" << std::endl;
658  }
659 
660  this->Set(LocalFlagType::DOFS_INITIALIZED, true);
661 
662  KRATOS_CATCH("");
663  }
664 
668  void SetUpSystem() override
669  {
670  // Set equation id for degrees of freedom
671  // the free degrees of freedom are positioned at the beginning of the system,
672  // while the fixed one are at the end (in opposite order).
673  //
674  // that means that if the EquationId is greater than "mEquationSystemSize"
675  // the pointed degree of freedom is restrained
676  //
677  int free_id = 0;
678  int fix_id = this->mDofSet.size();
679 
680  for (typename DofsArrayType::iterator dof_iterator = this->mDofSet.begin(); dof_iterator != this->mDofSet.end(); ++dof_iterator)
681  if (dof_iterator->IsFixed())
682  dof_iterator->SetEquationId(--fix_id);
683  else
684  dof_iterator->SetEquationId(free_id++);
685 
686  this->mEquationSystemSize = fix_id;
687 
688  }
689 
694  ModelPart& rModelPart,
697  SystemVectorPointerType& pb) override
698  {
699  KRATOS_TRY
700 
701  if (pA == nullptr) //if the pointer is not initialized initialize it to an empty matrix
702  {
703  SystemMatrixPointerType pNewA = Kratos::make_shared<SystemMatrixType>(0, 0);
704  pA.swap(pNewA);
705  }
706  if (pDx == nullptr) //if the pointer is not initialized initialize it to an empty matrix
707  {
708  SystemVectorPointerType pNewDx = Kratos::make_shared<SystemVectorType>(0);
709  pDx.swap(pNewDx);
710  }
711  if (pb == nullptr) //if the pointer is not initialized initialize it to an empty matrix
712  {
713  SystemVectorPointerType pNewb = Kratos::make_shared<SystemVectorType>(0);
714  pb.swap(pNewb);
715  }
716  if (this->mpReactionsVector == nullptr) //if the pointer is not initialized initialize it to an empty matrix
717  {
718  SystemVectorPointerType pNewReactionsVector = Kratos::make_shared<SystemVectorType>(0);
719  this->mpReactionsVector.swap(pNewReactionsVector);
720  }
721 
722  SystemMatrixType& rA = *pA;
723  SystemVectorType& rDx = *pDx;
724  SystemVectorType& rb = *pb;
725 
726  //resizing the system vectors and matrix
727  if (rA.size1() == 0 || this->mOptions.Is(LocalFlagType::REFORM_DOFS)) //if the matrix is not initialized
728  {
729  rA.resize(this->mEquationSystemSize, this->mEquationSystemSize, false);
730  ConstructMatrixStructure(pScheme, rA, rModelPart.Elements(), rModelPart.Conditions(), rModelPart.GetProcessInfo());
731  }
732  else
733  {
734  if (rA.size1() != this->mEquationSystemSize || rA.size2() != this->mEquationSystemSize)
735  {
736  KRATOS_WARNING("reduction builder resize") << "it should not come here -> this is SLOW" << std::endl;
737  rA.resize(this->mEquationSystemSize, this->mEquationSystemSize, true);
738  ConstructMatrixStructure(pScheme, rA, rModelPart.Elements(), rModelPart.Conditions(), rModelPart.GetProcessInfo());
739  }
740  }
741  if (rDx.size() != this->mEquationSystemSize)
742  rDx.resize(this->mEquationSystemSize, false);
743  if (rb.size() != this->mEquationSystemSize)
744  rb.resize(this->mEquationSystemSize, false);
745 
746  //if needed resize the vector for the calculation of reactions
747  if(this->mOptions.Is(LocalFlagType::COMPUTE_REACTIONS))
748  {
749  unsigned int ReactionsVectorSize = this->mDofSet.size();
750  if (this->mpReactionsVector->size() != ReactionsVectorSize)
751  this->mpReactionsVector->resize(ReactionsVectorSize, false);
752  }
753 
754  KRATOS_CATCH("")
755 
756  }
757 
763  ModelPart& rModelPart,
766  SystemVectorPointerType& pb) override
767  {
768  KRATOS_TRY
769 
770  BaseType::InitializeSolutionStep(pScheme, rModelPart, pA, pDx, pb);
771 
772  // // Initialize
773  // pScheme->InitializeSolutionStep(rModelPart);
774 
775  // // Set up the system dofs and shape
776  // if(this->mOptions.Is(LocalFlagType::REFORM_DOFS))
777  // this->SetSystemDofs(pScheme, rModelPart);
778 
779  // // Set up system matrices and vectors
780  // double begin_time = OpenMPUtils::GetCurrentTime();
781  // this->SetUpSystemMatrices(pScheme, pA, pDx, pb);
782  // double end_time = OpenMPUtils::GetCurrentTime();
783 
784  // if (this->mEchoLevel >= 2)
785  // KRATOS_INFO("system_resize_time") << ": system_resize_time : " << end_time - begin_time << "\n" << LoggerMessage::Category::STATISTICS;
786 
787  KRATOS_CATCH("")
788  }
789 
795  ModelPart& rModelPart,
798  SystemVectorPointerType& pb) override
799  {
800  KRATOS_TRY
801 
802  BaseType::FinalizeSolutionStep(pScheme, rModelPart, pA, pDx, pb);
803 
804  KRATOS_CATCH("")
805  }
806 
813  ModelPart& rModelPart,
814  SystemMatrixType& rA,
815  SystemVectorType& rDx,
816  SystemVectorType& rb) override
817  {
818  //refresh RHS to have the correct reactions
819  BuildRHS(pScheme, rModelPart, rb);
820 
821  int i;
822  int systemsize = this->mDofSet.size() - TSparseSpace::Size(*this->mpReactionsVector);
823 
824  typename DofsArrayType::ptr_iterator it2;
825 
826  //updating variables
827  SystemVectorType& ReactionsVector = *this->mpReactionsVector;
828  for (it2 = this->mDofSet.ptr_begin(); it2 != this->mDofSet.ptr_end(); ++it2)
829  {
830  i = (*it2)->EquationId();
831  i -= systemsize;
832  (*it2)->GetSolutionStepReactionValue() = -ReactionsVector[i];
833 
834  }
835  }
836 
837 
841  void Clear() override
842  {
843 
844  BaseType::Clear();
845 
846 #ifdef _OPENMP
847  for (int i = 0; i < static_cast<int>(mlock_array.size()); i++)
848  omp_destroy_lock(&mlock_array[i]);
849  mlock_array.resize(0);
850 #endif
851 
852  }
853 
861  int Check(ModelPart& rModelPart) override
862  {
863  KRATOS_TRY
864 
865  return 0;
866 
867  KRATOS_CATCH("");
868  }
869 
873 
877 
881 
883 
884  protected:
887 
891 
892 #ifdef _OPENMP
893  std::vector< omp_lock_t > mlock_array;
894 #endif
895 
899 
903 
904 
905 
907  SystemVectorType& rDx,
908  SystemVectorType& rb,
909  ModelPart& rModelPart)
910  {
911  KRATOS_TRY
912 
913  double norm_b;
914  if (TSparseSpace::Size(rb) != 0)
915  norm_b = TSparseSpace::TwoNorm(rb);
916  else
917  norm_b = 0.00;
918 
919  if (norm_b != 0.00)
920  {
921  //provide physical data as needed
922  if(this->mpLinearSystemSolver->AdditionalPhysicalDataIsNeeded() )
923  this->mpLinearSystemSolver->ProvideAdditionalData(rA, rDx, rb, this->mDofSet, rModelPart);
924 
925  //do solve
926  this->mpLinearSystemSolver->Solve(rA, rDx, rb);
927  }
928  else
929  {
930  TSparseSpace::SetToZero(rDx);
931  KRATOS_WARNING("RHS") << "ATTENTION! setting the RHS to zero!" << std::endl;
932  }
933 
934  //prints informations about the current time
935  if (this->GetEchoLevel() > 1)
936  {
937  KRATOS_INFO("LinearSolver") << *(this->mpLinearSystemSolver) << std::endl;
938  }
939 
940  KRATOS_CATCH("")
941 
942  }
943 
945  SystemMatrixType& rA,
946  ElementsContainerType& rElements,
947  ConditionsContainerType& rConditions,
948  ProcessInfo& rCurrentProcessInfo)
949  {
950  //filling with zero the matrix (creating the structure)
951  // double begin_time = OpenMPUtils::GetCurrentTime();
952 
953  const std::size_t equation_size = this->mEquationSystemSize;
954 
955 #ifdef USE_GOOGLE_HASH
956  std::vector<google::dense_hash_set<std::size_t> > indices(equation_size);
957  const std::size_t empty_key = 2 * equation_size + 10;
958 #else
959  std::vector<std::unordered_set<std::size_t> > indices(equation_size);
960 #endif
961 
962 #pragma omp parallel for firstprivate(equation_size)
963  for (int iii = 0; iii < static_cast<int>(equation_size); iii++)
964  {
965 #ifdef USE_GOOGLE_HASH
966  indices[iii].set_empty_key(empty_key);
967 #else
968  indices[iii].reserve(40);
969 #endif
970  }
971 
973 
974  const int nelements = static_cast<int>(rElements.size());
975 #pragma omp parallel for firstprivate(nelements, ids)
976  for (int iii = 0; iii<nelements; iii++)
977  {
978  typename ElementsContainerType::iterator i_element = rElements.begin() + iii;
979  pScheme->EquationId( *(i_element.base()), ids, rCurrentProcessInfo);
980 
981  for (std::size_t i = 0; i < ids.size(); i++)
982  {
983  if (ids[i] < this->mEquationSystemSize)
984  {
985 #ifdef _OPENMP
986  omp_set_lock(&mlock_array[ids[i]]);
987 #endif
988  auto& row_indices = indices[ids[i]];
989  for (auto it = ids.begin(); it != ids.end(); it++)
990  {
991  if (*it < this->mEquationSystemSize)
992  row_indices.insert(*it);
993  }
994 #ifdef _OPENMP
995  omp_unset_lock(&mlock_array[ids[i]]);
996 #endif
997  }
998  }
999 
1000  }
1001 
1002  const int nconditions = static_cast<int>(rConditions.size());
1003 #pragma omp parallel for firstprivate(nconditions, ids)
1004  for (int iii = 0; iii<nconditions; iii++)
1005  {
1006  typename ConditionsContainerType::iterator i_condition = rConditions.begin() + iii;
1007  pScheme->Condition_EquationId( *(i_condition.base()) , ids, rCurrentProcessInfo);
1008  for (std::size_t i = 0; i < ids.size(); i++)
1009  {
1010  if (ids[i] < this->mEquationSystemSize)
1011  {
1012 #ifdef _OPENMP
1013  omp_set_lock(&mlock_array[ids[i]]);
1014 #endif
1015  auto& row_indices = indices[ids[i]];
1016  for (auto it = ids.begin(); it != ids.end(); it++)
1017  {
1018  if (*it < this->mEquationSystemSize)
1019  row_indices.insert(*it);
1020  }
1021 #ifdef _OPENMP
1022  omp_unset_lock(&mlock_array[ids[i]]);
1023 #endif
1024  }
1025  }
1026  }
1027 
1028  //count the row sizes
1029  unsigned int nnz = 0;
1030  for (unsigned int i = 0; i < indices.size(); i++)
1031  nnz += indices[i].size();
1032 
1033  rA = boost::numeric::ublas::compressed_matrix<double>(indices.size(), indices.size(), nnz);
1034 
1035  double* Avalues = rA.value_data().begin();
1036  std::size_t* Arow_indices = rA.index1_data().begin();
1037  std::size_t* Acol_indices = rA.index2_data().begin();
1038 
1039  //filling the index1 vector - DO NOT MAKE PARALLEL THE FOLLOWING LOOP!
1040  Arow_indices[0] = 0;
1041  for (int i = 0; i < static_cast<int>(rA.size1()); i++)
1042  Arow_indices[i + 1] = Arow_indices[i] + indices[i].size();
1043 
1044 
1045 #pragma omp parallel for
1046  for (int i = 0; i < static_cast<int>(rA.size1()); i++)
1047  {
1048  const unsigned int row_begin = Arow_indices[i];
1049  const unsigned int row_end = Arow_indices[i + 1];
1050  unsigned int k = row_begin;
1051  for (auto it = indices[i].begin(); it != indices[i].end(); it++)
1052  {
1053  Acol_indices[k] = *it;
1054  Avalues[k] = 0.0;
1055  k++;
1056  }
1057 
1058  indices[i].clear(); //deallocating the memory
1059 
1060  std::sort(&Acol_indices[row_begin], &Acol_indices[row_end]);
1061 
1062  }
1063 
1064  rA.set_filled(indices.size() + 1, nnz);
1065 
1066  // double end_time = OpenMPUtils::GetCurrentTime();
1067  // if (this->mEchoLevel >= 2)
1068  // KRATOS_INFO("BlockBuilderAndSolver") << "construct matrix structure time:" << end_time - begin_time << "\n" << LoggerMessage::Category::STATISTICS;
1069 
1070  }
1071 
1073  LocalSystemMatrixType& rLHS_Contribution,
1074  Element::EquationIdVectorType& rEquationId)
1075  {
1076  unsigned int local_size = rLHS_Contribution.size1();
1077 
1078  for (unsigned int i_local = 0; i_local < local_size; i_local++)
1079  {
1080  unsigned int i_global = rEquationId[i_local];
1081  if (i_global < this->mEquationSystemSize)
1082  {
1083  for (unsigned int j_local = 0; j_local < local_size; j_local++)
1084  {
1085  unsigned int j_global = rEquationId[j_local];
1086  if (j_global < this->mEquationSystemSize)
1087  rA(i_global, j_global) += rLHS_Contribution(i_local, j_local);
1088  }
1089  }
1090  }
1091  }
1092 
1093 
1095  const LocalSystemVectorType& rRHS_Contribution,
1096  const Element::EquationIdVectorType& rEquationId)
1097  {
1098  unsigned int local_size = rRHS_Contribution.size();
1099 
1100  if(this->mOptions.IsNot(LocalFlagType::COMPUTE_REACTIONS))
1101  {
1102  for (unsigned int i_local = 0; i_local < local_size; i_local++)
1103  {
1104  const unsigned int i_global = rEquationId[i_local];
1105 
1106  if (i_global < this->mEquationSystemSize) //free dof
1107  {
1108  // ASSEMBLING THE SYSTEM VECTOR
1109  double& b_value = rb[i_global];
1110  const double& rhs_value = rRHS_Contribution[i_local];
1111 
1112 #pragma omp atomic
1113  b_value += rhs_value;
1114  }
1115  }
1116  }
1117  else
1118  {
1119  SystemVectorType& ReactionsVector = *this->mpReactionsVector;
1120  for (unsigned int i_local = 0; i_local < local_size; i_local++)
1121  {
1122  const unsigned int i_global = rEquationId[i_local];
1123 
1124  if (i_global < this->mEquationSystemSize) //free dof
1125  {
1126  // ASSEMBLING THE SYSTEM VECTOR
1127  double& b_value = rb[i_global];
1128  const double& rhs_value = rRHS_Contribution[i_local];
1129 
1130 #pragma omp atomic
1131  b_value += rhs_value;
1132  }
1133  else //fixed dof
1134  {
1135  double& b_value = ReactionsVector[i_global - this->mEquationSystemSize];
1136  const double& rhs_value = rRHS_Contribution[i_local];
1137 
1138 #pragma omp atomic
1139  b_value += rhs_value;
1140  }
1141  }
1142  }
1143  }
1144 
1146  SystemVectorType& rb,
1147  const LocalSystemMatrixType& rLHS_Contribution,
1148  const LocalSystemVectorType& rRHS_Contribution,
1149  const Element::EquationIdVectorType& rEquationId
1150 #ifdef _OPENMP
1151  ,std::vector< omp_lock_t >& lock_array
1152 #endif
1153  )
1154  {
1155  unsigned int local_size = rLHS_Contribution.size1();
1156 
1157  for (unsigned int i_local = 0; i_local < local_size; i_local++)
1158  {
1159  unsigned int i_global = rEquationId[i_local];
1160 
1161  if (i_global < this->mEquationSystemSize)
1162  {
1163 #ifdef _OPENMP
1164  omp_set_lock(&lock_array[i_global]);
1165 #endif
1166  rb[i_global] += rRHS_Contribution(i_local);
1167  for (unsigned int j_local = 0; j_local < local_size; j_local++)
1168  {
1169  unsigned int j_global = rEquationId[j_local];
1170  if (j_global < this->mEquationSystemSize)
1171  {
1172  rA(i_global, j_global) += rLHS_Contribution(i_local, j_local);
1173  }
1174  }
1175 #ifdef _OPENMP
1176  omp_unset_lock(&lock_array[i_global]);
1177 #endif
1178 
1179  }
1180  //note that assembly on fixed rows is not performed here
1181  }
1182  }
1183 
1187 
1191 
1195 
1197 
1198  private:
1201 
1205 
1209 
1213 
1214 
1215  inline void AddUnique(std::vector<std::size_t>& v, const std::size_t& candidate)
1216  {
1217  std::vector<std::size_t>::iterator i = v.begin();
1218  std::vector<std::size_t>::iterator endit = v.end();
1219  while (i != endit && (*i) != candidate)
1220  {
1221  ++i;
1222  }
1223  if (i == endit)
1224  {
1225  v.push_back(candidate);
1226  }
1227 
1228  }
1229 
1233 
1237 
1241 
1245 
1247 
1248 }; // Class ReductionBuilderAndSolver
1250 
1253 
1257 
1258 
1260 
1262 
1263 } // namespace Kratos
1264 
1265 #endif // KRATOS_REDUCTION_BUILDER_AND_SOLVER_H_INCLUDED defined
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
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
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
ptr_iterator ptr_begin()
Returns an iterator pointing to the beginning of the underlying data container.
Definition: pointer_vector_set.h:386
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
typename TContainerType::iterator ptr_iterator
Definition: pointer_vector_set.h:104
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Definition: reduction_builder_and_solver.hpp:55
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: reduction_builder_and_solver.hpp:693
void BuildRHS(SchemePointerType pScheme, ModelPart &rModelPart, SystemVectorType &rb) override
Function to perform the build of the RHS.
Definition: reduction_builder_and_solver.hpp:187
BaseType::Pointer BasePointerType
Definition: reduction_builder_and_solver.hpp:64
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: reduction_builder_and_solver.hpp:455
ModelPart::ElementsContainerType ElementsContainerType
Definition: reduction_builder_and_solver.hpp:77
int Check(ModelPart &rModelPart) override
Definition: reduction_builder_and_solver.hpp:861
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: reduction_builder_and_solver.hpp:409
KRATOS_CLASS_POINTER_DEFINITION(ReductionBuilderAndSolver)
Pointer definition of ReductionBuilderAndSolver.
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: reduction_builder_and_solver.hpp:78
void ApplyDirichletConditions(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
applies the dirichlet conditions.
Definition: reduction_builder_and_solver.hpp:477
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: reduction_builder_and_solver.hpp:841
~ReductionBuilderAndSolver() override
Destructor.
Definition: reduction_builder_and_solver.hpp:113
BaseType::SystemVectorType SystemVectorType
Definition: reduction_builder_and_solver.hpp:70
void SystemSolve(SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
This is a call to the linear system solver.
Definition: reduction_builder_and_solver.hpp:375
void Assemble(SystemMatrixType &rA, SystemVectorType &rb, const LocalSystemMatrixType &rLHS_Contribution, const LocalSystemVectorType &rRHS_Contribution, const Element::EquationIdVectorType &rEquationId)
Definition: reduction_builder_and_solver.hpp:1145
void SystemSolveWithPhysics(SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb, ModelPart &rModelPart)
Definition: reduction_builder_and_solver.hpp:906
BaseType::LocalFlagType LocalFlagType
Definition: reduction_builder_and_solver.hpp:66
void BuildLHS(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA) override
Function to perform the building of the LHS,.
Definition: reduction_builder_and_solver.hpp:130
ModelPart::NodesContainerType NodesContainerType
Definition: reduction_builder_and_solver.hpp:76
BaseType::LinearSolverPointerType LinearSolverPointerType
Definition: reduction_builder_and_solver.hpp:81
BaseType::SchemePointerType SchemePointerType
Definition: reduction_builder_and_solver.hpp:80
void AssembleLHS(SystemMatrixType &rA, LocalSystemMatrixType &rLHS_Contribution, Element::EquationIdVectorType &rEquationId)
Definition: reduction_builder_and_solver.hpp:1072
BaseType::SystemMatrixType SystemMatrixType
Definition: reduction_builder_and_solver.hpp:69
BaseType::SystemVectorPointerType SystemVectorPointerType
Definition: reduction_builder_and_solver.hpp:72
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: reduction_builder_and_solver.hpp:73
ReductionBuilderAndSolver(LinearSolverPointerType pLinearSystemSolver)
Default Constructor.
Definition: reduction_builder_and_solver.hpp:107
void CalculateReactions(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rDx, SystemVectorType &rb) override
Calculates system reactions.
Definition: reduction_builder_and_solver.hpp:812
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: reduction_builder_and_solver.hpp:489
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: reduction_builder_and_solver.hpp:74
void SetUpSystem() override
organises the dofset in order to speed up the building phase
Definition: reduction_builder_and_solver.hpp:668
void Build(SchemePointerType pScheme, ModelPart &rModelPart, SystemMatrixType &rA, SystemVectorType &rb) override
Function to perform the build of the RHS.
Definition: reduction_builder_and_solver.hpp:270
void AssembleRHS(SystemVectorType &rb, const LocalSystemVectorType &rRHS_Contribution, const Element::EquationIdVectorType &rEquationId)
Definition: reduction_builder_and_solver.hpp:1094
virtual void ConstructMatrixStructure(SchemePointerType pScheme, SystemMatrixType &rA, ElementsContainerType &rElements, ConditionsContainerType &rConditions, ProcessInfo &rCurrentProcessInfo)
Definition: reduction_builder_and_solver.hpp:944
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: reduction_builder_and_solver.hpp:794
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: reduction_builder_and_solver.hpp:762
BaseType::SystemMatrixPointerType SystemMatrixPointerType
Definition: reduction_builder_and_solver.hpp:71
BaseType::DofsArrayType DofsArrayType
Definition: reduction_builder_and_solver.hpp:67
SolutionBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: reduction_builder_and_solver.hpp:63
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
SystemVectorPointerType mpReactionsVector
Definition: solution_builder_and_solver.hpp:485
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
Flags mOptions
Definition: solution_builder_and_solver.hpp:476
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
virtual int GetEchoLevel()
Definition: solution_builder_and_solver.hpp:395
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
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
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
integer i
Definition: TensorModule.f:17
Definition: reduction_builder_and_solver.hpp:95
size_t operator()(const Node::DofType::Pointer &it1, const Node::DofType::Pointer &it2) const
Definition: reduction_builder_and_solver.hpp:96
Definition: reduction_builder_and_solver.hpp:84
size_t operator()(const Node::DofType::Pointer &it) const
Definition: reduction_builder_and_solver.hpp:85