Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
Massfluxatgate< doubletype > Class Template Reference

#include <Massfluxatgate.h>

Inheritance diagram for Massfluxatgate< doubletype >:
Object Definition

Public Member Functions

 Massfluxatgate ()
 
 Massfluxatgate (char *in_name, int in_definitionenum, int in_numsegments, doubletype *in_segments)
 
 Massfluxatgate (char *in_name, int in_definitionenum, int in_numsegments, doubletype *in_x1, doubletype *in_y1, doubletype *in_x2, doubletype *in_y2, int *in_elements)
 
 ~Massfluxatgate ()
 
Objectcopy ()
 
void DeepEcho (void)
 
void Echo (void)
 
int Id (void)
 
int ObjectEnum (void)
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int DefinitionEnum ()
 
char * Name ()
 
IssmDouble Response (FemModel *femmodel)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
- Public Member Functions inherited from Definition
virtual ~Definition ()
 

Data Fields

int definitionenum
 
char * name
 
int numsegments
 
doubletype * x1
 
doubletype * y1
 
doubletype * x2
 
doubletype * y2
 
int * elements
 

Detailed Description

template<class doubletype>
class Massfluxatgate< doubletype >

Definition at line 18 of file Massfluxatgate.h.

Constructor & Destructor Documentation

◆ Massfluxatgate() [1/3]

template<class doubletype >
Massfluxatgate< doubletype >::Massfluxatgate ( )
inline

Definition at line 32 of file Massfluxatgate.h.

32  {/*{{{*/
33  this->definitionenum = -1;
34  this->name = 0;
35  this->numsegments = 0;
36  this->segments = 0;
37  }

◆ Massfluxatgate() [2/3]

template<class doubletype >
Massfluxatgate< doubletype >::Massfluxatgate ( char *  in_name,
int  in_definitionenum,
int  in_numsegments,
doubletype *  in_segments 
)
inline

Definition at line 39 of file Massfluxatgate.h.

39  {/*{{{*/
40 
41  int i;
42 
43  this->definitionenum=in_definitionenum;
44 
45  this->name = xNew<char>(strlen(in_name)+1);
46  xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
47 
48  this->numsegments=in_numsegments;
49 
50  if(this->numsegments){
51  this->x1=xNew<doubletype>(this->numsegments);
52  this->x2=xNew<doubletype>(this->numsegments);
53  this->y1=xNew<doubletype>(this->numsegments);
54  this->y2=xNew<doubletype>(this->numsegments);
55  this->elements=xNew<int>(this->numsegments);
56 
57  for(i=0;i<this->numsegments;i++){
58  this->x1[i]=in_segments[5*i+0];
59  this->y1[i]=in_segments[5*i+1];
60  this->x2[i]=in_segments[5*i+2];
61  this->y2[i]=in_segments[5*i+3];
62  this->elements[i]=reCast<int,doubletype>(in_segments[5*i+4]);
63  }
64  }
65  }

◆ Massfluxatgate() [3/3]

template<class doubletype >
Massfluxatgate< doubletype >::Massfluxatgate ( char *  in_name,
int  in_definitionenum,
int  in_numsegments,
doubletype *  in_x1,
doubletype *  in_y1,
doubletype *  in_x2,
doubletype *  in_y2,
int *  in_elements 
)
inline

Definition at line 67 of file Massfluxatgate.h.

67  {/*{{{*/
68 
69  this->definitionenum=in_definitionenum;
70  this->name = xNew<char>(strlen(in_name)+1);
71  xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
72 
73  this->numsegments=in_numsegments;
74 
75  if(this->numsegments){
76  this->x1=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->x1,in_x1,this->numsegments);
77  this->y1=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->y1,in_y1,this->numsegments);
78  this->x2=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->x2,in_x2,this->numsegments);
79  this->y2=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->y2,in_y2,this->numsegments);
80  this->elements=xNew<int>(this->numsegments); xMemCpy<int>(this->elements,in_elements,this->numsegments);
81 
82  }
83  }

◆ ~Massfluxatgate()

template<class doubletype >
Massfluxatgate< doubletype >::~Massfluxatgate ( )
inline

Definition at line 85 of file Massfluxatgate.h.

85  {/*{{{*/
86  if(this->numsegments){
87  xDelete<doubletype>(this->x1);
88  xDelete<doubletype>(this->y1);
89  xDelete<doubletype>(this->x2);
90  xDelete<doubletype>(this->y2);
91  xDelete<int>(this->elements);
92  }
93  xDelete<char>(this->name);
94  }

Member Function Documentation

◆ copy()

template<class doubletype >
Object* Massfluxatgate< doubletype >::copy ( void  )
inlinevirtual

Implements Object.

Definition at line 98 of file Massfluxatgate.h.

98  {/*{{{*/
99  return new Massfluxatgate(this->name,this->definitionenum,this->numsegments,this->x1,this->y1,this->x2,this->y2,this->elements);
100  }

◆ DeepEcho()

template<class doubletype >
void Massfluxatgate< doubletype >::DeepEcho ( void  )
inlinevirtual

Implements Object.

Definition at line 102 of file Massfluxatgate.h.

102  {/*{{{*/
103  this->Echo();
104  }

◆ Echo()

template<class doubletype >
void Massfluxatgate< doubletype >::Echo ( void  )
inlinevirtual

Implements Object.

Definition at line 106 of file Massfluxatgate.h.

106  {/*{{{*/
107  _printf_(" Massfluxatgate: " << name << " " << this->definitionenum << "\n");
108  _printf_(" numsegments: " << numsegments << "\n");
109  if(numsegments){
110  _printf_(" element: x1, y1, x2, y2:\n");
111  for(int i=0;i<numsegments;i++){
112  _printf_(elements[i] << " " << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << "\n");
113  }
114  }
115  }

◆ Id()

template<class doubletype >
int Massfluxatgate< doubletype >::Id ( void  )
inlinevirtual

Implements Object.

Definition at line 117 of file Massfluxatgate.h.

117  {/*{{{*/
118  return -1;
119  }

◆ ObjectEnum()

template<class doubletype >
int Massfluxatgate< doubletype >::ObjectEnum ( void  )
inlinevirtual

Implements Object.

Definition at line 121 of file Massfluxatgate.h.

121  {/*{{{*/
122  return MassfluxatgateEnum;
123  }

◆ Marshall()

template<class doubletype >
void Massfluxatgate< doubletype >::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
inlinevirtual

Implements Object.

Definition at line 125 of file Massfluxatgate.h.

125  {/*{{{*/
126  _error_("not implemented yet!");
127  }

◆ DefinitionEnum()

template<class doubletype >
int Massfluxatgate< doubletype >::DefinitionEnum ( )
inlinevirtual

Implements Definition.

Definition at line 130 of file Massfluxatgate.h.

130  {/*{{{*/
131 
132  return this->definitionenum;
133  }

◆ Name()

template<class doubletype >
char* Massfluxatgate< doubletype >::Name ( )
inlinevirtual

Implements Definition.

Definition at line 135 of file Massfluxatgate.h.

135  {/*{{{*/
136 
137  char* name2=xNew<char>(strlen(this->name)+1);
138  xMemCpy(name2,this->name,strlen(this->name)+1);
139 
140  return name2;
141  }

◆ Response()

template<class doubletype >
IssmDouble Massfluxatgate< doubletype >::Response ( FemModel femmodel)
inlinevirtual

Implements Definition.

Definition at line 143 of file Massfluxatgate.h.

143  {/*{{{*/
144 
145  int i,j;
146  Element *element = NULL;
147  IssmDouble mass_flux = 0;
148  IssmDouble all_mass_flux = 0;
149 
150  /*Go through segments, and then elements, and figure out which elements belong to a segment.
151  * When we find one, use the element to compute the mass flux on the segment: */
152  for(i=0;i<numsegments;i++){
153  for(j=0;j<femmodel->elements->Size();j++){
155  if (element->Id()==this->elements[i]){
156  /*We found the element which owns this segment, use it to compute the mass flux: */
157  mass_flux+=element->MassFlux(x1[i],y1[i],x2[i],y2[i],elements[i]);
158  break;
159  }
160  }
161  }
162 
163  ISSM_MPI_Allreduce ( (void*)&mass_flux,(void*)&all_mass_flux,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
164  mass_flux=all_mass_flux;
165  return mass_flux;
166  }

Field Documentation

◆ definitionenum

template<class doubletype >
int Massfluxatgate< doubletype >::definitionenum

Definition at line 22 of file Massfluxatgate.h.

◆ name

template<class doubletype >
char* Massfluxatgate< doubletype >::name

Definition at line 23 of file Massfluxatgate.h.

◆ numsegments

template<class doubletype >
int Massfluxatgate< doubletype >::numsegments

Definition at line 24 of file Massfluxatgate.h.

◆ x1

template<class doubletype >
doubletype* Massfluxatgate< doubletype >::x1

Definition at line 25 of file Massfluxatgate.h.

◆ y1

template<class doubletype >
doubletype* Massfluxatgate< doubletype >::y1

Definition at line 26 of file Massfluxatgate.h.

◆ x2

template<class doubletype >
doubletype* Massfluxatgate< doubletype >::x2

Definition at line 27 of file Massfluxatgate.h.

◆ y2

template<class doubletype >
doubletype* Massfluxatgate< doubletype >::y2

Definition at line 28 of file Massfluxatgate.h.

◆ elements

template<class doubletype >
int* Massfluxatgate< doubletype >::elements

Definition at line 29 of file Massfluxatgate.h.


The documentation for this class was generated from the following file:
DataSet::Size
int Size()
Definition: DataSet.cpp:399
Massfluxatgate::x2
doubletype * x2
Definition: Massfluxatgate.h:27
Massfluxatgate::y1
doubletype * y1
Definition: Massfluxatgate.h:26
IssmDouble
double IssmDouble
Definition: types.h:37
ISSM_MPI_Allreduce
int ISSM_MPI_Allreduce(void *sendbuf, void *recvbuf, int count, ISSM_MPI_Datatype datatype, ISSM_MPI_Op op, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:116
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
Massfluxatgate::Massfluxatgate
Massfluxatgate()
Definition: Massfluxatgate.h:32
ISSM_MPI_SUM
#define ISSM_MPI_SUM
Definition: issmmpi.h:134
IssmComm::GetComm
static ISSM_MPI_Comm GetComm(void)
Definition: IssmComm.cpp:30
Element::MassFlux
virtual IssmDouble MassFlux(IssmDouble *segment)=0
Massfluxatgate::definitionenum
int definitionenum
Definition: Massfluxatgate.h:22
MassfluxatgateEnum
@ MassfluxatgateEnum
Definition: EnumDefinitions.h:1162
Element
Definition: Element.h:41
Massfluxatgate::name
char * name
Definition: Massfluxatgate.h:23
ISSM_MPI_DOUBLE
#define ISSM_MPI_DOUBLE
Definition: issmmpi.h:125
Massfluxatgate::y2
doubletype * y2
Definition: Massfluxatgate.h:28
Element::Id
int Id()
Definition: Element.cpp:1620
FemModel::elements
Elements * elements
Definition: FemModel.h:44
Massfluxatgate::elements
int * elements
Definition: Massfluxatgate.h:29
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
Massfluxatgate::x1
doubletype * x1
Definition: Massfluxatgate.h:25
Massfluxatgate::Echo
void Echo(void)
Definition: Massfluxatgate.h:106
xMemCpy
T * xMemCpy(T *dest, const T *src, unsigned int size)
Definition: MemOps.h:152
Massfluxatgate::numsegments
int numsegments
Definition: Massfluxatgate.h:24
femmodel
FemModel * femmodel
Definition: esmfbinders.cpp:16