| [11695] | 1 | /*!\file MatrixParam.c
|
|---|
| 2 | * \brief: implementation of the MatrixParam object
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | /*header files: */
|
|---|
| [12365] | 6 | /*{{{*/
|
|---|
| [11695] | 7 | #ifdef HAVE_CONFIG_H
|
|---|
| 8 | #include <config.h>
|
|---|
| 9 | #else
|
|---|
| 10 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
|---|
| 11 | #endif
|
|---|
| 12 |
|
|---|
| [15012] | 13 | #include "../classes.h"
|
|---|
| 14 | #include "../../shared/shared.h"
|
|---|
| [11695] | 15 | /*}}}*/
|
|---|
| 16 |
|
|---|
| 17 | /*MatrixParam constructors and destructor*/
|
|---|
| [18301] | 18 | MatrixParam::MatrixParam(){/*{{{*/
|
|---|
| [11695] | 19 | return;
|
|---|
| 20 | }
|
|---|
| 21 | /*}}}*/
|
|---|
| [18301] | 22 | MatrixParam::MatrixParam(int in_enum_type,Matrix<IssmDouble>* in_value){/*{{{*/
|
|---|
| [11695] | 23 |
|
|---|
| 24 | enum_type=in_enum_type;
|
|---|
| 25 | value=NULL;
|
|---|
| 26 |
|
|---|
| 27 | if(in_value){
|
|---|
| 28 | value=in_value->Duplicate();
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | /*}}}*/
|
|---|
| [18301] | 32 | MatrixParam::~MatrixParam(){/*{{{*/
|
|---|
| [14891] | 33 | delete value;
|
|---|
| [11695] | 34 | }
|
|---|
| 35 | /*}}}*/
|
|---|
| 36 |
|
|---|
| 37 | /*Object virtual functions definitions:*/
|
|---|
| [18301] | 38 | void MatrixParam::Echo(void){/*{{{*/
|
|---|
| [11695] | 39 |
|
|---|
| [15104] | 40 | _printf_("MatrixParam:\n");
|
|---|
| 41 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
|---|
| [11695] | 42 |
|
|---|
| 43 | }
|
|---|
| 44 | /*}}}*/
|
|---|
| [18301] | 45 | void MatrixParam::DeepEcho(void){/*{{{*/
|
|---|
| [11695] | 46 |
|
|---|
| [15104] | 47 | _printf_("MatrixParam:\n");
|
|---|
| 48 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
|---|
| [11695] | 49 | this->value->Echo();
|
|---|
| 50 | }
|
|---|
| 51 | /*}}}*/
|
|---|
| [20500] | 52 | int MatrixParam::Id(void){ return -1; }/*{{{*/
|
|---|
| [11695] | 53 | /*}}}*/
|
|---|
| [18301] | 54 | int MatrixParam::ObjectEnum(void){/*{{{*/
|
|---|
| [11695] | 55 |
|
|---|
| 56 | return MatrixParamEnum;
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 | /*}}}*/
|
|---|
| [18301] | 60 | Object* MatrixParam::copy() {/*{{{*/
|
|---|
| [13622] | 61 |
|
|---|
| [11695] | 62 | return new MatrixParam(this->enum_type,this->value);
|
|---|
| 63 |
|
|---|
| 64 | }
|
|---|
| 65 | /*}}}*/
|
|---|
| 66 |
|
|---|
| 67 | /*MatrixParam virtual functions definitions: */
|
|---|
| [18301] | 68 | void MatrixParam::GetParameterValue(Matrix<IssmDouble>** poutput){/*{{{*/
|
|---|
| [13216] | 69 | Matrix<IssmDouble>* output=NULL;
|
|---|
| [11695] | 70 |
|
|---|
| 71 | if(value){
|
|---|
| 72 | output=value->Duplicate();
|
|---|
| 73 | }
|
|---|
| 74 | *poutput=output;
|
|---|
| 75 | }
|
|---|
| 76 | /*}}}*/
|
|---|
| [18301] | 77 | void MatrixParam::SetValue(Matrix<IssmDouble>* matrix){/*{{{*/
|
|---|
| [13622] | 78 |
|
|---|
| [11695] | 79 | /*avoid leak: */
|
|---|
| [14891] | 80 | delete value;
|
|---|
| [13622] | 81 |
|
|---|
| [11695] | 82 | /*copy: */
|
|---|
| 83 | value=matrix->Duplicate();
|
|---|
| 84 | }
|
|---|
| 85 | /*}}}*/
|
|---|