source: issm/trunk-jpl/src/c/classes/Inputs2/DoubleInput2.cpp@ 24939

Last change on this file since 24939 was 24939, checked in by Mathieu Morlighem, 5 years ago

CHG: some cleanup

File size: 2.0 KB
Line 
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*/
16DoubleInput2::DoubleInput2(){/*{{{*/
17 this->size = -1;
18 this->values = NULL;
19}
20/*}}}*/
21DoubleInput2::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/*}}}*/
28DoubleInput2::~DoubleInput2(){/*{{{*/
29 xDelete<IssmDouble>(this->values);
30}
31/*}}}*/
32
33/*Object virtual functions definitions:*/
34Input2* 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/*}}}*/
42void 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/*}}}*/
50void DoubleInput2::Echo(void){/*{{{*/
51 this->DeepEcho();
52}
53/*}}}*/
54int DoubleInput2::Id(void){ return -1; }/*{{{*/
55/*}}}*/
56void 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/*}}}*/
68int DoubleInput2::ObjectEnum(void){/*{{{*/
69
70 return DoubleInput2Enum;
71
72}
73/*}}}*/
74
75/*DoubleInput2 management*/
76void DoubleInput2::GetInput(IssmDouble* pvalue,int index){/*{{{*/
77
78 _assert_(index>=0);
79 _assert_(index<this->size);
80
81 *pvalue = this->values[index];
82}
83/*}}}*/
84void 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*/
Note: See TracBrowser for help on using the repository browser.