source: issm/trunk/src/c/classes/Massconaxpby.h@ 21729

Last change on this file since 21729 was 21341, checked in by Mathieu Morlighem, 8 years ago

merged trunk-jpl and trunk for revision 21337

File size: 3.1 KB
RevLine 
[18812]1/*!\file Massconaxpby.h
2 * \brief: header file for Massconaxpby object
3 */
4
5#ifndef _MASSCON_AXPBY_H_
6#define _MASSCON_AXPBY_H_
7
8/*Headers:*/
9/*{{{*/
10#include "./Definition.h"
11#include "../datastructures/datastructures.h"
12#include "./Elements/Element.h"
13#include "./Elements/Elements.h"
14#include "./FemModel.h"
15#include "../classes/Params/Parameters.h"
16IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,const char* output_string);
17/*}}}*/
18class Massconaxpby: public Object, public Definition{
19
20 public:
21
[18885]22 int definitionenum;
[18812]23 char* name;
24 char* namex;
25 char* namey;
26 IssmDouble alpha;
27 IssmDouble beta;
28
29 /*Massconaxpby constructors, destructors :*/
30 Massconaxpby(){/*{{{*/
31
[18885]32 this->definitionenum = -1;
[18812]33 this->name = NULL;
34 this->namex = NULL;
35 this->namey = NULL;
36 this->alpha=UNDEF;
37 this->beta=UNDEF;
38
39 }
40 /*}}}*/
[18885]41 Massconaxpby(char* in_name,int in_definitionenum, char* in_namex, char* in_namey, IssmDouble in_alpha,IssmDouble in_beta){ /*{{{*/
[18812]42
[18885]43 this->definitionenum = in_definitionenum;
[18812]44 this->name = xNew<char>(strlen(in_name)+1);
45 xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
46
47 this->namex = xNew<char>(strlen(in_namex)+1);
48 xMemCpy<char>(this->namex,in_namex,strlen(in_namex)+1);
49
50 this->namey = xNew<char>(strlen(in_namey)+1);
51 xMemCpy<char>(this->namey,in_namey,strlen(in_namey)+1);
52
53 this->alpha=in_alpha;
54 this->beta=in_beta;
55
56 }
57 /*}}}*/
58 ~Massconaxpby(){/*{{{*/
59 if(this->name)xDelete(this->name);
60 if(this->namex)xDelete(this->namex);
61 if(this->namey)xDelete(this->namey);
62 }
63 /*}}}*/
64 /*Object virtual function resolutoin: */
[21341]65 Object* copy() {/*{{{*/
66 Massconaxpby* mf = new Massconaxpby(this->name,this->definitionenum,this->namex,this->namey, this->alpha, this->beta);
67 return (Object*) mf;
68 }
69 /*}}}*/
70 void DeepEcho(void){/*{{{*/
71 this->Echo();
72 }
73 /*}}}*/
[18812]74 void Echo(void){/*{{{*/
[18885]75 _printf_(" Massconaxpby: " << this->name << " " << this->definitionenum << "\n");
[18812]76 _printf_(" namex: " << this->namex << "\n");
77 _printf_(" namey: " << this->namey << "\n");
78 _printf_(" alpha: " << this->alpha << "\n");
79 _printf_(" beta: " << this->beta << "\n");
80 }
81 /*}}}*/
82 int Id(void){/*{{{*/
83 return -1;
84 }
85 /*}}}*/
[21341]86 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
87 _error_("not implemented yet!");
88 }
89 /*}}}*/
[18812]90 int ObjectEnum(void){/*{{{*/
91 return MassconaxpbyEnum;
92 }
93 /*}}}*/
[21341]94 /*Definition virtual function resolutoin: */
95 int DefinitionEnum(){/*{{{*/
96
97 return this->definitionenum;
[18812]98 }
99 /*}}}*/
100 char* Name(){/*{{{*/
101
102 char* name2=xNew<char>(strlen(this->name)+1);
103 xMemCpy(name2,this->name,strlen(this->name)+1);
104
105 return name2;
106 }
107 /*}}}*/
108 IssmDouble Response(FemModel* femmodel){/*{{{*/
109
110 IssmDouble xresponse,yresponse;
111
112 /*Get response from both masscons: */
113 xresponse=OutputDefinitionsResponsex(femmodel,this->namex);
114 yresponse=OutputDefinitionsResponsex(femmodel,this->namey);
115
116 return this->alpha*xresponse+this->beta*yresponse;
117 }
118 /*}}}*/
119};
120
121#endif /* _MASSCON_H_ */
Note: See TracBrowser for help on using the repository browser.