| 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"
|
|---|
| 16 | IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,const char* output_string);
|
|---|
| 17 | /*}}}*/
|
|---|
| 18 | class Massconaxpby: public Object, public Definition{
|
|---|
| 19 |
|
|---|
| 20 | public:
|
|---|
| 21 |
|
|---|
| 22 | int definitionenum;
|
|---|
| 23 | char* name;
|
|---|
| 24 | char* namex;
|
|---|
| 25 | char* namey;
|
|---|
| 26 | IssmDouble alpha;
|
|---|
| 27 | IssmDouble beta;
|
|---|
| 28 |
|
|---|
| 29 | /*Massconaxpby constructors, destructors :*/
|
|---|
| 30 | Massconaxpby(){/*{{{*/
|
|---|
| 31 |
|
|---|
| 32 | this->definitionenum = -1;
|
|---|
| 33 | this->name = NULL;
|
|---|
| 34 | this->namex = NULL;
|
|---|
| 35 | this->namey = NULL;
|
|---|
| 36 | this->alpha=UNDEF;
|
|---|
| 37 | this->beta=UNDEF;
|
|---|
| 38 |
|
|---|
| 39 | }
|
|---|
| 40 | /*}}}*/
|
|---|
| 41 | Massconaxpby(char* in_name,int in_definitionenum, char* in_namex, char* in_namey, IssmDouble in_alpha,IssmDouble in_beta){ /*{{{*/
|
|---|
| 42 |
|
|---|
| 43 | this->definitionenum = in_definitionenum;
|
|---|
| 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: */
|
|---|
| 65 | void Echo(void){/*{{{*/
|
|---|
| 66 | _printf_(" Massconaxpby: " << this->name << " " << this->definitionenum << "\n");
|
|---|
| 67 | _printf_(" namex: " << this->namex << "\n");
|
|---|
| 68 | _printf_(" namey: " << this->namey << "\n");
|
|---|
| 69 | _printf_(" alpha: " << this->alpha << "\n");
|
|---|
| 70 | _printf_(" beta: " << this->beta << "\n");
|
|---|
| 71 | }
|
|---|
| 72 | /*}}}*/
|
|---|
| 73 | void DeepEcho(void){/*{{{*/
|
|---|
| 74 | this->Echo();
|
|---|
| 75 | }
|
|---|
| 76 | /*}}}*/
|
|---|
| 77 | int Id(void){/*{{{*/
|
|---|
| 78 | return -1;
|
|---|
| 79 | }
|
|---|
| 80 | /*}}}*/
|
|---|
| 81 | int ObjectEnum(void){/*{{{*/
|
|---|
| 82 | return MassconaxpbyEnum;
|
|---|
| 83 | }
|
|---|
| 84 | /*}}}*/
|
|---|
| 85 | Object* copy() {/*{{{*/
|
|---|
| 86 | Massconaxpby* mf = new Massconaxpby(this->name,this->definitionenum,this->namex,this->namey, this->alpha, this->beta);
|
|---|
| 87 | return (Object*) mf;
|
|---|
| 88 | }
|
|---|
| 89 | /*}}}*/
|
|---|
| 90 | void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
|
|---|
| 91 | _error_("not implemented yet!");
|
|---|
| 92 | }
|
|---|
| 93 | /*}}}*/
|
|---|
| 94 | /*Definition virtual function resolutoin: */
|
|---|
| 95 | char* Name(){/*{{{*/
|
|---|
| 96 |
|
|---|
| 97 | char* name2=xNew<char>(strlen(this->name)+1);
|
|---|
| 98 | xMemCpy(name2,this->name,strlen(this->name)+1);
|
|---|
| 99 |
|
|---|
| 100 | return name2;
|
|---|
| 101 | }
|
|---|
| 102 | /*}}}*/
|
|---|
| 103 | int DefinitionEnum(){/*{{{*/
|
|---|
| 104 |
|
|---|
| 105 | return this->definitionenum;
|
|---|
| 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_ */
|
|---|