| 1 | /*!\file MatrixParam.c
|
|---|
| 2 | * \brief: implementation of the MatrixParam object
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | /*header files: */
|
|---|
| 6 | /*{{{*/
|
|---|
| 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 |
|
|---|
| 13 | #include "../classes.h"
|
|---|
| 14 | #include "../../shared/shared.h"
|
|---|
| 15 | /*}}}*/
|
|---|
| 16 |
|
|---|
| 17 | /*MatrixParam constructors and destructor*/
|
|---|
| 18 | /*FUNCTION MatrixParam::MatrixParam(){{{*/
|
|---|
| 19 | MatrixParam::MatrixParam(){
|
|---|
| 20 | return;
|
|---|
| 21 | }
|
|---|
| 22 | /*}}}*/
|
|---|
| 23 | /*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix<IssmDouble>* value){{{*/
|
|---|
| 24 | MatrixParam::MatrixParam(int in_enum_type,Matrix<IssmDouble>* in_value){
|
|---|
| 25 |
|
|---|
| 26 | enum_type=in_enum_type;
|
|---|
| 27 | value=NULL;
|
|---|
| 28 |
|
|---|
| 29 | if(in_value){
|
|---|
| 30 | value=in_value->Duplicate();
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 | /*}}}*/
|
|---|
| 34 | /*FUNCTION MatrixParam::~MatrixParam(){{{*/
|
|---|
| 35 | MatrixParam::~MatrixParam(){
|
|---|
| 36 | delete value;
|
|---|
| 37 | }
|
|---|
| 38 | /*}}}*/
|
|---|
| 39 |
|
|---|
| 40 | /*Object virtual functions definitions:*/
|
|---|
| 41 | /*FUNCTION MatrixParam::Echo {{{*/
|
|---|
| 42 | void MatrixParam::Echo(void){
|
|---|
| 43 |
|
|---|
| 44 | _printf_("MatrixParam:\n");
|
|---|
| 45 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
|---|
| 46 |
|
|---|
| 47 | }
|
|---|
| 48 | /*}}}*/
|
|---|
| 49 | /*FUNCTION MatrixParam::DeepEcho{{{*/
|
|---|
| 50 | void MatrixParam::DeepEcho(void){
|
|---|
| 51 |
|
|---|
| 52 | _printf_("MatrixParam:\n");
|
|---|
| 53 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
|---|
| 54 | this->value->Echo();
|
|---|
| 55 | }
|
|---|
| 56 | /*}}}*/
|
|---|
| 57 | /*FUNCTION MatrixParam::Id{{{*/
|
|---|
| 58 | int MatrixParam::Id(void){ return -1; }
|
|---|
| 59 | /*}}}*/
|
|---|
| 60 | /*FUNCTION MatrixParam::ObjectEnum{{{*/
|
|---|
| 61 | int MatrixParam::ObjectEnum(void){
|
|---|
| 62 |
|
|---|
| 63 | return MatrixParamEnum;
|
|---|
| 64 |
|
|---|
| 65 | }
|
|---|
| 66 | /*}}}*/
|
|---|
| 67 | /*FUNCTION MatrixParam::copy{{{*/
|
|---|
| 68 | Object* MatrixParam::copy() {
|
|---|
| 69 |
|
|---|
| 70 | return new MatrixParam(this->enum_type,this->value);
|
|---|
| 71 |
|
|---|
| 72 | }
|
|---|
| 73 | /*}}}*/
|
|---|
| 74 |
|
|---|
| 75 | /*MatrixParam virtual functions definitions: */
|
|---|
| 76 | /*FUNCTION MatrixParam::GetParameterValue{{{*/
|
|---|
| 77 | void MatrixParam::GetParameterValue(Matrix<IssmDouble>** poutput){
|
|---|
| 78 | Matrix<IssmDouble>* output=NULL;
|
|---|
| 79 |
|
|---|
| 80 | if(value){
|
|---|
| 81 | output=value->Duplicate();
|
|---|
| 82 | }
|
|---|
| 83 | *poutput=output;
|
|---|
| 84 | }
|
|---|
| 85 | /*}}}*/
|
|---|
| 86 | /*FUNCTION MatrixParam::SetValue{{{*/
|
|---|
| 87 | void MatrixParam::SetValue(Matrix<IssmDouble>* matrix){
|
|---|
| 88 |
|
|---|
| 89 | /*avoid leak: */
|
|---|
| 90 | delete value;
|
|---|
| 91 |
|
|---|
| 92 | /*copy: */
|
|---|
| 93 | value=matrix->Duplicate();
|
|---|
| 94 | }
|
|---|
| 95 | /*}}}*/
|
|---|