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

header file for NodalValuex More...

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

Go to the source code of this file.

Functions

void NodalValuex (IssmDouble *pnodalvalue, int natureofdataenum, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
 

Detailed Description

header file for NodalValuex

Definition in file NodalValuex.h.

Function Documentation

◆ NodalValuex()

void NodalValuex ( IssmDouble pnodalvalue,
int  natureofdataenum,
Elements elements,
Nodes nodes,
Vertices vertices,
Loads loads,
Materials materials,
Parameters parameters 
)

Definition at line 10 of file NodalValuex.cpp.

10  {
11 
12  IssmDouble value;
13  int index;
14  int found,sumfound,cpu_found,cpu;
15 
16  /*retrieve element we are interested in: */
17  parameters->FindParam(&index,IndexEnum);
18 
19  /*This is the vertex id for which we want to collect the data. Go through elements, and for each
20  *element, figure out if they hold the vertex, and the data. If so, return it: */
21  cpu_found=-1;
22  found=0;
23 
24  for(int i=0;i<elements->Size();i++){
25  Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
26  found=element->NodalValue(&value,index,natureofdataenum);
27  if(found){
28  cpu_found=IssmComm::GetRank();
29  break;
30  }
31  }
32 
33  /*Broadcast whether we found the element: */
35  if(!sumfound)_error_("could not find element with vertex with id " << index << " to compute nodal value " << EnumToStringx(natureofdataenum));
36 
37  /*Broadcast and plug into response: */
40 
41  *pnodalvalue=value;
42 }
DataSet::Size
int Size()
Definition: DataSet.cpp:399
IndexEnum
@ IndexEnum
Definition: EnumDefinitions.h:201
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
ISSM_MPI_SUM
#define ISSM_MPI_SUM
Definition: issmmpi.h:134
IssmComm::GetComm
static ISSM_MPI_Comm GetComm(void)
Definition: IssmComm.cpp:30
ISSM_MPI_MAX
#define ISSM_MPI_MAX
Definition: issmmpi.h:131
Element::NodalValue
virtual int NodalValue(IssmDouble *pvalue, int index, int natureofdataenum)=0
Element
Definition: Element.h:41
ISSM_MPI_DOUBLE
#define ISSM_MPI_DOUBLE
Definition: issmmpi.h:125
ISSM_MPI_INT
#define ISSM_MPI_INT
Definition: issmmpi.h:127
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
ISSM_MPI_Bcast
int ISSM_MPI_Bcast(void *buffer, int count, ISSM_MPI_Datatype datatype, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:162
IssmComm::GetRank
static int GetRank(void)
Definition: IssmComm.cpp:34
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
Parameters::FindParam
void FindParam(bool *pinteger, int enum_type)
Definition: Parameters.cpp:262