21 #include <Epetra_Import.h>
22 #include <Epetra_MpiComm.h>
23 #include <Epetra_Map.h>
24 #include <Epetra_Vector.h>
25 #include <Epetra_FEVector.h>
26 #include <Epetra_FECrsMatrix.h>
27 #include <Epetra_IntSerialDenseVector.h>
28 #include <Epetra_SerialDenseMatrix.h>
29 #include <Epetra_SerialDenseVector.h>
30 #include <EpetraExt_CrsMatrixIn.h>
31 #include <EpetraExt_VectorIn.h>
32 #include <EpetraExt_RowMatrixOut.h>
33 #include <EpetraExt_MultiVectorOut.h>
34 #include <EpetraExt_MatrixMatrix.h>
73 template<
class TMatrixType,
class TVectorType>
153 const int global_elems = 0;
154 Epetra_Map Map(global_elems, 0, rComm);
165 const int global_elems = 0;
166 Epetra_Map Map(global_elems, 0, rComm);
177 const int size = rV.GlobalLength();
188 const int size1 = rM.NumGlobalRows();
199 const int size1 = rM.NumGlobalCols();
212 const unsigned int j,
217 KRATOS_ERROR <<
"GetColumn method is not currently implemented" << std::endl;
260 const int sucess = rY.Dot(rX, &value);
273 const int sucess = rX.MaxValue(&value);
286 const int sucess = rX.MinValue(&value);
300 const int sucess = rX.Norm2(&value);
313 return rA.NormFrobenius();
329 constexpr
bool transpose_flag =
false;
330 const int ierr = rA.Multiply(transpose_flag, rX, rY);
331 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra multiplication failure " << ierr << std::endl;
347 const bool CallFillCompleteOnResult =
true,
348 const bool KeepAllHardZeros =
false
353 constexpr
bool transpose_flag =
false;
355 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra multiplication failure. This may result if A or B are not already Filled, or if errors occur in putting values into C, etc. " << std::endl;
373 constexpr
bool transpose_flag =
true;
374 const int ierr = rA.Multiply(transpose_flag, rX, rY);
375 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra multiplication failure " << ierr << std::endl;
392 const std::pair<bool, bool> TransposeFlag = {
false,
false},
393 const bool CallFillCompleteOnResult =
true,
394 const bool KeepAllHardZeros = false
400 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra multiplication failure. This may result if A or B are not already Filled, or if errors occur in putting values into C, etc. " << std::endl;
418 const bool CallFillCompleteOnResult =
true,
419 const bool KeepAllHardZeros =
false,
420 const bool EnforceInitialGraph =
false
424 std::vector<int> NumNz;
428 TransposeMult(rB, rD, aux_1, {
true,
false}, CallFillCompleteOnResult, KeepAllHardZeros);
431 if (EnforceInitialGraph) {
434 Mult(aux_1, rB, aux_2, CallFillCompleteOnResult, KeepAllHardZeros);
443 std::swap(rA, *aux_3);
449 if (rA.NumGlobalNonzeros() > 0) {
454 Mult(aux_1, rB, *aux_2, CallFillCompleteOnResult, KeepAllHardZeros);
457 std::swap(rA, *aux_2);
463 Mult(aux_1, rB, rA, CallFillCompleteOnResult, KeepAllHardZeros);
481 const bool CallFillCompleteOnResult =
true,
482 const bool KeepAllHardZeros =
false,
483 const bool EnforceInitialGraph =
false
487 std::vector<int> NumNz;
491 Mult(rB, rD, aux_1, CallFillCompleteOnResult, KeepAllHardZeros);
494 if (EnforceInitialGraph) {
497 TransposeMult(aux_1, rB, aux_2, {
false,
true}, CallFillCompleteOnResult, KeepAllHardZeros);
506 std::swap(rA, *aux_3);
512 if (rA.NumGlobalNonzeros() > 0) {
517 TransposeMult(aux_1, rB, *aux_2, {
false,
true}, CallFillCompleteOnResult, KeepAllHardZeros);
520 std::swap(rA, *aux_2);
526 TransposeMult(aux_1, rB, rA, {
false,
true}, CallFillCompleteOnResult, KeepAllHardZeros);
544 const int ierr = rX.Scale(
A);
545 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra scaling failure " << ierr << std::endl;
565 const int ierr = rX.Scale(
A, rY);
566 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra assign failure " << ierr << std::endl;
587 const int ierr = rX.Update(
A, rY, 1.0);
588 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra unaliased add failure " << ierr << std::endl;
608 const int ierr = rZ.Update(
A, rX,
B, rY, 0.0);
609 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra scale and add failure " << ierr << std::endl;
627 const int ierr = rY.Update(
A, rX,
B);
628 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra scale and add failure " << ierr << std::endl;
643 Epetra_IntSerialDenseVector indices(1);
644 Epetra_SerialDenseVector
values(1);
648 int ierr = rX.ReplaceGlobalValues(indices,
values);
651 ierr = rX.GlobalAssemble(Insert,
true);
652 KRATOS_ERROR_IF(ierr < 0) <<
"Epetra failure when attempting to insert value in function SetValue" << std::endl;
666 const int ierr = rX.PutScalar(
A);
667 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra set failure " << ierr << std::endl;
682 KRATOS_ERROR <<
"Resize is not defined for Trilinos Sparse Matrix" << std::endl;
695 KRATOS_ERROR <<
"Resize is not defined for a reference to Trilinos Vector - need to use the version passing a Pointer" << std::endl;
709 int global_elems =
n;
710 Epetra_Map Map(global_elems, 0, pX->Comm());
722 int global_elems = 0;
723 Epetra_Map Map(global_elems, 0, pA->Comm());
736 int global_elems = 0;
737 Epetra_Map Map(global_elems, 0, pX->Comm());
749 const int ierr = rA.PutScalar(0.0);
750 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra set to zero failure " << ierr << std::endl;
759 const int ierr = rX.PutScalar(0.0);
760 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra set to zero failure " << ierr << std::endl;
774 const Matrix& rLHSContribution,
775 const std::vector<std::size_t>& rEquationId
778 const unsigned int system_size =
Size1(rA);
781 unsigned int active_indices = 0;
782 for (
unsigned int i = 0;
i < rEquationId.size();
i++)
783 if (rEquationId[
i] < system_size)
786 if (active_indices > 0) {
788 Epetra_IntSerialDenseVector indices(active_indices);
789 Epetra_SerialDenseMatrix
values(active_indices, active_indices);
792 unsigned int loc_i = 0;
793 for (
unsigned int i = 0;
i < rEquationId.size();
i++) {
794 if (rEquationId[
i] < system_size) {
795 indices[loc_i] = rEquationId[
i];
797 unsigned int loc_j = 0;
798 for (
unsigned int j = 0;
j < rEquationId.size();
j++) {
799 if (rEquationId[
j] < system_size) {
800 values(loc_i, loc_j) = rLHSContribution(
i,
j);
808 const int ierr = rA.SumIntoGlobalValues(indices,
values);
825 const Vector& rRHSContribution,
826 const std::vector<std::size_t>& rEquationId
829 const unsigned int system_size =
Size(rb);
832 unsigned int active_indices = 0;
833 for (
unsigned int i = 0;
i < rEquationId.size();
i++)
834 if (rEquationId[
i] < system_size)
837 if (active_indices > 0) {
839 Epetra_IntSerialDenseVector indices(active_indices);
840 Epetra_SerialDenseVector
values(active_indices);
843 unsigned int loc_i = 0;
844 for (
unsigned int i = 0;
i < rEquationId.size();
i++) {
845 if (rEquationId[
i] < system_size) {
846 indices[loc_i] = rEquationId[
i];
847 values[loc_i] = rRHSContribution[
i];
852 const int ierr = rb.SumIntoGlobalValues(indices,
values);
878 KRATOS_ERROR_IF_NOT(rX.Map().MyGID(
static_cast<int>(I))) <<
" non-local id: " << I <<
"." << std::endl;
881 return rX[0][rX.Map().LID(
static_cast<int>(I))];
892 const std::vector<int>& IndexArray,
897 double tot_size = IndexArray.size();
900 Epetra_Map dof_update_map(-1, tot_size, &(*(IndexArray.begin())), 0, rX.Comm());
903 Epetra_Import importer(dof_update_map, rX.Map());
906 Epetra_Vector
temp(importer.TargetMap());
909 int ierr =
temp.Import(rX, importer, Insert);
912 temp.ExtractCopy(&pValues);
926 Epetra_MpiComm& rComm
931 Epetra_CrsMatrix*
pp =
nullptr;
933 int error_code = EpetraExt::MatrixMarketFileToCrsMatrix(
FileName.c_str(), rComm,
pp);
935 KRATOS_ERROR_IF(error_code != 0) <<
"Eerror thrown while reading Matrix Market file "<<
FileName<<
" error code is : " << error_code;
939 const Epetra_CrsGraph& rGraph =
pp->Graph();
942 IndexType NumMyRows = rGraph.RowMap().NumMyElements();
944 int* MyGlobalElements =
new int[NumMyRows];
945 rGraph.RowMap().MyGlobalElements(MyGlobalElements);
952 std::size_t Length =
pp->NumGlobalEntries(GlobalRow);
954 double* Values =
new double[Length];
955 int* Indices =
new int[Length];
957 error_code =
pp->ExtractGlobalRowCopy(GlobalRow, Length, NumEntries, Values, Indices);
959 KRATOS_ERROR_IF(error_code != 0) <<
"Error thrown in ExtractGlobalRowCopy : " << error_code;
961 error_code = paux->ReplaceGlobalValues(GlobalRow, Length, Values, Indices);
963 KRATOS_ERROR_IF(error_code != 0) <<
"Error thrown in ReplaceGlobalValues : " << error_code;
969 paux->GlobalAssemble();
971 delete [] MyGlobalElements;
985 const std::string& rFileName,
986 Epetra_MpiComm& rComm,
992 Epetra_Map my_map(
N, 0, rComm);
993 Epetra_Vector* pv =
nullptr;
995 int error_code = EpetraExt::MatrixMarketFileToVector(rFileName.c_str(), my_map, pv);
997 KRATOS_ERROR_IF(error_code != 0) <<
"error thrown while reading Matrix Market Vector file " << rFileName <<
" error code is: " << error_code;
1001 IndexType num_my_rows = my_map.NumMyElements();
1002 std::vector<int> gids(num_my_rows);
1003 my_map.MyGlobalElements(gids.data());
1005 std::vector<double>
values(num_my_rows);
1006 pv->ExtractCopy(
values.data());
1009 int ierr = final_vector->ReplaceGlobalValues(gids.size(),gids.data(),
values.data());
1010 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found with code ierr = " << ierr << std::endl;
1012 final_vector->GlobalAssemble();
1015 return final_vector;
1030 KRATOS_ERROR_IF_NOT(rA.RowMap().SameAs(rB.RowMap())) <<
"Row maps are not compatible" << std::endl;
1033 const auto& r_graph_a = rA.Graph();
1034 const auto& r_graph_b = rB.Graph();
1037 KRATOS_ERROR_IF_NOT(r_graph_a.IndicesAreLocal() && r_graph_b.IndicesAreLocal()) <<
"Graphs indexes must be local" << std::endl;
1043 std::unordered_set<int> combined_indexes;
1044 const bool same_col_map = rA.ColMap().SameAs(rB.ColMap());
1045 Epetra_CrsGraph graph = same_col_map ? Epetra_CrsGraph(::
Copy, rA.RowMap(), rA.ColMap(), 1000) : Epetra_CrsGraph(::
Copy, rA.RowMap(), 1000);
1049 for (
i = 0;
i < r_graph_a.NumMyRows();
i++) {
1051 ierr = r_graph_a.ExtractMyRowView(
i, num_entries, cols);
1052 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting indices (I) with code ierr = " << ierr << std::endl;
1053 for (
j = 0;
j < num_entries;
j++) {
1054 combined_indexes.insert(cols[
j]);
1057 ierr = r_graph_b.ExtractMyRowView(
i, num_entries, cols);
1058 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting indices (II) with code ierr = " << ierr << std::endl;
1059 for (
j = 0;
j < num_entries;
j++) {
1060 combined_indexes.insert(cols[
j]);
1063 std::vector<int> combined_indexes_vector(combined_indexes.begin(), combined_indexes.end());
1064 num_entries = combined_indexes_vector.size();
1066 ierr = graph.InsertMyIndices(
i, num_entries, combined_indexes_vector.data());
1067 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure inserting indices with code ierr = " << ierr << std::endl;
1069 combined_indexes.clear();
1072 for (
i = 0;
i < r_graph_a.NumMyRows();
i++) {
1073 const int global_row_index = r_graph_a.GRID(
i);
1075 ierr = r_graph_a.ExtractMyRowView(
i, num_entries, cols);
1076 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting indices (I) with code ierr = " << ierr << std::endl;
1077 for (
j = 0;
j < num_entries;
j++) {
1078 combined_indexes.insert(r_graph_a.GCID(cols[
j]));
1081 std::vector<int> combined_indexes_vector(combined_indexes.begin(), combined_indexes.end());
1082 num_entries = combined_indexes_vector.size();
1084 ierr = graph.InsertGlobalIndices(global_row_index, num_entries, combined_indexes_vector.data());
1085 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure inserting indices with code ierr = " << ierr << std::endl;
1087 combined_indexes.clear();
1089 for (
i = 0;
i < r_graph_b.NumMyRows();
i++) {
1090 const int global_row_index = r_graph_b.GRID(
i);
1092 ierr = r_graph_b.ExtractMyRowView(
i, num_entries, cols);
1093 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting indices (II) with code ierr = " << ierr << std::endl;
1094 for (
j = 0;
j < num_entries;
j++) {
1095 combined_indexes.insert(r_graph_b.GCID(cols[
j]));
1098 std::vector<int> combined_indexes_vector(combined_indexes.begin(), combined_indexes.end());
1099 num_entries = combined_indexes_vector.size();
1101 ierr = graph.InsertGlobalIndices(global_row_index, num_entries, combined_indexes_vector.data());
1102 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure inserting indices with code ierr = " << ierr << std::endl;
1104 combined_indexes.clear();
1109 ierr = graph.FillComplete();
1110 KRATOS_ERROR_IF(ierr < 0) <<
": Epetra failure in Epetra_CrsGraph.FillComplete. Error code: " << ierr << std::endl;
1130 const int rank = rA.Comm().MyPID();
1133 const bool same_col_map = rA.ColMap().SameAs(rB.ColMap());
1136 const auto& r_graph_b = rB.Graph();
1144 for (
i = 0;
i < rB.NumMyRows();
i++) {
1145 ierr = rB.ExtractMyRowView(
i, num_entries, vals, cols);
1146 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting values in local row " <<
i <<
" in rank " << rank <<
" with code ierr = " << ierr << std::endl;
1147 ierr = rA.ReplaceMyValues(
i, num_entries, vals, cols);
1148 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found replacing values in local row " <<
i <<
" in rank " << rank <<
" with code ierr = " << ierr << std::endl;
1151 for (
i = 0;
i < rB.NumMyRows();
i++) {
1152 ierr = rB.ExtractMyRowView(
i, num_entries, vals, cols);
1153 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting values in local row " <<
i <<
" in rank " << rank <<
" with code ierr = " << ierr << std::endl;
1154 const int global_row_index = r_graph_b.GRID(
i);
1155 for (
int j = 0;
j < num_entries;
j++) {
1156 cols[
j] = r_graph_b.GCID(cols[
j]);
1158 ierr = rA.ReplaceGlobalValues(global_row_index, num_entries, vals, cols);
1159 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure found extracting values in global row " << global_row_index <<
" in rank " << rank <<
" with code ierr = " << ierr << std::endl;
1183 const double zero_tolerance = std::numeric_limits<double>::epsilon();
1186 const double scale_factor =
GetScaleNorm(rProcessInfo, rA, ScalingDiagonal);
1188 for (
int i = 0;
i < rA.NumMyRows();
i++) {
1192 rA.ExtractMyRowView(
i, numEntries, vals, cols);
1193 const int row_gid = rA.RowMap().GID(
i);
1196 for (
j = 0;
j < numEntries;
j++) {
1197 const int col_gid = rA.ColMap().GID(cols[
j]);
1199 if (col_gid == row_gid) {
1200 if(std::abs(vals[
j]) > zero_tolerance) {
1209 vals[
j] = scale_factor;
1215 rb.GlobalAssemble();
1216 rA.GlobalAssemble();
1218 return scale_factor;
1238 switch (ScalingDiagonal) {
1242 KRATOS_ERROR_IF_NOT(rProcessInfo.
Has(BUILD_SCALE_FACTOR)) <<
"Scale factor not defined at process info" << std::endl;
1243 return rProcessInfo.
GetValue(BUILD_SCALE_FACTOR);
1265 Epetra_Vector diagonal(rA.RowMap());
1266 const int ierr = rA.ExtractDiagonalCopy(diagonal);
1267 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure extracting diagonal " << ierr << std::endl;
1297 Epetra_Vector diagonal(rA.RowMap());
1298 const int ierr = rA.ExtractDiagonalCopy(diagonal);
1299 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure extracting diagonal " << ierr << std::endl;
1314 Epetra_Vector diagonal(rA.RowMap());
1315 const int ierr = rA.ExtractDiagonalCopy(diagonal);
1316 KRATOS_ERROR_IF(ierr != 0) <<
"Epetra failure extracting diagonal " << ierr << std::endl;
1350 return "TrilinosSpace";
1359 rOStream <<
"TrilinosSpace";
1377 template<
class TOtherMatrixType >
1379 const char* pFileName,
1380 const TOtherMatrixType& rM,
1381 const bool Symmetric
1386 return EpetraExt::RowMatrixToMatrixMarketFile(pFileName, rM);
1396 template<
class VectorType >
1398 const char* pFileName,
1403 return EpetraExt::MultiVectorToMatrixMarketFile(pFileName, rV);
1414 return tmp.Create();
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Utility class to update the values of degree of freedom (Dof) variables after solving the system.
Definition: dof_updater.h:40
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Utility class to update the values of degree of freedom (Dof) variables after solving the system.
Definition: trilinos_dof_updater.h:39
The space adapted for Trilinos vectors and matrices.
Definition: trilinos_space.h:75
static void BDBtProductOperation(MatrixType &rA, const MatrixType &rD, const MatrixType &rB, const bool CallFillCompleteOnResult=true, const bool KeepAllHardZeros=false, const bool EnforceInitialGraph=false)
Calculates the product operation BDB'.
Definition: trilinos_space.h:477
static void Clear(VectorPointerType &pX)
Clears a vector.
Definition: trilinos_space.h:733
static void SetToZero(VectorType &rX)
Sets a vector to zero.
Definition: trilinos_space.h:757
static void SetValue(VectorType &rX, IndexType i, const double value)
Sets a value in a vector.
Definition: trilinos_space.h:637
static void AssembleLHS(MatrixType &rA, const Matrix &rLHSContribution, const std::vector< std::size_t > &rEquationId)
TODO: creating the the calculating reaction version.
Definition: trilinos_space.h:772
static double GetValue(const VectorType &rX, const std::size_t I)
This function returns a value from a given vector according to a given index.
Definition: trilinos_space.h:872
static void Resize(VectorPointerType &pX, const SizeType n)
Resizes a vector.
Definition: trilinos_space.h:703
TVectorType VectorType
Definition of the vector type.
Definition: trilinos_space.h:90
typename Kratos::shared_ptr< TMatrixType > MatrixPointerType
Definition of the pointer types.
Definition: trilinos_space.h:99
typename Kratos::shared_ptr< TVectorType > VectorPointerType
Definition: trilinos_space.h:100
std::size_t IndexType
Definition of the index type.
Definition: trilinos_space.h:93
virtual std::string Info() const
Turn back information as a string.
Definition: trilinos_space.h:1348
static double Dot(const VectorType &rX, const VectorType &rY)
Returns the product of two vectors.
Definition: trilinos_space.h:254
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: trilinos_space.h:1357
static constexpr bool IsDistributed()
This function returns if we are in a distributed system.
Definition: trilinos_space.h:861
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: trilinos_space.h:1366
static void Copy(const MatrixType &rX, MatrixType &rY)
Returns a copy of the matrix rX.
Definition: trilinos_space.h:226
static void ScaleAndAdd(const double A, const VectorType &rX, const double B, VectorType &rY)
Returns the unaliased addition of two vectors by a scalar.
Definition: trilinos_space.h:620
static void BtDBProductOperation(MatrixType &rA, const MatrixType &rD, const MatrixType &rB, const bool CallFillCompleteOnResult=true, const bool KeepAllHardZeros=false, const bool EnforceInitialGraph=false)
Calculates the product operation B'DB.
Definition: trilinos_space.h:414
static void GatherValues(const VectorType &rX, const std::vector< int > &IndexArray, double *pValues)
This function gathers the values of a given vector according to a given index array.
Definition: trilinos_space.h:890
TrilinosSpace()
Default constructor.
Definition: trilinos_space.h:111
static Epetra_CrsGraph CombineMatricesGraphs(const MatrixType &rA, const MatrixType &rB)
Generates a graph combining the graphs of two matrices.
Definition: trilinos_space.h:1024
static void Resize(MatrixType &rA, const SizeType m, const SizeType n)
Resizes a matrix.
Definition: trilinos_space.h:676
static double Min(const VectorType &rX)
Returns the minimum value of the vector rX.
Definition: trilinos_space.h:283
static IndexType Size2(MatrixType const &rM)
Returns number of columns of rM.
Definition: trilinos_space.h:197
KRATOS_CLASS_POINTER_DEFINITION(TrilinosSpace)
Pointer definition of TrilinosSpace.
static double GetMaxDiagonal(const MatrixType &rA)
This method returns the diagonal max value.
Definition: trilinos_space.h:1293
static double GetAveragevalueDiagonal(const MatrixType &rA)
This method returns the diagonal max value.
Definition: trilinos_space.h:1279
MatrixPointerType ReadMatrixMarket(const std::string FileName, Epetra_MpiComm &rComm)
Read a matrix from a MatrixMarket file.
Definition: trilinos_space.h:924
static double GetMinDiagonal(const MatrixType &rA)
This method returns the diagonal min value.
Definition: trilinos_space.h:1310
static void CopyMatrixValues(MatrixType &rA, const MatrixType &rB)
Copy values from one matrix to another.
Definition: trilinos_space.h:1121
static void Resize(VectorType &rX, const SizeType n)
Resizes a vector.
Definition: trilinos_space.h:690
static bool WriteMatrixMarketVector(const char *pFileName, const VectorType &rV)
Writes a vector to a file in MatrixMarket format.
Definition: trilinos_space.h:1397
std::size_t SizeType
Definition of the size type.
Definition: trilinos_space.h:96
static double GetScaleNorm(const ProcessInfo &rProcessInfo, const MatrixType &rA, const SCALING_DIAGONAL ScalingDiagonal=SCALING_DIAGONAL::NO_SCALING)
This method returns the scale norm considering for scaling the diagonal.
Definition: trilinos_space.h:1230
static MatrixPointerType CreateEmptyMatrixPointer()
This method creates an empty pointer to a matrix.
Definition: trilinos_space.h:132
static void TransposeMult(const MatrixType &rA, const MatrixType &rB, MatrixType &rC, const std::pair< bool, bool > TransposeFlag={false, false}, const bool CallFillCompleteOnResult=true, const bool KeepAllHardZeros=false)
Returns the transpose multiplication matrix-matrix.
Definition: trilinos_space.h:388
static void Set(VectorType &rX, const DataType A)
assigns a scalar to a vector
Definition: trilinos_space.h:661
static void ScaleAndAdd(const double A, const VectorType &rX, const double B, const VectorType &rY, VectorType &rZ)
Returns the unaliased addition of two vectors by a scalar.
Definition: trilinos_space.h:600
static double CheckAndCorrectZeroDiagonalValues(const ProcessInfo &rProcessInfo, MatrixType &rA, VectorType &rb, const SCALING_DIAGONAL ScalingDiagonal=SCALING_DIAGONAL::NO_SCALING)
This method checks and corrects the zero diagonal values.
Definition: trilinos_space.h:1173
double DataType
Definition of the data type.
Definition: trilinos_space.h:84
static bool WriteMatrixMarketMatrix(const char *pFileName, const TOtherMatrixType &rM, const bool Symmetric)
Writes a matrix to a file in MatrixMarket format.
Definition: trilinos_space.h:1378
static double GetDiagonalNorm(const MatrixType &rA)
This method returns the diagonal norm considering for scaling the diagonal.
Definition: trilinos_space.h:1261
static void Mult(const MatrixType &rA, const MatrixType &rB, MatrixType &rC, const bool CallFillCompleteOnResult=true, const bool KeepAllHardZeros=false)
Returns the multiplication matrix-matrix.
Definition: trilinos_space.h:343
static void Assign(VectorType &rX, const double A, const VectorType &rY)
Returns the multiplication of a vector by a scalar.
Definition: trilinos_space.h:558
static void Clear(MatrixPointerType &pA)
Clears a matrix.
Definition: trilinos_space.h:719
VectorPointerType ReadMatrixMarketVector(const std::string &rFileName, Epetra_MpiComm &rComm, const int N)
Read a vector from a MatrixMarket file.
Definition: trilinos_space.h:984
static void TransposeMult(const MatrixType &rA, const VectorType &rX, VectorType &rY)
Returns the transpose multiplication of a matrix by a vector.
Definition: trilinos_space.h:367
static VectorPointerType CreateEmptyVectorPointer(Epetra_MpiComm &rComm)
This method creates an empty pointer to a vector using epetra communicator.
Definition: trilinos_space.h:163
static void Mult(const MatrixType &rA, const VectorType &rX, VectorType &rY)
Returns the multiplication of a matrix by a vector.
Definition: trilinos_space.h:323
static IndexType Size1(MatrixType const &rM)
Returns number of rows of rM.
Definition: trilinos_space.h:186
static constexpr bool IsDistributedSpace()
Check if the TrilinosSpace is distributed.
Definition: trilinos_space.h:1327
static void InplaceMult(VectorType &rX, const double A)
Returns the multiplication of a vector by a scalar.
Definition: trilinos_space.h:538
static double TwoNorm(const VectorType &rX)
Returns the norm of the vector rX.
Definition: trilinos_space.h:297
typename DofUpdater< TrilinosSpace< TMatrixType, TVectorType > >::UniquePointer DofUpdaterPointerType
Definition: trilinos_space.h:104
static void UnaliasedAdd(VectorType &rX, const double A, const VectorType &rY)
Returns the unaliased addition of a vector by a scalar times a vector.
Definition: trilinos_space.h:581
TMatrixType MatrixType
Definition of the matrix type.
Definition: trilinos_space.h:87
virtual ~TrilinosSpace()
Destructor.
Definition: trilinos_space.h:116
static void Copy(const VectorType &rX, VectorType &rY)
Returns a copy of the vector rX.
Definition: trilinos_space.h:240
static VectorPointerType CreateEmptyVectorPointer()
This method creates an empty pointer to a vector.
Definition: trilinos_space.h:141
static void AssembleRHS(VectorType &rb, const Vector &rRHSContribution, const std::vector< std::size_t > &rEquationId)
TODO: creating the the calculating reaction version.
Definition: trilinos_space.h:823
static double TwoNorm(const MatrixType &rA)
Returns the Frobenius norm of the matrix rX.
Definition: trilinos_space.h:311
static double Max(const VectorType &rX)
Returns the maximum value of the vector rX.
Definition: trilinos_space.h:270
static IndexType Size(const VectorType &rV)
Returns size of vector rV.
Definition: trilinos_space.h:175
static DofUpdaterPointerType CreateDofUpdater()
Creates a new dof updater.
Definition: trilinos_space.h:1411
static void SetToZero(MatrixType &rA)
Sets a matrix to zero.
Definition: trilinos_space.h:747
static MatrixPointerType CreateEmptyMatrixPointer(Epetra_MpiComm &rComm)
This method creates an empty pointer to a matrix using epetra communicator.
Definition: trilinos_space.h:151
static void GetColumn(const unsigned int j, const MatrixType &rM, VectorType &rX)
Returns the column of the matrix in the given position.
Definition: trilinos_space.h:211
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
string FileName
Export to vtk.
Definition: GenerateWind.py:175
PolynomialType Multiply(const PolynomialType &rA, const PolynomialType &rB)
Definition: polynomial_utilities.cpp:102
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
SCALING_DIAGONAL
Definition: ublas_space.h:98
@ CONSIDER_PRESCRIBED_DIAGONAL
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
pp
Definition: all_t_win_vs_m_fixed_error.py:140
list values
Definition: bombardelli_test.py:42
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
int m
Definition: run_marine_rain_substepping.py:8
A
Definition: sensitivityMatrix.py:70
N
Definition: sensitivityMatrix.py:29
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17