14 #if !defined(KRATOS_TRILINOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER )
15 #define KRATOS_TRILINOS_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER
23 #include "Epetra_Map.h"
24 #include "Epetra_Vector.h"
25 #include "Epetra_FECrsGraph.h"
26 #include "Epetra_FECrsMatrix.h"
27 #include "Epetra_IntSerialDenseVector.h"
28 #include "Epetra_SerialDenseMatrix.h"
29 #include "Epetra_SerialDenseVector.h"
30 #include "Epetra_MpiComm.h"
37 #if !defined(START_TIMER)
38 #define START_TIMER(label, rank) \
39 if (mrComm.MyPID() == rank) \
42 #if !defined(STOP_TIMER)
43 #define STOP_TIMER(label, rank) \
44 if (mrComm.MyPID() == rank) \
111 template<
class TSparseSpace,
158 Epetra_MpiComm& Comm,
160 typename TLinearSolver::Pointer pNewLinearSystemSolver)
161 :
BuilderAndSolver< TSparseSpace,TDenseSpace,TLinearSolver >(pNewLinearSystemSolver)
192 typename TSchemeType::Pointer pScheme,
222 for (
typename ElementsArrayType::ptr_iterator it=pElements.ptr_begin(); it!=pElements.ptr_end(); ++it)
225 pScheme->CalculateSystemContributions(**it,LHS_Contribution,RHS_Contribution,EquationId,CurrentProcessInfo);
233 TSparseSpace::AssembleLHS(
A,LHS_Contribution,EquationId);
234 TSparseSpace::AssembleRHS(
b,RHS_Contribution,EquationId);
237 LHS_Contribution.resize(0,0,
false);
238 RHS_Contribution.resize(0,
false);
241 for (
typename ConditionsArrayType::ptr_iterator it=ConditionsArray.ptr_begin(); it!=ConditionsArray.ptr_end(); ++it)
244 pScheme->CalculateSystemContributions(**it,LHS_Contribution,RHS_Contribution,EquationId,CurrentProcessInfo);
247 TSparseSpace::AssembleLHS(
A,LHS_Contribution,EquationId);
248 TSparseSpace::AssembleRHS(
b,RHS_Contribution,EquationId);
267 typename TSchemeType::Pointer pScheme,
292 for (
typename ElementsArrayType::ptr_iterator it=pElements.ptr_begin(); it!=pElements.ptr_end(); ++it)
295 pScheme->CalculateLHSContribution(**it,LHS_Contribution,EquationId,CurrentProcessInfo);
298 TSparseSpace::AssembleLHS(
A,LHS_Contribution,EquationId);
301 LHS_Contribution.resize(0,0,
false);
304 for (
typename ConditionsArrayType::ptr_iterator it=ConditionsArray.ptr_begin(); it!=ConditionsArray.ptr_end(); ++it)
307 pScheme->CalculateLHSContribution(**it,LHS_Contribution,EquationId,CurrentProcessInfo);
310 TSparseSpace::AssembleLHS(
A,LHS_Contribution,EquationId);
352 TSparseSpace::SetToZero(Dx);
368 typename TSchemeType::Pointer pScheme,
379 Build(pScheme,rModelPart,rA,rb);
388 <<
"\nBefore the solution of the system"
389 <<
"\nSystem Matrix = " << rA <<
"\nunknowns vector = " << rDx
390 <<
"\nRHS vector = " << rb << std::endl;
401 <<
"\nAfter the solution of the system"
402 <<
"\nSystem Matrix = " << rA <<
"\nUnknowns vector = " << rDx
403 <<
"\nRHS vector = " << rb << std::endl;
411 typename TSchemeType::Pointer pScheme,
428 typename TSchemeType::Pointer pScheme,
453 for (
typename ElementsArrayType::ptr_iterator it=pElements.ptr_begin(); it!=pElements.ptr_end(); ++it)
456 pScheme->CalculateRHSContribution(**it,RHS_Contribution,EquationId,CurrentProcessInfo);
459 TSparseSpace::AssembleRHS(
b,RHS_Contribution,EquationId);
462 RHS_Contribution.resize(0,
false);
465 for (
typename ConditionsArrayType::ptr_iterator it=ConditionsArray.ptr_begin(); it!=ConditionsArray.ptr_end(); ++it)
468 pScheme->CalculateRHSContribution(**it,RHS_Contribution,EquationId,CurrentProcessInfo);
471 TSparseSpace::AssembleRHS(
b,RHS_Contribution,EquationId);
483 typename TSchemeType::Pointer pScheme,
501 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
503 for (
typename ElementsArrayType::ptr_iterator it=pElements.ptr_begin(); it!=pElements.ptr_end(); ++it)
506 pScheme->GetDofList(**it,ElementalDofList,CurrentProcessInfo);
508 for (
typename Element::DofsVectorType::iterator
i = ElementalDofList.begin() ;
i != ElementalDofList.end() ; ++
i)
516 for (
typename ConditionsArrayType::ptr_iterator it=pConditions.ptr_begin(); it!=pConditions.ptr_end(); ++it)
519 pScheme->GetDofList(**it,ElementalDofList,CurrentProcessInfo);
521 for (
typename Element::DofsVectorType::iterator
i = ElementalDofList.begin() ;
i != ElementalDofList.end() ; ++
i)
535 MPI_Comm_size(MPI_COMM_WORLD, &nprocessors);
538 std::vector< std::vector<unsigned int> > local_gids(nprocessors);
539 std::vector< std::vector<unsigned int> > local_ndofs(nprocessors);
540 std::vector< std::vector<unsigned int> > local_keys(nprocessors);
541 std::vector< std::vector<unsigned int> > remote_gids(nprocessors);
542 std::vector< std::vector<unsigned int> > remote_ndofs(nprocessors);
543 std::vector< std::vector<unsigned int> > remote_keys(nprocessors);
544 std::vector< int > aux_index(nprocessors,-1);
548 int previous_node_id = -1;
552 int partition_index = dof_iterator->GetSolutionStepValue(PARTITION_INDEX);
553 if(partition_index != rank)
555 if (previous_node_id !=
static_cast<int>(dof_iterator->Id()) || previous_node_id !=
static_cast<int>(dof_iterator->Id()))
558 previous_node_id = dof_iterator->Id();
559 local_gids[partition_index].push_back(previous_node_id);
560 local_ndofs[partition_index].push_back(1);
561 local_keys[partition_index].push_back(dof_iterator->GetVariable().Key());
562 aux_index[partition_index]+=1;
566 local_ndofs[partition_index][aux_index[partition_index]] += 1;
567 local_keys[partition_index].push_back(dof_iterator->GetVariable().Key());
573 for (
unsigned int i_color = 0; i_color < r_model_part.
GetCommunicator().NeighbourIndices().size(); i_color++)
576 if (destination >= 0)
579 int send_tag = i_color;
580 int receive_tag = i_color;
582 int remote_gids_size;
583 int local_gids_size = local_gids[destination].size();
584 MPI_Sendrecv(&local_gids_size, 1, MPI_INT, destination, send_tag, &remote_gids_size, 1, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
585 remote_gids[destination].resize(remote_gids_size);
586 remote_ndofs[destination].resize(remote_gids_size);
589 MPI_Sendrecv(local_gids[destination].
data(), local_gids[destination].size(), MPI_INT, destination, send_tag, remote_gids[destination].
data(), remote_gids_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
592 MPI_Sendrecv(local_ndofs[destination].
data(), local_ndofs[destination].size(), MPI_INT, destination, send_tag, remote_ndofs[destination].
data(), remote_gids_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
595 int remote_keys_size;
596 int local_keys_size = local_keys[destination].size();
597 MPI_Sendrecv(&local_keys_size, 1, MPI_INT, destination, send_tag, &remote_keys_size, 1, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
598 remote_keys[destination].resize(remote_keys_size);
601 MPI_Sendrecv(local_keys[destination].
data(), local_keys[destination].size(), MPI_INT, destination, send_tag, remote_keys[destination].
data(), remote_keys_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
605 for (
int i_color=0; i_color<nprocessors; i_color++)
607 for (
unsigned int i=0;
i<remote_gids[i_color].size();
i++)
610 ModelPart::NodesContainerType::iterator it = r_model_part.
Nodes().find(remote_gids[i_color][
i]);
613 std::cout <<
"rank = "<< rank <<
" while communicating with " << i_color << std::endl;
614 KRATOS_THROW_ERROR(std::logic_error,
"attempting to find an inexisting node with id",remote_gids[i_color][
i] )
616 for (
unsigned int idof=0; idof<remote_ndofs[i_color][
i]; idof++)
618 unsigned int key = remote_keys[i_color][
counter++];
620 Node::DofsContainerType::iterator i_dof;
621 for (i_dof = it->GetDofs().begin() ; i_dof != it->GetDofs().end() ; i_dof++)
622 if ((*i_dof)->GetVariable().Key() == key)
624 if(i_dof == it->GetDofs().end())
627 Doftemp.
push_back( i_dof.base()->get() );
634 for (
int i_color = 0; i_color < nprocessors; i_color++)
636 local_gids[i_color].resize(0);
637 local_gids[i_color].clear();
638 local_ndofs[i_color].resize(0);
639 local_ndofs[i_color].clear();
640 local_keys[i_color].resize(0);
641 local_keys[i_color].clear();
647 for (
unsigned int i_color = 0; i_color < r_model_part.
GetCommunicator().NeighbourIndices().size(); i_color++)
650 if (destination >= 0)
652 previous_node_id = -1;
659 if (previous_node_id !=
static_cast<int>(dof_iterator->Id()) )
661 if(rLocalInterfaceNodes.find(dof_iterator->Id()) != rLocalInterfaceNodes.end() )
663 previous_node_id = dof_iterator->Id();
664 local_gids[destination].
push_back(previous_node_id);
665 local_ndofs[destination].push_back(1);
666 local_keys[destination].push_back(dof_iterator->GetVariable().Key());
672 local_ndofs[destination][
i] += 1;
673 local_keys[destination].push_back(dof_iterator->GetVariable().Key());
680 for (
unsigned int i_color = 0; i_color < r_model_part.
GetCommunicator().NeighbourIndices().size(); i_color++)
683 if (destination >= 0)
686 int send_tag = i_color;
687 int receive_tag = i_color;
689 int remote_gids_size;
690 int local_gids_size = local_gids[destination].size();
691 MPI_Sendrecv(&local_gids_size, 1, MPI_INT, destination, send_tag, &remote_gids_size, 1, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
692 remote_gids[destination].resize(remote_gids_size);
693 remote_ndofs[destination].resize(remote_gids_size);
696 MPI_Sendrecv(local_gids[destination].
data(), local_gids[destination].size(), MPI_INT, destination, send_tag, remote_gids[destination].
data(), remote_gids_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
699 MPI_Sendrecv(local_ndofs[destination].
data(), local_ndofs[destination].size(), MPI_INT, destination, send_tag, remote_ndofs[destination].
data(), remote_gids_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
702 int remote_keys_size;
703 int local_keys_size = local_keys[destination].size();
704 MPI_Sendrecv(&local_keys_size, 1, MPI_INT, destination, send_tag, &remote_keys_size, 1, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
705 remote_keys[destination].resize(remote_keys_size);
709 MPI_Sendrecv(local_keys[destination].
data(), local_keys[destination].size(), MPI_INT, destination, send_tag, remote_keys[destination].
data(), remote_keys_size, MPI_INT, destination, receive_tag,MPI_COMM_WORLD, &status);
715 for (
int i_color=0; i_color<nprocessors; i_color++)
717 for (
unsigned int i=0;
i<remote_gids[i_color].size();
i++)
720 ModelPart::NodesContainerType::iterator it = r_model_part.
Nodes().find(remote_gids[i_color][
i]);
723 std::cout <<
"rank = "<< rank <<
" while communicating with " << i_color << std::endl;
724 KRATOS_THROW_ERROR(std::logic_error,
"attempting to find an inexisting node with id",remote_gids[i_color][
i] )
726 for (
unsigned int idof=0; idof<remote_ndofs[i_color][
i]; idof++)
728 unsigned int key = remote_keys[i_color][
counter++];
730 Node::DofsContainerType::iterator i_dof;
731 for (i_dof = it->GetDofs().begin() ; i_dof != it->GetDofs().end() ; i_dof++)
732 if ((*i_dof)->GetVariable().Key() == key)
735 Doftemp.
push_back( i_dof.base()->get() );
765 KRATOS_ERROR_IF_NOT(dof_iterator->HasReaction()) <<
"Reaction variable not set for the following : " <<std::endl
766 <<
"Node : "<<dof_iterator->Id()<< std::endl
767 <<
"Dof : "<<(*dof_iterator)<<std::endl<<
"Not possible to calculate reactions."<<std::endl;
796 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
800 if (dof_iterator->GetSolutionStepValue(PARTITION_INDEX) == rank)
802 if (dof_iterator->IsFixed())
814 MPI_Scan(&free_size, &free_offset, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
817 MPI_Allreduce(&free_size, &global_size, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
820 MPI_Scan(&fixed_size, &fixed_offset, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
823 free_offset -= free_size;
825 fixed_offset += global_size - fixed_size;
832 std::cout << rank <<
" : free_id = " << free_size << std::endl;
833 std::cout << rank <<
" : fixed_size = " << fixed_size << std::endl;
834 std::cout << rank <<
" : free_offset = " << free_offset << std::endl;
835 std::cout << rank <<
" : fixed offset = " << fixed_offset << std::endl;
841 if (dof_iterator->GetSolutionStepValue(PARTITION_INDEX) == rank)
843 if (dof_iterator->IsFixed())
844 dof_iterator->SetEquationId(fixed_offset++);
846 dof_iterator->SetEquationId(free_offset++);
852 mLocalSystemSize = free_size;
859 std::cout << rank <<
" : mLocalSystemSize = " << mLocalSystemSize << std::endl;
860 std::cout << rank <<
" : free_offset = " << free_offset << std::endl;
861 std::cout << rank <<
" : fixed_offset = " << fixed_offset << std::endl;
914 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
925 for (
unsigned int i_domain = 0 ; i_domain < neighbours_indices.size() ; i_domain++)
926 if ((destination = neighbours_indices[i_domain]) >= 0)
929 unsigned int send_buffer_size = 0;
930 unsigned int receive_buffer_size = 0;
942 for (
typename NodesArrayType::iterator i_node = r_interface_nodes.begin(); i_node != r_interface_nodes.end(); ++i_node)
943 send_buffer_size += i_node->GetDofs().
size();
946 for (
typename NodesArrayType::iterator i_node = r_ghost_nodes.begin(); i_node != r_ghost_nodes.end(); ++i_node)
947 if (i_node->GetSolutionStepValue(PARTITION_INDEX) == destination)
949 receive_buffer_size += i_node->GetDofs().size();
955 unsigned int position = 0;
956 int* send_buffer =
new int[send_buffer_size];
957 int* receive_buffer =
new int[receive_buffer_size];
961 std::cout << rank <<
" : Filling the buffer...." << std::endl;
963 for (ModelPart::NodeType::DofsContainerType::iterator i_dof = i_node->GetDofs().begin() ; i_dof != i_node->GetDofs().end() ; i_dof++)
965 send_buffer[position++] = (*i_dof)->EquationId();
1006 if (position > send_buffer_size)
1007 std::cout << rank <<
" Error in estimating send buffer size...." << std::endl;
1011 int receive_tag = 1;
1029 MPI_Sendrecv (send_buffer, send_buffer_size, MPI_INT, destination, send_tag, receive_buffer, receive_buffer_size, MPI_INT, destination, receive_tag,
1030 MPI_COMM_WORLD, &status);
1040 if (i_node->GetSolutionStepValue(PARTITION_INDEX) == destination)
1041 for (ModelPart::NodeType::DofsContainerType::iterator i_dof = i_node->GetDofs().begin() ; i_dof != i_node->GetDofs().end() ; i_dof++)
1043 (*i_dof)->SetEquationId(receive_buffer[position++]);
1052 if (position > receive_buffer_size)
1053 std::cout << rank <<
" Error in estimating receive buffer size...." << std::endl;
1055 delete [] send_buffer;
1056 delete [] receive_buffer;
1064 typename TSchemeType::Pointer pScheme,
1073 std::cout <<
"entering ResizeAndInitializeVectors" << std::endl;
1081 int temp_size = number_of_local_dofs;
1082 if (temp_size <1000) temp_size = 1000;
1083 int*
temp =
new int[temp_size];
1084 int* assembling_temp =
new int[temp_size];
1088 for (
unsigned int i=0;
i!=number_of_local_dofs;
i++)
1090 Epetra_Map my_map(-1, number_of_local_dofs,
temp, 0,
mrComm);
1092 auto& rElements = rModelPart.
Elements();
1102 for (
typename ElementsArrayType::ptr_iterator it=rElements.ptr_begin(); it!=rElements.ptr_end(); ++it)
1104 pScheme->EquationId( **it, EquationId, CurrentProcessInfo );
1107 unsigned int num_active_indices = 0;
1108 for (
unsigned int i=0;
i<EquationId.size();
i++)
1112 assembling_temp[num_active_indices] = EquationId[
i];
1113 num_active_indices += 1;
1117 if (num_active_indices != 0)
1119 int ierr = Agraph.InsertGlobalIndices(num_active_indices,assembling_temp,num_active_indices, assembling_temp);
1120 KRATOS_ERROR_IF( ierr < 0 ) <<
"In " << __FILE__ <<
":" << __LINE__ <<
": Epetra failure in Graph.InsertGlobalIndices. Error code: " << ierr << std::endl;
1125 for (
typename ConditionsArrayType::ptr_iterator it=rConditions.ptr_begin(); it!=rConditions.ptr_end(); ++it)
1127 pScheme->EquationId( **it, EquationId, CurrentProcessInfo );
1130 unsigned int num_active_indices = 0;
1131 for (
unsigned int i=0;
i<EquationId.size();
i++)
1135 assembling_temp[num_active_indices] = EquationId[
i];
1136 num_active_indices += 1;
1140 if (num_active_indices != 0)
1142 int ierr = Agraph.InsertGlobalIndices(num_active_indices,assembling_temp,num_active_indices, assembling_temp);
1143 KRATOS_ERROR_IF( ierr < 0 ) <<
"In " << __FILE__ <<
":" << __LINE__ <<
": Epetra failure in Graph.InsertGlobalIndices. Error code: " << ierr << std::endl;
1148 int ierr = Agraph.GlobalAssemble();
1149 KRATOS_ERROR_IF( ierr != 0 ) <<
"In " << __FILE__ <<
":" << __LINE__ <<
": Epetra failure in Graph.GlobalAssemble, Error code: " << ierr << std::endl;
1173 delete [] assembling_temp;
1179 KRATOS_THROW_ERROR(std::logic_error,
"it should not come here resizing is not allowed this way!!!!!!!! ... ",
"");
1186 KRATOS_THROW_ERROR(std::logic_error,
"calculation of reactions not yet implemented with Trilinos",
"");
1220 typename TSchemeType::Pointer pScheme,
1250 typename TSchemeType::Pointer pScheme,
1254 KRATOS_THROW_ERROR(std::logic_error,
"method BuildLHS_CompleteOnFreeRows not implemented in Trilinos Builder And Solver ",
"");
1260 typename TSchemeType::Pointer pScheme,
1339 unsigned int mLocalSystemSize;
1352 void AssembleLHS_CompleteOnFreeRows(
1358 KRATOS_THROW_ERROR(std::logic_error,
"This method is not implemented for Trilinos",
"");
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
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
ModelPart::NodesContainerType NodesArrayType
The containers of the entities.
Definition: builder_and_solver.h:109
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
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: builder_and_solver.h:111
TSystemVectorPointerType mpReactionsVector
Definition: builder_and_solver.h:751
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
bool mCalculateReactionsFlag
Flag taking care if the dof set was initialized ot not.
Definition: builder_and_solver.h:745
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
unsigned int mEquationSystemSize
Flag taking in account if it is needed or not to calculate the reactions.
Definition: builder_and_solver.h:747
ModelPart::ElementsContainerType ElementsArrayType
Definition: builder_and_solver.h:110
NeighbourIndicesContainerType & NeighbourIndices()
Definition: communicator.cpp:162
MeshType & GhostMesh()
Returns the reference to the mesh storing all ghost entities.
Definition: communicator.cpp:251
virtual bool SynchronizeDofs()
Definition: communicator.cpp:352
MeshType & LocalMesh()
Returns the reference to the mesh storing all local entities.
Definition: communicator.cpp:245
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
NodesContainerType & Nodes()
Definition: mesh.h:346
NodeIterator NodesEnd()
Definition: mesh.h:336
NodeIterator NodesBegin()
Definition: mesh.h:326
ElementsContainerType & Elements()
Definition: mesh.h:568
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
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
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
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
void Unique()
Remove duplicate elements from the set.
Definition: pointer_vector_set.h:764
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 push_back(TPointerType x)
Adds a pointer to the end of the set.
Definition: pointer_vector_set.h:544
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
iterator 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
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
Definition: trilinos_elimination_builder_and_solver.h:117
void ResizeAndInitializeVectors(typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &pA, TSystemVectorPointerType &pDx, TSystemVectorPointerType &pb, ModelPart &rModelPart) override
This method initializes and resizes the system of equations.
Definition: trilinos_elimination_builder_and_solver.h:1063
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: trilinos_elimination_builder_and_solver.h:367
void Build(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &b) override
equivalent (but generally faster) then performing BuildLHS and BuildRHS
Definition: trilinos_elimination_builder_and_solver.h:191
int mLastMyId
Definition: trilinos_elimination_builder_and_solver.h:1300
void BuildRHS(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemVectorType &b) override
Function to perform the build of the RHS. The vector could be sized as the total number of dofs or as...
Definition: trilinos_elimination_builder_and_solver.h:427
BaseType::TSystemMatrixType TSystemMatrixType
Definition: trilinos_elimination_builder_and_solver.h:134
void SetUpDofSet(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: trilinos_elimination_builder_and_solver.h:482
void UpdateGhostDofs(ModelPart &rThisModelPart)
Definition: trilinos_elimination_builder_and_solver.h:911
void SetUpSystem(ModelPart &r_model_part) override
It organises the dofset in order to speed up the building phase.
Definition: trilinos_elimination_builder_and_solver.h:780
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: trilinos_elimination_builder_and_solver.h:138
KRATOS_CLASS_POINTER_DEFINITION(TrilinosResidualBasedEliminationBuilderAndSolver)
void BuildRHSAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Corresponds to the previews, but the System's matrix is considered already built and only the RHS is ...
Definition: trilinos_elimination_builder_and_solver.h:410
int mguess_row_size
Definition: trilinos_elimination_builder_and_solver.h:1298
BaseType::ElementsContainerType ElementsContainerType
Definition: trilinos_elimination_builder_and_solver.h:148
BaseType::TSchemeType TSchemeType
Definition: trilinos_elimination_builder_and_solver.h:128
Epetra_MpiComm & mrComm
Definition: trilinos_elimination_builder_and_solver.h:1297
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: trilinos_elimination_builder_and_solver.h:142
void ApplyDirichletConditions(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
It applies the dirichlet conditions. This operation may be very heavy or completely unexpensive depen...
Definition: trilinos_elimination_builder_and_solver.h:1259
BaseType::NodesArrayType NodesArrayType
Definition: trilinos_elimination_builder_and_solver.h:144
virtual ~TrilinosResidualBasedEliminationBuilderAndSolver()
Definition: trilinos_elimination_builder_and_solver.h:181
BaseType::ElementsArrayType ElementsArrayType
Definition: trilinos_elimination_builder_and_solver.h:145
BaseType::TDataType TDataType
Definition: trilinos_elimination_builder_and_solver.h:130
void InitializeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
It applies certain operations at the system of equations at the beginning of the solution step.
Definition: trilinos_elimination_builder_and_solver.h:1196
BaseType::TSystemVectorType TSystemVectorType
Definition: trilinos_elimination_builder_and_solver.h:136
TSparseSpace SparseSpaceType
Definition: trilinos_elimination_builder_and_solver.h:126
void SystemSolveWithPhysics(TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b, ModelPart &rModelPart)
Definition: trilinos_elimination_builder_and_solver.h:323
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: trilinos_elimination_builder_and_solver.h:141
BaseType::ConditionsArrayType ConditionsArrayType
Definition: trilinos_elimination_builder_and_solver.h:146
void BuildLHS(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A) override
Function to perform the building of the LHS, depending on the implementation chosen the size of the m...
Definition: trilinos_elimination_builder_and_solver.h:266
void CalculateReactions(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
It computes the reactions of the system.
Definition: trilinos_elimination_builder_and_solver.h:1219
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: trilinos_elimination_builder_and_solver.h:124
void BuildLHS_CompleteOnFreeRows(typename TSchemeType::Pointer pScheme, ModelPart &r_model_part, TSystemMatrixType &A) override
It builds a rectangular matrix of size n*N where "n" is the number of unrestrained degrees of freedom...
Definition: trilinos_elimination_builder_and_solver.h:1249
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: trilinos_elimination_builder_and_solver.h:140
BaseType::DofsArrayType DofsArrayType
Definition: trilinos_elimination_builder_and_solver.h:132
TrilinosResidualBasedEliminationBuilderAndSolver(Epetra_MpiComm &Comm, int guess_row_size, typename TLinearSolver::Pointer pNewLinearSystemSolver)
Definition: trilinos_elimination_builder_and_solver.h:157
void FinalizeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
It applies certain operations at the system of equations at the end of the solution step.
Definition: trilinos_elimination_builder_and_solver.h:1208
int mFirstMyId
Definition: trilinos_elimination_builder_and_solver.h:1299
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#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
TSpaceType::IndexType Size1(TSpaceType &dummy, typename TSpaceType::MatrixType const &rM)
Definition: add_strategies_to_python.cpp:117
TSpaceType::IndexType Size2(TSpaceType &dummy, typename TSpaceType::MatrixType const &rM)
Definition: add_strategies_to_python.cpp:123
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
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
data
Definition: mesh_to_mdpa_converter.py:59
float temp
Definition: rotating_cone.py:85
int counter
Definition: script_THERMAL_CORRECT.py:218
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17
#define STOP_TIMER(label, rank)
Definition: trilinos_elimination_builder_and_solver.h:43
#define START_TIMER(label, rank)
Definition: trilinos_elimination_builder_and_solver.h:38