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

#include <IntMatParam.h>

Inheritance diagram for IntMatParam:
Param Object

Public Member Functions

 IntMatParam ()
 
 IntMatParam (int enum_type, int *value, int M, int N)
 
 ~IntMatParam ()
 
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 *IssmDoublearray, int M, int N)
 
void SetValue (int *intarray, int M)
 
void SetValue (int *intarray, 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 * value
 
int M
 
int N
 

Detailed Description

Definition at line 20 of file IntMatParam.h.

Constructor & Destructor Documentation

◆ IntMatParam() [1/2]

IntMatParam::IntMatParam ( )

Definition at line 18 of file IntMatParam.cpp.

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

◆ IntMatParam() [2/2]

IntMatParam::IntMatParam ( int  enum_type,
int *  value,
int  M,
int  N 
)

Definition at line 22 of file IntMatParam.cpp.

22  {/*{{{*/
23 
24  enum_type=in_enum_type;
25  M=in_M;
26  N=in_N;
27 
28  value=xNew<int>(M*N);
29  xMemCpy<int>(value,in_value,M*N);
30 }

◆ ~IntMatParam()

IntMatParam::~IntMatParam ( )

Definition at line 32 of file IntMatParam.cpp.

32  {/*{{{*/
33  xDelete<int>(value);
34  return;
35 }

Member Function Documentation

◆ copy()

Param * IntMatParam::copy ( void  )
virtual

Implements Param.

Definition at line 39 of file IntMatParam.cpp.

39  {/*{{{*/
40 
41  return new IntMatParam(this->enum_type,this->value,this->M,this->N);
42 
43 }

◆ DeepEcho()

void IntMatParam::DeepEcho ( void  )
virtual

Implements Param.

Definition at line 45 of file IntMatParam.cpp.

45  {/*{{{*/
46 
47  int i,j;
48 
49  _printf_("IntMatParam:\n");
50  _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
51  _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
52  for(i=0;i<this->M;i++){
53  for(j=0;j<this->N;j++){
54  _printf_("(" << i << "," << j << ") " << *(this->value+N*i+j) << "\n");
55  }
56  }
57 }

◆ Echo()

void IntMatParam::Echo ( void  )
virtual

Implements Param.

Definition at line 59 of file IntMatParam.cpp.

59  {/*{{{*/
60 
61  _printf_("IntMatParam:\n");
62  _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
63  _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
64 
65 }

◆ Id()

int IntMatParam::Id ( void  )
virtual

Implements Object.

Definition at line 67 of file IntMatParam.cpp.

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

◆ Marshall()

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

Implements Param.

Definition at line 69 of file IntMatParam.cpp.

69  { /*{{{*/
70 
72 
74  MARSHALLING(M);
75  MARSHALLING(N);
77 }

◆ ObjectEnum()

int IntMatParam::ObjectEnum ( void  )
virtual

Implements Param.

Definition at line 79 of file IntMatParam.cpp.

79  {/*{{{*/
80 
81  return IntMatParamEnum;
82 
83 }

◆ GetParameterValue() [1/15]

void IntMatParam::GetParameterValue ( bool *  pbool)
inlinevirtual

Implements Param.

Definition at line 43 of file IntMatParam.h.

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

◆ GetParameterValue() [2/15]

void IntMatParam::GetParameterValue ( int *  pinteger)
inlinevirtual

Implements Param.

Definition at line 44 of file IntMatParam.h.

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

◆ GetParameterValue() [3/15]

void IntMatParam::GetParameterValue ( int **  pintarray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 45 of file IntMatParam.h.

45 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}

◆ GetParameterValue() [4/15]

void IntMatParam::GetParameterValue ( int **  pintarray,
int *  pM,
int *  pN 
)
virtual

Implements Param.

Definition at line 87 of file IntMatParam.cpp.

87  {/*{{{*/
88  int* output=NULL;
89 
90  output=xNew<int>(M*N);
91  xMemCpy<int>(output,value,M*N);
92 
93  /*Assign output pointers:*/
94  if(pM) *pM=M;
95  if(pN) *pN=N;
96  *pintarray=output;
97 }

◆ GetParameterValue() [5/15]

void IntMatParam::GetParameterValue ( IssmDouble pIssmDouble)
inlinevirtual

Implements Param.

Definition at line 47 of file IntMatParam.h.

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

◆ GetParameterValue() [6/15]

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

Implements Param.

Definition at line 48 of file IntMatParam.h.

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

◆ GetParameterValue() [7/15]

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

Implements Param.

Definition at line 49 of file IntMatParam.h.

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

◆ GetParameterValue() [8/15]

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

Implements Param.

Definition at line 50 of file IntMatParam.h.

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

◆ GetParameterValue() [9/15]

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

Implements Param.

Definition at line 51 of file IntMatParam.h.

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

◆ GetParameterValue() [10/15]

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

Implements Param.

Definition at line 52 of file IntMatParam.h.

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

◆ GetParameterValue() [11/15]

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

Implements Param.

Definition at line 53 of file IntMatParam.h.

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

◆ GetParameterValue() [12/15]

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

Implements Param.

Definition at line 54 of file IntMatParam.h.

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

◆ GetParameterValue() [13/15]

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

Implements Param.

Definition at line 55 of file IntMatParam.h.

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

◆ GetParameterValue() [14/15]

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

Implements Param.

Definition at line 56 of file IntMatParam.h.

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

◆ GetParameterValue() [15/15]

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

Implements Param.

Definition at line 57 of file IntMatParam.h.

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

◆ InstanceEnum()

int IntMatParam::InstanceEnum ( )
inlinevirtual

Implements Param.

Definition at line 58 of file IntMatParam.h.

58 {return enum_type;}

◆ SetEnum()

void IntMatParam::SetEnum ( int  enum_in)
inlinevirtual

Implements Param.

Definition at line 60 of file IntMatParam.h.

60 {this->enum_type = enum_in;};

◆ SetValue() [1/13]

void IntMatParam::SetValue ( bool  boolean)
inlinevirtual

Implements Param.

Definition at line 61 of file IntMatParam.h.

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

◆ SetValue() [2/13]

void IntMatParam::SetValue ( int  integer)
inlinevirtual

Implements Param.

Definition at line 62 of file IntMatParam.h.

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

◆ SetValue() [3/13]

void IntMatParam::SetValue ( IssmDouble  scalar)
inlinevirtual

Implements Param.

Definition at line 63 of file IntMatParam.h.

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

◆ SetValue() [4/13]

void IntMatParam::SetValue ( char *  string)
inlinevirtual

Implements Param.

Definition at line 64 of file IntMatParam.h.

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

◆ SetValue() [5/13]

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

Implements Param.

Definition at line 65 of file IntMatParam.h.

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

◆ SetValue() [6/13]

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

Implements Param.

Definition at line 66 of file IntMatParam.h.

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

◆ SetValue() [7/13]

void IntMatParam::SetValue ( IssmDouble IssmDoublearray,
int  M,
int  N 
)
inlinevirtual

Implements Param.

Definition at line 67 of file IntMatParam.h.

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

◆ SetValue() [8/13]

void IntMatParam::SetValue ( int *  intarray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 68 of file IntMatParam.h.

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

◆ SetValue() [9/13]

void IntMatParam::SetValue ( int *  intarray,
int  M,
int  N 
)
virtual

Implements Param.

Definition at line 99 of file IntMatParam.cpp.

99  {/*{{{*/
100 
101  /*avoid leak: */
102  xDelete<int>(this->value);
103 
104  this->value=xNew<int>(in_M*in_N);
105  xMemCpy<int>(this->value,intarray,in_M*in_N);
106 
107  this->M=in_M;
108  this->N=in_N;
109 }

◆ SetValue() [10/13]

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

Implements Param.

Definition at line 70 of file IntMatParam.h.

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

◆ SetValue() [11/13]

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

Implements Param.

Definition at line 71 of file IntMatParam.h.

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

◆ SetValue() [12/13]

void IntMatParam::SetValue ( FILE *  fid)
inlinevirtual

Implements Param.

Definition at line 72 of file IntMatParam.h.

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

◆ SetValue() [13/13]

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

Implements Param.

Definition at line 73 of file IntMatParam.h.

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

Field Documentation

◆ enum_type

int IntMatParam::enum_type
private

Definition at line 23 of file IntMatParam.h.

◆ value

int* IntMatParam::value
private

Definition at line 24 of file IntMatParam.h.

◆ M

int IntMatParam::M
private

Definition at line 25 of file IntMatParam.h.

◆ N

int IntMatParam::N
private

Definition at line 26 of file IntMatParam.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
IntMatParam::IntMatParam
IntMatParam()
Definition: IntMatParam.cpp:18
MARSHALLING_DYNAMIC
#define MARSHALLING_DYNAMIC(FIELD, TYPE, SIZE)
Definition: Marshalling.h:61
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
IntMatParam::enum_type
int enum_type
Definition: IntMatParam.h:23
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
IntMatParamEnum
@ IntMatParamEnum
Definition: EnumDefinitions.h:1127
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
IntMatParam::value
int * value
Definition: IntMatParam.h:24
IntMatParam::M
int M
Definition: IntMatParam.h:25
IntMatParam::N
int N
Definition: IntMatParam.h:26