1 | /*!\file DoubleInput2.c
|
---|
2 | * \brief: implementation of the DoubleInput2 object
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <config.h>
|
---|
7 | #else
|
---|
8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #include "../classes.h"
|
---|
12 | #include "../../shared/shared.h"
|
---|
13 | #include "./DoubleInput2.h"
|
---|
14 |
|
---|
15 | /*DoubleInput2 constructors and destructor*/
|
---|
16 | DoubleInput2::DoubleInput2(){/*{{{*/
|
---|
17 | this->size = -1;
|
---|
18 | this->values = NULL;
|
---|
19 | }
|
---|
20 | /*}}}*/
|
---|
21 | DoubleInput2::DoubleInput2(int size_in){/*{{{*/
|
---|
22 | _assert_(size_in>0);
|
---|
23 | _assert_(size_in<1e11);
|
---|
24 | this->size = size_in;
|
---|
25 | this->values = xNew<IssmDouble>(size_in);
|
---|
26 | }
|
---|
27 | /*}}}*/
|
---|
28 | DoubleInput2::~DoubleInput2(){/*{{{*/
|
---|
29 | xDelete<IssmDouble>(this->values);
|
---|
30 | }
|
---|
31 | /*}}}*/
|
---|
32 |
|
---|
33 | /*Object virtual functions definitions:*/
|
---|
34 | Input2* DoubleInput2::copy() {/*{{{*/
|
---|
35 |
|
---|
36 | DoubleInput2* output = new DoubleInput2(this->size);
|
---|
37 | xMemCpy<IssmDouble>(output->values,this->values,this->size);
|
---|
38 |
|
---|
39 | return output;
|
---|
40 | }
|
---|
41 | /*}}}*/
|
---|
42 | void DoubleInput2::DeepEcho(void){/*{{{*/
|
---|
43 |
|
---|
44 | _printf_("DoubleInput2 Echo:\n");
|
---|
45 | _printf_(" Size: "<<size<<"\n");
|
---|
46 | printarray(this->values,this->size);
|
---|
47 | //_printf_(setw(15)<<" DoubleInput2 "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
|
---|
48 | }
|
---|
49 | /*}}}*/
|
---|
50 | void DoubleInput2::Echo(void){/*{{{*/
|
---|
51 | this->DeepEcho();
|
---|
52 | }
|
---|
53 | /*}}}*/
|
---|
54 | int DoubleInput2::Id(void){ return -1; }/*{{{*/
|
---|
55 | /*}}}*/
|
---|
56 | void DoubleInput2::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
|
---|
57 |
|
---|
58 | MARSHALLING_ENUM(DoubleInput2Enum);
|
---|
59 |
|
---|
60 | MARSHALLING(this->size);
|
---|
61 | if(this->size > 0){
|
---|
62 | MARSHALLING_DYNAMIC(this->values,IssmDouble,this->size)
|
---|
63 | }
|
---|
64 | else this->values = NULL;
|
---|
65 |
|
---|
66 | }
|
---|
67 | /*}}}*/
|
---|
68 | int DoubleInput2::ObjectEnum(void){/*{{{*/
|
---|
69 |
|
---|
70 | return DoubleInput2Enum;
|
---|
71 |
|
---|
72 | }
|
---|
73 | /*}}}*/
|
---|
74 |
|
---|
75 | /*DoubleInput2 management*/
|
---|
76 | void DoubleInput2::GetInput(IssmDouble* pvalue,int index){/*{{{*/
|
---|
77 |
|
---|
78 | _assert_(index>=0);
|
---|
79 | _assert_(index<this->size);
|
---|
80 |
|
---|
81 | *pvalue = this->values[index];
|
---|
82 | }
|
---|
83 | /*}}}*/
|
---|
84 | void DoubleInput2::SetInput(int index,IssmDouble value){/*{{{*/
|
---|
85 |
|
---|
86 | _assert_(index>=0);
|
---|
87 | _assert_(index<this->size);
|
---|
88 |
|
---|
89 | this->values[index] = value;
|
---|
90 | }
|
---|
91 | /*}}}*/
|
---|
92 |
|
---|
93 | /*Object functions*/
|
---|