Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Private Attributes
IntVecParam Class Reference

#include <IntVecParam.h>

Inheritance diagram for IntVecParam:
Param Object

Public Member Functions

 IntVecParam ()
 
 IntVecParam (int enum_type, int *values, int M)
 
 IntVecParam (int enum_type, IssmDouble *values, int M)
 
 ~IntVecParam ()
 
Paramcopy ()
 
void DeepEcho ()
 
void Echo ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
void GetParameterValue (bool *pbool)
 
void GetParameterValue (int *pinteger)
 
void GetParameterValue (int **pintarray, int *pM)
 
void GetParameterValue (int **pintarray, int *pM, int *pN)
 
void GetParameterValue (IssmDouble *pIssmDouble)
 
void GetParameterValue (IssmDouble *pdouble, IssmDouble time)
 
void GetParameterValue (char **pstring)
 
void GetParameterValue (char ***pstringarray, int *pM)
 
void GetParameterValue (IssmDouble **pIssmDoublearray, int *pM)
 
void GetParameterValue (IssmDouble **pIssmDoublearray, int *pM, int *pN)
 
void GetParameterValue (IssmDouble ***parray, int *pM, int **pmdims, int **pndims)
 
void GetParameterValue (Vector< IssmDouble > **pvec)
 
void GetParameterValue (Matrix< IssmDouble > **pmat)
 
void GetParameterValue (FILE **pfid)
 
void GetParameterValue (DataSet **pdataset)
 
int InstanceEnum ()
 
void SetEnum (int enum_in)
 
void SetValue (bool boolean)
 
void SetValue (int integer)
 
void SetValue (IssmDouble scalar)
 
void SetValue (char *string)
 
void SetValue (char **stringarray, int M)
 
void SetValue (IssmDouble *IssmDoublearray, int M)
 
void SetValue (IssmDouble *pIssmDoublearray, int M, int N)
 
void SetValue (int *intarray, int M)
 
void SetValue (int *pintarray, int M, int N)
 
void SetValue (Vector< IssmDouble > *vec)
 
void SetValue (Matrix< IssmDouble > *mat)
 
void SetValue (FILE *fid)
 
void SetValue (IssmDouble **array, int M, int *mdim_array, int *ndim_array)
 
- Public Member Functions inherited from Param
virtual ~Param ()
 
virtual void GetParameterValue (IssmDouble *pdouble, int row, IssmDouble time)
 
virtual void SetValue (DataSet *dataset)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Private Attributes

int enum_type
 
int * values
 
int M
 

Detailed Description

Definition at line 20 of file IntVecParam.h.

Constructor & Destructor Documentation

◆ IntVecParam() [1/3]

IntVecParam::IntVecParam ( )

Definition at line 18 of file IntVecParam.cpp.

18  {/*{{{*/
19  return;
20 }

◆ IntVecParam() [2/3]

IntVecParam::IntVecParam ( int  enum_type,
int *  values,
int  M 
)

Definition at line 22 of file IntVecParam.cpp.

22  {/*{{{*/
23 
24  enum_type=in_enum_type;
25  M=in_M;
26 
27  if(M){
28  values=xNew<int>(M);
29  xMemCpy<int>(values,in_values,M);
30  }
31  else values=NULL;
32 }

◆ IntVecParam() [3/3]

IntVecParam::IntVecParam ( int  enum_type,
IssmDouble values,
int  M 
)

Definition at line 34 of file IntVecParam.cpp.

34  {/*{{{*/
35 
36  enum_type=in_enum_type;
37  M=in_M;
38 
39  if(M){
40  values=xNew<int>(M);
41  for(int i=0;i<in_M;i++) values[i]=reCast<int>(in_values[i]);
42  }
43  else values=NULL;
44 }

◆ ~IntVecParam()

IntVecParam::~IntVecParam ( )

Definition at line 46 of file IntVecParam.cpp.

46  {/*{{{*/
47  xDelete<int>(values);
48  return;
49 }

Member Function Documentation

◆ copy()

Param * IntVecParam::copy ( void  )
virtual

Implements Param.

Definition at line 53 of file IntVecParam.cpp.

53  {/*{{{*/
54 
55  return new IntVecParam(this->enum_type,this->values,this->M);
56 
57 }

◆ DeepEcho()

void IntVecParam::DeepEcho ( void  )
virtual

Implements Param.

Definition at line 59 of file IntVecParam.cpp.

59  {/*{{{*/
60  _printf_(setw(22)<<" IntVecParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" [");
61  for(int i=0;i<this->M;i++) _printf_(" "<<this->values[i]);
62  _printf_("]\n");
63 }

◆ Echo()

void IntVecParam::Echo ( void  )
virtual

Implements Param.

Definition at line 65 of file IntVecParam.cpp.

65  {/*{{{*/
66 
67  this->DeepEcho();
68 }

◆ Id()

int IntVecParam::Id ( void  )
virtual

Implements Object.

Definition at line 70 of file IntVecParam.cpp.

70 { return -1; }/*{{{*/

◆ Marshall()

void IntVecParam::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
virtual

Implements Param.

Definition at line 72 of file IntVecParam.cpp.

72  { /*{{{*/
73 
75 
77  MARSHALLING(M);
78  if(M) {
80  }
81  else values=NULL;
82 
83 }

◆ ObjectEnum()

int IntVecParam::ObjectEnum ( void  )
virtual

Implements Param.

Definition at line 85 of file IntVecParam.cpp.

85  {/*{{{*/
86 
87  return IntVecParamEnum;
88 
89 }

◆ GetParameterValue() [1/15]

void IntVecParam::GetParameterValue ( bool *  pbool)
inlinevirtual

Implements Param.

Definition at line 43 of file IntVecParam.h.

43 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");}

◆ GetParameterValue() [2/15]

void IntVecParam::GetParameterValue ( int *  pinteger)
inlinevirtual

Implements Param.

Definition at line 44 of file IntVecParam.h.

44 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");}

◆ GetParameterValue() [3/15]

void IntVecParam::GetParameterValue ( int **  pintarray,
int *  pM 
)
virtual

Implements Param.

Definition at line 93 of file IntVecParam.cpp.

93  {/*{{{*/
94  int* output=NULL;
95 
96  if(M){
97  output=xNew<int>(M);
98  xMemCpy<int>(output,values,M);
99  }
100 
101  /*Assign output pointers:*/
102  if(pM) *pM=M;
103  *pintarray=output;
104 }

◆ GetParameterValue() [4/15]

void IntVecParam::GetParameterValue ( int **  pintarray,
int *  pM,
int *  pN 
)
inlinevirtual

Implements Param.

Definition at line 46 of file IntVecParam.h.

46 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix");}

◆ GetParameterValue() [5/15]

void IntVecParam::GetParameterValue ( IssmDouble pIssmDouble)
inlinevirtual

Implements Param.

Definition at line 47 of file IntVecParam.h.

47 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");}

◆ GetParameterValue() [6/15]

void IntVecParam::GetParameterValue ( IssmDouble pdouble,
IssmDouble  time 
)
inlinevirtual

Implements Param.

Definition at line 48 of file IntVecParam.h.

48 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");}

◆ GetParameterValue() [7/15]

void IntVecParam::GetParameterValue ( char **  pstring)
inlinevirtual

Implements Param.

Definition at line 49 of file IntVecParam.h.

49 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");}

◆ GetParameterValue() [8/15]

void IntVecParam::GetParameterValue ( char ***  pstringarray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 50 of file IntVecParam.h.

50 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");}

◆ GetParameterValue() [9/15]

void IntVecParam::GetParameterValue ( IssmDouble **  pIssmDoublearray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 51 of file IntVecParam.h.

51 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");}

◆ GetParameterValue() [10/15]

void IntVecParam::GetParameterValue ( IssmDouble **  pIssmDoublearray,
int *  pM,
int *  pN 
)
inlinevirtual

Implements Param.

Definition at line 52 of file IntVecParam.h.

52 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}

◆ GetParameterValue() [11/15]

void IntVecParam::GetParameterValue ( IssmDouble ***  parray,
int *  pM,
int **  pmdims,
int **  pndims 
)
inlinevirtual

Implements Param.

Definition at line 53 of file IntVecParam.h.

53 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}

◆ GetParameterValue() [12/15]

void IntVecParam::GetParameterValue ( Vector< IssmDouble > **  pvec)
inlinevirtual

Implements Param.

Definition at line 54 of file IntVecParam.h.

54 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}

◆ GetParameterValue() [13/15]

void IntVecParam::GetParameterValue ( Matrix< IssmDouble > **  pmat)
inlinevirtual

Implements Param.

Definition at line 55 of file IntVecParam.h.

55 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}

◆ GetParameterValue() [14/15]

void IntVecParam::GetParameterValue ( FILE **  pfid)
inlinevirtual

Implements Param.

Definition at line 56 of file IntVecParam.h.

56 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}

◆ GetParameterValue() [15/15]

void IntVecParam::GetParameterValue ( DataSet **  pdataset)
inlinevirtual

Implements Param.

Definition at line 57 of file IntVecParam.h.

57 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");}

◆ InstanceEnum()

int IntVecParam::InstanceEnum ( )
inlinevirtual

Implements Param.

Definition at line 58 of file IntVecParam.h.

58 {return enum_type;}

◆ SetEnum()

void IntVecParam::SetEnum ( int  enum_in)
inlinevirtual

Implements Param.

Definition at line 60 of file IntVecParam.h.

60 {this->enum_type = enum_in;};

◆ SetValue() [1/13]

void IntVecParam::SetValue ( bool  boolean)
inlinevirtual

Implements Param.

Definition at line 61 of file IntVecParam.h.

61 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");}

◆ SetValue() [2/13]

void IntVecParam::SetValue ( int  integer)
inlinevirtual

Implements Param.

Definition at line 62 of file IntVecParam.h.

62 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");}

◆ SetValue() [3/13]

void IntVecParam::SetValue ( IssmDouble  scalar)
inlinevirtual

Implements Param.

Definition at line 63 of file IntVecParam.h.

63 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");}

◆ SetValue() [4/13]

void IntVecParam::SetValue ( char *  string)
inlinevirtual

Implements Param.

Definition at line 64 of file IntVecParam.h.

64 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");}

◆ SetValue() [5/13]

void IntVecParam::SetValue ( char **  stringarray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 65 of file IntVecParam.h.

65 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");}

◆ SetValue() [6/13]

void IntVecParam::SetValue ( IssmDouble IssmDoublearray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 66 of file IntVecParam.h.

66 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");}

◆ SetValue() [7/13]

void IntVecParam::SetValue ( IssmDouble pIssmDoublearray,
int  M,
int  N 
)
inlinevirtual

Implements Param.

Definition at line 67 of file IntVecParam.h.

67 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");}

◆ SetValue() [8/13]

void IntVecParam::SetValue ( int *  intarray,
int  M 
)
virtual

Implements Param.

Definition at line 106 of file IntVecParam.cpp.

106  {/*{{{*/
107 
108  /*avoid leak: */
109  xDelete<int>(this->values);
110 
111  if(in_M){
112  this->values=xNew<int>(in_M);
113  xMemCpy<int>(this->values,intarray,in_M);
114  }
115  else this->values=NULL;
116 
117  this->M=in_M;
118 }

◆ SetValue() [9/13]

void IntVecParam::SetValue ( int *  pintarray,
int  M,
int  N 
)
inlinevirtual

Implements Param.

Definition at line 69 of file IntVecParam.h.

69 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}

◆ SetValue() [10/13]

void IntVecParam::SetValue ( Vector< IssmDouble > *  vec)
inlinevirtual

Implements Param.

Definition at line 70 of file IntVecParam.h.

70 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}

◆ SetValue() [11/13]

void IntVecParam::SetValue ( Matrix< IssmDouble > *  mat)
inlinevirtual

Implements Param.

Definition at line 71 of file IntVecParam.h.

71 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}

◆ SetValue() [12/13]

void IntVecParam::SetValue ( FILE *  fid)
inlinevirtual

Implements Param.

Definition at line 72 of file IntVecParam.h.

72 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}

◆ SetValue() [13/13]

void IntVecParam::SetValue ( IssmDouble **  array,
int  M,
int *  mdim_array,
int *  ndim_array 
)
inlinevirtual

Implements Param.

Definition at line 73 of file IntVecParam.h.

73 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}

Field Documentation

◆ enum_type

int IntVecParam::enum_type
private

Definition at line 23 of file IntVecParam.h.

◆ values

int* IntVecParam::values
private

Definition at line 24 of file IntVecParam.h.

◆ M

int IntVecParam::M
private

Definition at line 25 of file IntVecParam.h.


The documentation for this class was generated from the following files:
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
IntVecParamEnum
@ IntVecParamEnum
Definition: EnumDefinitions.h:1129
IntVecParam::M
int M
Definition: IntVecParam.h:25
IntVecParam::enum_type
int enum_type
Definition: IntVecParam.h:23
MARSHALLING_DYNAMIC
#define MARSHALLING_DYNAMIC(FIELD, TYPE, SIZE)
Definition: Marshalling.h:61
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
IntVecParam::DeepEcho
void DeepEcho()
Definition: IntVecParam.cpp:59
IntVecParam::values
int * values
Definition: IntVecParam.h:24
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
IntVecParam::IntVecParam
IntVecParam()
Definition: IntVecParam.cpp:18