 |
Ice Sheet System Model
4.18
Code documentation
|
Go to the documentation of this file.
8 #ifndef _ISSM_DENSE_MAT_H_
9 #define _ISSM_DENSE_MAT_H_
16 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
21 #include "../../shared/shared.h"
22 #include "../gsl/gslincludes.h"
38 template <
class doubletype>
61 if(
M*
N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
70 if(
M*
N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
79 if(pM*pN) this->matrix=xNewZeroInit<doubletype>(pM*pN);
83 IssmDenseMat(doubletype* serial_mat,
int pM,
int pN,doubletype sparsity){
89 this->matrix=xNewZeroInit<doubletype>(pM*pN);
90 xMemCpy<doubletype>(this->matrix,serial_mat,pM*pN);
96 IssmDenseMat(
int pM,
int pN,
int connectivity,
int numberofdofspernode){
101 if(
M*
N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
107 xDelete<doubletype>(this->matrix);
116 _printf_(
"IssmDenseMat size " << this->M <<
"-" << this->N <<
"\n");
117 for(
int i=0;i<
M;i++){
118 for(
int j=0;j<
N;j++){
140 for(i=0;i<this->
M;i++){
142 for(j=0;j<this->
N;j++){
143 absolute+=fabs(this->matrix[
N*i+j]);
145 norm=
max(norm,absolute);
151 for(i=0;i<this->
M;i++){
152 for(j=0;j<this->
N;j++){
153 norm+=this->matrix[
N*i+j]*this->matrix[
N*i+j];
194 if(
M!=AXM)
_error_(
"A and AX should have the same number of rows!");
195 if(
N!=XM)
_error_(
"A and X should have the same number of columns!");
200 dummy+= this->matrix[
N*i+j]*X->
vector[j];
217 doubletype* buffer=NULL;
220 buffer=xNew<doubletype>(this->M*this->N);
221 xMemCpy<doubletype>(buffer,this->matrix,this->M*this->N);
232 for(i=0;i<m;i++)
for(j=0;j<n;j++) this->matrix[
N*idxm[i]+idxn[j]]+=values[n*i+j];
235 for(i=0;i<m;i++)
for(j=0;j<n;j++) this->matrix[
N*idxm[i]+idxn[j]]=values[n*i+j];
238 _error_(
"unknown insert mode!");
251 for(
int i=0;i<
M;i++){
252 for(
int j=0;j<
N;j++){
253 this->matrix[
N*i+j] = 0.;
257 #ifndef _HAVE_WRAPPERS_
273 SeqDenseMumpsSolve(uf->
vector,uf->
M,uf->
M, this->matrix,this->M,this->N,this->M, pf->
vector,pf->
M,pf->
M,parameters);
284 default:
_error_(
"No solver available");
293 #endif //#ifndef _ISSM_DENSE_MAT_H_
implementation of an ISSM vector which run serially (1 cpu only), which is made of a fully dense vect...
#define _printf_(StreamArgs)
Declaration of Parameters class.
doubletype * ToSerial(void)
void SetValues(int m, int *idxm, int n, int *idxn, doubletype *values, InsMode mode)
doubletype Norm(NormMode mode)
void GetSize(int *pM, int *pN)
IssmDenseMat(int pM, int pN, doubletype sparsity)
void MatMult(IssmAbsVec< doubletype > *Xin, IssmAbsVec< doubletype > *AXin)
IssmDenseMat< doubletype > * Duplicate(void)
IssmDenseMat(int m, int n, int pM, int pN, int *d_nnz, int *o_nnz)
IssmSeqVec< doubletype > * Duplicate(void)
IssmDenseMat(int pM, int pN, int connectivity, int numberofdofspernode)
IssmAbsVec< IssmDouble > * Solve(IssmAbsVec< IssmDouble > *pfin, Parameters *parameters)
void Convert(MatrixType type)
IssmDenseMat(doubletype *serial_mat, int pM, int pN, doubletype sparsity)
void SeqDenseMumpsSolve(IssmDouble *uf, int uf_M, int uf_n, IssmDouble *Kff, int Kff_M, int Kff_N, int Kff_m, IssmDouble *pf, int pf_M, int pf_m, Parameters *parameters)
#define _error_(StreamArgs)
void DenseGslSolve(IssmPDouble **pX, IssmPDouble *A, IssmPDouble *B, int n)
void GetLocalSize(int *pM, int *pN)
IssmDouble max(IssmDouble a, IssmDouble b)
IssmDenseMat(int pM, int pN)