Ice Sheet System Model  4.18
Code documentation
Functions
AverageOntoPartitionx.h File Reference

header file for averaging dakota responses onto a vertices partition More...

#include "../../classes/classes.h"

Go to the source code of this file.

Functions

void AverageOntoPartitionx (double **paverage, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters, double *vertex_response, double *qmu_part, int npart)
 

Detailed Description

header file for averaging dakota responses onto a vertices partition

Definition in file AverageOntoPartitionx.h.

Function Documentation

◆ AverageOntoPartitionx()

void AverageOntoPartitionx ( double **  paverage,
Elements elements,
Nodes nodes,
Vertices vertices,
Loads loads,
Materials materials,
Parameters parameters,
double *  vertex_response,
double *  qmu_part,
int  npart 
)

Definition at line 16 of file AverageOntoPartitionx.cpp.

16  {
17 
18  /*output: */
19  Vector<IssmDouble>* partition_contributions=NULL;
20  Vector<IssmDouble>* partition_areas=NULL;
21  Vector<IssmDouble>* vec_average=NULL;
22  double* average=NULL;
23 
24  /*average onto the separate areas. The result will be a npart sized vector. */
25 
26  /*allocate: */
27  partition_contributions=new Vector<IssmDouble>(npart);
28  partition_areas=new Vector<IssmDouble>(npart);
29  vec_average=new Vector<IssmDouble>(npart);
30 
31  /*loop on each element, and add contribution of the element to the partition (surface weighted average): */
32  for(int i=0;i<elements->Size();i++){
33  Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
34  element->AverageOntoPartition(partition_contributions,partition_areas,vertex_response,qmu_part);
35  }
36 
37  /*Assemble: */
38  partition_contributions->Assemble();
39  partition_areas->Assemble();
40 
41  /*We have the partition_areas and the partition_contributions for each partition -> compute the surfae weighted average: */
42  vec_average->PointwiseDivide(partition_contributions,partition_areas);
43 
44  /*serialize:*/
45  average=vec_average->ToMPISerial();
46 
47  /*Free ressources:*/
48  delete partition_contributions;
49  delete partition_areas;
50  delete vec_average;
51 
52  /*Assign output pointers:*/
53  *paverage=average;
54 }
DataSet::Size
int Size()
Definition: DataSet.cpp:399
Element
Definition: Element.h:41
Vector::Assemble
void Assemble(void)
Definition: Vector.h:142
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
Vector::PointwiseDivide
void PointwiseDivide(Vector *x, Vector *y)
Definition: Vector.h:378
Vector::ToMPISerial
doubletype * ToMPISerial(void)
Definition: Vector.h:277
Vector< IssmDouble >
Element::AverageOntoPartition
virtual void AverageOntoPartition(Vector< IssmDouble > *partition_contributions, Vector< IssmDouble > *partition_areas, IssmDouble *vertex_response, IssmDouble *qmu_part)=0