Ice Sheet System Model  4.18
Code documentation
Functions
Reduceloadx.cpp File Reference
#include "./Reduceloadx.h"
#include "../../shared/io/io.h"

Go to the source code of this file.

Functions

void Reduceloadx (Vector< IssmDouble > *pf, Matrix< IssmDouble > *Kfs, Vector< IssmDouble > *y_s, bool flag_ys0)
 

Function Documentation

◆ Reduceloadx()

void Reduceloadx ( Vector< IssmDouble > *  pf,
Matrix< IssmDouble > *  Kfs,
Vector< IssmDouble > *  y_s,
bool  flag_ys0 
)

Definition at line 14 of file Reduceloadx.cpp.

14  {
15 
16  /*intermediary*/
17  Vector<IssmDouble>* y_s0 = NULL;
18  Vector<IssmDouble>* Kfsy_s = NULL;
19  int Kfsm,Kfsn;
20  int global_m,global_n;
21  bool fromlocalsize = true;
22  bool oldalloc = false;
23 
24  if(VerboseModule()) _printf0_(" Dirichlet lifting applied to load vector\n");
25 
26  Kfs->GetSize(&global_m,&global_n);
27  if(pf && global_m*global_n){
28 
29  /*Some checks in debugging mode*/
30  _assert_(y_s);
31 
32  /*pf = pf - Kfs * y_s;*/
33  Kfs->GetLocalSize(&Kfsm,&Kfsn);
34  if(oldalloc)
35  Kfsy_s=new Vector<IssmDouble>(Kfsm,fromlocalsize);
36  else
37  Kfsy_s=new Vector<IssmDouble>(Kfsm,global_m);
38 
39  if (flag_ys0){
40 
41  /*Create y_s0, full of 0: */
42  y_s0=y_s->Duplicate();
43  y_s0->Set(0.0);
44  y_s0->Assemble();
45 
46  Kfs->MatMult(y_s0,Kfsy_s);
47  }
48  else{
49  Kfs->MatMult(y_s,Kfsy_s);
50  }
51 
52  pf->AXPY(Kfsy_s,-1.);
53  }
54 
55  /*Free ressources and return*/
56  delete y_s0;
57  delete Kfsy_s;
58 
59 }
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
Vector::Duplicate
Vector< doubletype > * Duplicate(void)
Definition: Vector.h:230
Matrix::MatMult
void MatMult(Vector< doubletype > *X, Vector< doubletype > *AX)
Definition: Matrix.h:239
VerboseModule
bool VerboseModule(void)
Definition: Verbosity.cpp:23
Vector::AXPY
void AXPY(Vector *X, doubletype a)
Definition: Vector.h:256
Matrix::GetLocalSize
void GetLocalSize(int *pM, int *pN)
Definition: Matrix.h:226
Vector::Assemble
void Assemble(void)
Definition: Vector.h:142
Vector< IssmDouble >
Matrix::GetSize
void GetSize(int *pM, int *pN)
Definition: Matrix.h:213
Vector::Set
void Set(doubletype value)
Definition: Vector.h:245