Loading...
Searching...
No Matches
FDMLinearSystem3.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_FDM_LINEAR_SYSTEM3_HPP
12#define CUBBYFLOW_FDM_LINEAR_SYSTEM3_HPP
13
14#include <Core/Array/Array.hpp>
17
18namespace CubbyFlow
19{
22{
24 double center = 0.0;
25
27 double right = 0.0;
28
30 double up = 0.0;
31
33 double front = 0.0;
34};
35
38
41
44{
46 void Clear();
47
49 void Resize(const Vector3UZ& size);
50
53
56
59};
60
76
79{
83
86
88 static void Set(const VectorType& v, VectorType* result);
89
92
94 static void Set(const MatrixType& m, MatrixType* result);
95
97 static double Dot(const VectorType& a, const VectorType& b);
98
101 static void AXPlusY(double a, const VectorType& x, const VectorType& y,
103
105 static void MVM(const MatrixType& m, const VectorType& v,
107
109 static void Residual(const MatrixType& a, const VectorType& x,
110 const VectorType& b, VectorType* result);
111
114
117};
118
121{
125
128
130 static void Set(const VectorType& v, VectorType* result);
131
134
136 static void Set(const MatrixType& m, MatrixType* result);
137
139 static double Dot(const VectorType& a, const VectorType& b);
140
143 static void AXPlusY(double a, const VectorType& x, const VectorType& y,
145
147 static void MVM(const MatrixType& m, const VectorType& v,
149
151 static void Residual(const MatrixType& a, const VectorType& x,
152 const VectorType& b, VectorType* result);
153
156
159};
160} // namespace CubbyFlow
161
162#endif
Definition Matrix.hpp:30
Definition pybind11Utils.hpp:21
VectorN< double > VectorND
Definition Matrix.hpp:832
MatrixCSR< double > MatrixCSRD
Double-type CSR matrix.
Definition MatrixCSR.hpp:448
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738
Array3< FDMMatrixRow3 > FDMMatrix3
Matrix type for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:40
Array3< double > FDMVector3
Vector type for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:37
BLAS operator wrapper for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:79
static ScalarType LInfNorm(const VectorType &v)
Returns Linf-norm of the given vector v.
static void Set(const MatrixType &m, MatrixType *result)
Copies entire element of given matrix result with other matrix v.
static double Dot(const VectorType &a, const VectorType &b)
Performs dot product with vector a and b.
static void Set(ScalarType s, VectorType *result)
Sets entire element of given vector result with scalar s.
static void Set(ScalarType s, MatrixType *result)
Sets entire element of given matrix result with scalar s.
static void MVM(const MatrixType &m, const VectorType &v, VectorType *result)
Performs matrix-vector multiplication.
static ScalarType L2Norm(const VectorType &v)
Returns L2-norm of the given vector v.
static void Residual(const MatrixType &a, const VectorType &x, const VectorType &b, VectorType *result)
Computes residual vector (b - ax).
static void AXPlusY(double a, const VectorType &x, const VectorType &y, VectorType *result)
static void Set(const VectorType &v, VectorType *result)
Copies entire element of given vector result with other vector v.
BLAS operator wrapper for compressed 3-D finite differencing.
Definition FDMLinearSystem3.hpp:121
static void AXPlusY(double a, const VectorType &x, const VectorType &y, VectorType *result)
static void Residual(const MatrixType &a, const VectorType &x, const VectorType &b, VectorType *result)
Computes residual vector (b - ax).
static void Set(ScalarType s, VectorType *result)
Sets entire element of given vector result with scalar s.
static void MVM(const MatrixType &m, const VectorType &v, VectorType *result)
Performs matrix-vector multiplication.
static ScalarType LInfNorm(const VectorType &v)
Returns Linf-norm of the given vector v.
static void Set(const VectorType &v, VectorType *result)
Copies entire element of given vector result with other vector v.
static ScalarType L2Norm(const VectorType &v)
Returns L2-norm of the given vector v.
static void Set(const MatrixType &m, MatrixType *result)
Copies entire element of given matrix result with other matrix v.
static double Dot(const VectorType &a, const VectorType &b)
Performs dot product with vector a and b.
static void Set(ScalarType s, MatrixType *result)
Sets entire element of given matrix result with scalar s.
Compressed linear system (Ax=b) for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:63
VectorND b
RHS vector.
Definition FDMLinearSystem3.hpp:74
VectorND x
Solution vector.
Definition FDMLinearSystem3.hpp:71
MatrixCSRD A
System matrix.
Definition FDMLinearSystem3.hpp:68
void Clear()
Clears all the data.
Linear system (Ax=b) for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:44
void Clear()
Clears all the data.
FDMMatrix3 A
System matrix.
Definition FDMLinearSystem3.hpp:52
FDMVector3 b
RHS vector.
Definition FDMLinearSystem3.hpp:58
FDMVector3 x
Solution vector.
Definition FDMLinearSystem3.hpp:55
void Resize(const Vector3UZ &size)
Resizes the arrays with given grid size.
The row of FDMMatrix3 where row corresponds to (i, j, k) grid point.
Definition FDMLinearSystem3.hpp:22
double front
OFf-diagonal element where column refers to (i, j, k+1) grid point.
Definition FDMLinearSystem3.hpp:33
double right
Off-diagonal element where column refers to (i+1, j, k) grid point.
Definition FDMLinearSystem3.hpp:27
double center
Diagonal component of the matrix (row, row).
Definition FDMLinearSystem3.hpp:24
double up
Off-diagonal element where column refers to (i, j+1, k) grid point.
Definition FDMLinearSystem3.hpp:30