14 #if !defined(KRATOS_SPACE_H_INCLUDED )
15 #define KRATOS_SPACE_H_INCLUDED
53 template <
class TDataType,
class TMatrixType,
class TVectorType>
58 template <
class TDataType>
61 template <
class TDataType>
80 template<
class TDataType,
class TMatrixType,
class TVectorType>
165 template<
typename TColumnType>
168 if (rX.size() != rM.size1())
169 rX.resize(rM.size1(),
false);
178 template<
typename TColumnType>
205 return rX.inner_prod(rY);
213 return std::sqrt(rX.inner_prod(rX));
243 TDataType row_sum = TDataType();
246 row_sum += std::abs(rA(
i,
j));
254 TDataType aux_sum = TDataType();
271 axpy_prod(rA, rX, rY,
true);
280 template<
class TOtherMatrixType >
284 rA.TransposeSpMV(rY,rX);
295 std::vector<IndexType>& neighbors)
370 rA.resize(
m,
n,
false);
375 pA->resize(
m,
n,
false);
385 pX->resize(
n,
false);
391 pA->resize(0, 0,
false);
397 pX->resize(0,
false);
400 template<
class TOtherMatrixType>
403 KRATOS_ERROR <<
"cannot be implemented with CsrMatrix" << std::endl;
417 std::fill(rX.begin(), rX.end(), TDataType());
420 template<
class TOtherMatrixType>
423 rA.SetValue(TDataType());
433 rX.SetValue(TDataType());
436 template<
class TOtherMatrixType,
class TEquationIdVectorType>
439 TOtherMatrixType& LHS_Contribution,
440 TEquationIdVectorType& EquationId
443 A.Assemble(
A,LHS_Contribution,EquationId);
462 virtual std::string
Info()
const
464 return "KratosSpace";
471 rOStream <<
"KratosSpace";
500 pValues[
i] =
x[IndexArray[
i]];
505 template<
class TOtherMatrixType >
512 template<
class VectorType >
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: csr_matrix.h:60
Kratos::span< TDataType > & value_data()
Definition: csr_matrix.h:273
IndexType size1() const
Definition: csr_matrix.h:240
void SetValue(const TDataType value)
Definition: csr_matrix.h:232
void SpMV(const TInputVectorType &x, TOutputVectorType &y) const
Definition: csr_matrix.h:411
TDataType NormFrobenius() const
Definition: csr_matrix.h:494
Kratos::span< IndexType > & index2_data()
Definition: csr_matrix.h:269
Kratos::span< IndexType > & index1_data()
Definition: csr_matrix.h:265
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: distributed_csr_matrix.h:58
TDataType NormFrobenius() const
Definition: distributed_csr_matrix.h:559
Utility class to update the values of degree of freedom (Dof) variables after solving the system.
Definition: dof_updater.h:40
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
Definition: amatrix_interface.h:41
Short class definition.
Definition: kratos_space.h:82
static TDataType GetValue(const VectorType &x, IndexType LocalI)
Definition: kratos_space.h:489
static void ScaleAndAdd(const double A, const VectorType &rX, const double B, const VectorType &rY, VectorType &rZ)
Definition: kratos_space.h:336
static void GraphNeighbors(IndexType i, const CsrMatrix< TDataType > &rA, std::vector< IndexType > &neighbors)
Definition: kratos_space.h:293
static void ResizeData(VectorType &rX, SizeType m)
Definition: kratos_space.h:414
Kratos::shared_ptr< TVectorType > VectorPointerType
Definition: kratos_space.h:101
virtual std::string Info() const
Turn back information as a string.
Definition: kratos_space.h:462
static void GatherValues(const VectorType &x, const std::vector< IndexType > &IndexArray, TDataType *pValues)
Definition: kratos_space.h:495
static void UnaliasedAdd(VectorType &rX, const double A, const VectorType &rY)
Definition: kratos_space.h:329
static void Assign(VectorType &rX, const double A, const VectorType &rY)
Definition: kratos_space.h:318
static IndexType Size2(MatrixType const &rM)
return number of columns of rM
Definition: kratos_space.h:158
static void ResizeData(CsrMatrix< TDataType > &rA, SizeType m)
Definition: kratos_space.h:407
TVectorType VectorType
Definition: kratos_space.h:94
static IndexType Size(VectorType const &rV)
return size of vector rV
Definition: kratos_space.h:144
static void SetValue(VectorType &rX, IndexType local_i, TDataType value)
Definition: kratos_space.h:357
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: kratos_space.h:469
Kratos::shared_ptr< TMatrixType > MatrixPointerType
Definition: kratos_space.h:100
DofUpdater< KratosSpace< TDataType, TMatrixType, TVectorType > > DofUpdaterType
Definition: kratos_space.h:103
static DofUpdaterPointerType CreateDofUpdater()
Definition: kratos_space.h:519
static VectorPointerType CreateEmptyVectorPointer()
Definition: kratos_space.h:137
static SizeType GraphDegree(IndexType i, const CsrMatrix< TDataType > &rA)
Definition: kratos_space.h:287
TMatrixType MatrixType
Definition: kratos_space.h:92
static void TransposeMult(TOtherMatrixType &rA, VectorType &rX, VectorType &rY)
Definition: kratos_space.h:281
static TDataType TwoNorm(const CsrMatrix< TDataType > &rA)
Definition: kratos_space.h:222
static constexpr bool IsDistributed()
Definition: kratos_space.h:482
static void SetToZero(CsrMatrix< TDataType > &rA)
Definition: kratos_space.h:426
static void Copy(MatrixType const &rX, MatrixType &rY)
rY = rX
Definition: kratos_space.h:189
static void Set(VectorType &rX, TDataType A)
rX = A
Definition: kratos_space.h:363
static void SetToZero(TOtherMatrixType &rA)
Definition: kratos_space.h:421
static TDataType Dot(VectorType const &rX, VectorType const &rY)
rX * rY
Definition: kratos_space.h:203
virtual ~KratosSpace()
Destructor.
Definition: kratos_space.h:118
static void Resize(MatrixPointerType &pA, SizeType m, SizeType n)
Definition: kratos_space.h:373
static TDataType TwoNorm(const Matrix &rA)
Definition: kratos_space.h:216
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: kratos_space.h:476
static void Clear(MatrixPointerType &pA)
Definition: kratos_space.h:388
static bool WriteMatrixMarketMatrix(const char *pFileName, TOtherMatrixType &rM, const bool Symmetric)
Definition: kratos_space.h:506
KRATOS_CLASS_POINTER_DEFINITION(KratosSpace)
Pointer definition of KratosSpace.
static void Mult(const Matrix &rA, VectorType &rX, VectorType &rY)
Definition: kratos_space.h:269
static void Clear(VectorPointerType &pX)
Definition: kratos_space.h:394
static TDataType TwoNorm(VectorType const &rX)
||rX||2
Definition: kratos_space.h:211
static void Resize(VectorPointerType &pX, SizeType n)
Definition: kratos_space.h:383
static double RowDot(unsigned int i, MatrixType &rA, VectorType &rX)
rA[i] * rX
Definition: kratos_space.h:351
static void Mult(const CsrMatrix< TDataType > &rA, VectorType &rX, VectorType &rY)
Definition: kratos_space.h:274
static void SetColumn(unsigned int j, Matrix &rM, TColumnType &rX)
Definition: kratos_space.h:179
static TDataType TwoNorm(const DistributedCsrMatrix< TDataType > &rA)
Definition: kratos_space.h:228
DofUpdaterType::UniquePointer DofUpdaterPointerType
Definition: kratos_space.h:104
static void InplaceMult(VectorType &rX, const double A)
Definition: kratos_space.h:308
std::size_t SizeType
Definition: kratos_space.h:98
static IndexType Size1(MatrixType const &rM)
return number of rows of rM
Definition: kratos_space.h:151
static void Resize(MatrixType &rA, SizeType m, SizeType n)
Definition: kratos_space.h:368
static void GetColumn(unsigned int j, Matrix &rM, TColumnType &rX)
rXi = rMij
Definition: kratos_space.h:166
static void ScaleAndAdd(const double A, const VectorType &rX, const double B, VectorType &rY)
Definition: kratos_space.h:342
static TDataType JacobiNorm(const CsrMatrix< TDataType > &rA)
Definition: kratos_space.h:252
static bool WriteMatrixMarketVector(const char *pFileName, const VectorType &rV)
Definition: kratos_space.h:513
KratosSpace()
Default constructor.
Definition: kratos_space.h:112
static void AssembleLHS(MatrixType &A, TOtherMatrixType &LHS_Contribution, TEquationIdVectorType &EquationId)
Definition: kratos_space.h:437
std::size_t IndexType
Definition: kratos_space.h:96
static void SetToZero(VectorType &rX)
Definition: kratos_space.h:431
TDataType DataType
Definition: kratos_space.h:90
static TDataType JacobiNorm(const Matrix &rA)
Definition: kratos_space.h:238
static void Copy(VectorType const &rX, VectorType &rY)
rY = rX
Definition: kratos_space.h:196
static void Resize(VectorType &rX, SizeType n)
Definition: kratos_space.h:378
static MatrixPointerType CreateEmptyMatrixPointer()
Definition: kratos_space.h:132
static void ResizeData(TOtherMatrixType &rA, SizeType m)
Definition: kratos_space.h:401
utility function to do a sum reduction
Definition: reduction_utilities.h:68
Provides a SystemVector which implements FEM assemble capabilities, as well as some vector operations...
Definition: system_vector.h:61
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void AtomicAdd(TDataType &target, const TDataType &value)
Definition: atomic_utilities.h:55
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
bool WriteMatrixMarketVector(const char *FileName, VectorType &V)
Definition: matrix_market_interface.h:539
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
bool WriteMatrixMarketMatrix(const char *FileName, CompressedMatrixType &M, bool Symmetric)
Definition: matrix_market_interface.h:308
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
TExpressionType::data_type norm_frobenius(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:687
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 k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int m
Definition: run_marine_rain_substepping.py:8
A
Definition: sensitivityMatrix.py:70
x
Definition: sensitivityMatrix.py:49
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17