Go to the documentation of this file.
30 template<
class Form,
class Type>
36 v_[0] =
new Type[n_*m_];
38 for (
label i=1; i<n_; i++)
48 template<
class Form,
class Type>
61 template<
class Form,
class Type>
71 <<
"bad n, m " << n_ <<
", " << m_
79 template<
class Form,
class Type>
89 <<
"bad n, m " << n_ <<
", " << m_
101 for (
label i=0; i<nm; i++)
109 template<
class Form,
class Type>
120 const Type* av = a.v_[0];
123 for (
label i=0; i<nm; i++)
131 template<
class Form,
class Type>
145 template<
class Form,
class Type>
161 template<
class Form,
class Type>
167 for (
label i=0; i<
n(); i++)
169 for (
label j=0; j<m(); j++)
181 template<
class Form,
class Type>
189 for (
label i=0; i<nm; i++)
198 template<
class Form,
class Type>
204 <<
"attempted assignment to self"
208 if (n_ != a.n_ || m_ != a.m_)
219 const Type* av = a.v_[0];
222 for (
label i=0; i<nm; i++)
232 template<
class Form,
class Type>
240 const Type* v = a[0];
242 for (
label i=1; i<nm; i++)
244 if (v[i] > v[curMaxI])
264 template<
class Form,
class Type>
272 const Type* v = a[0];
274 for (
label i=1; i<nm; i++)
276 if (v[i] < v[curMinI])
298 template<
class Form,
class Type>
301 Form na(a.
n(), a.
m());
306 const Type* av = a[0];
309 for (
label i=0; i<nm; i++)
319 template<
class Form,
class Type>
325 <<
"attempted add matrices with different number of rows: "
326 << a.
n() <<
", " <<
b.n()
333 <<
"attempted add matrices with different number of columns: "
334 << a.
m() <<
", " <<
b.m()
338 Form ab(a.
n(), a.
m());
341 const Type* av = a[0];
342 const Type* bv =
b[0];
345 for (
label i=0; i<nm; i++)
347 abv[i] = av[i] + bv[i];
354 template<
class Form,
class Type>
360 <<
"attempted add matrices with different number of rows: "
361 << a.
n() <<
", " <<
b.n()
368 <<
"attempted add matrices with different number of columns: "
369 << a.
m() <<
", " <<
b.m()
373 Form ab(a.
n(), a.
m());
376 const Type* av = a[0];
377 const Type* bv =
b[0];
380 for (
label i=0; i<nm; i++)
382 abv[i] = av[i] - bv[i];
389 template<
class Form,
class Type>
392 Form sa(a.
n(), a.
m());
397 const Type* av = a[0];
400 for (
label i=0; i<nm; i++)
410 template<
class Form,
class Type>
416 <<
"attempted to multiply incompatible matrices:" <<
nl
417 <<
"Matrix A : " << a.
n() <<
" rows, " << a.
m() <<
" columns" <<
nl
418 <<
"Matrix B : " <<
b.n() <<
" rows, " <<
b.m() <<
" columns" <<
nl
419 <<
"In order to multiply matrices, columns of A must equal "
424 Form ab(a.
n(),
b.m(), scalar(0));
426 for (
label i = 0; i < ab.n(); i++)
428 for (
label j = 0; j < ab.m(); j++)
430 for (
label l = 0; l <
b.n(); l++)
432 ab[i][j] += a[i][l]*
b[l][j];
label m() const
Return the number of columns.
void allocate()
Allocate the storage for the row-pointers and the data.
label n() const
Return the number of rows.
simpleMatrix< scalar > A(Nc)
A templated 2D matrix of objects of <T>, where the n x m matrix dimensions are known and used for sub...
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
void operator=(const Matrix< Form, Type > &)
Assignment operator. Takes linear time.
void clear()
Clear the Matrix, i.e. set sizes to zero.
errorManip< error > abort(error &err)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tmp< fvMatrix< Type > > operator*(const DimensionedField< scalar, volMesh > &, const fvMatrix< Type > &)
Form T() const
Return the transpose of the matrix.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label n_
Number of rows and columns in Matrix.
Type **__restrict__ v_
Row pointers.
Matrix()
Null constructor.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< fvMatrix< Type > > operator+(const fvMatrix< Type > &, const fvMatrix< Type > &)
void transfer(Matrix< Form, Type > &)
Transfer the contents of the argument Matrix into this Matrix.