| 1 | /*!\file VectorParam.c
|
|---|
| 2 | * \brief: implementation of the VectorParam 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 <stdio.h>
|
|---|
| 14 | #include <string.h>
|
|---|
| 15 | #include "../objects.h"
|
|---|
| 16 | #include "../../../shared/shared.h"
|
|---|
| 17 | /*}}}*/
|
|---|
| 18 |
|
|---|
| 19 | /*VectorParam constructors and destructor*/
|
|---|
| 20 | /*FUNCTION VectorParam::VectorParam(){{{*/
|
|---|
| 21 | VectorParam::VectorParam(){
|
|---|
| 22 | return;
|
|---|
| 23 | }
|
|---|
| 24 | /*}}}*/
|
|---|
| 25 | /*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/
|
|---|
| 26 | VectorParam::VectorParam(int in_enum_type,Vector<IssmDouble>* in_value){
|
|---|
| 27 |
|
|---|
| 28 | enum_type=in_enum_type;
|
|---|
| 29 |
|
|---|
| 30 | value=NULL;
|
|---|
| 31 |
|
|---|
| 32 | if(in_value){
|
|---|
| 33 | value=in_value->Duplicate();
|
|---|
| 34 | in_value->Copy(value);
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 | /*}}}*/
|
|---|
| 38 | /*FUNCTION VectorParam::~VectorParam(){{{*/
|
|---|
| 39 | VectorParam::~VectorParam(){
|
|---|
| 40 | delete value;
|
|---|
| 41 | }
|
|---|
| 42 | /*}}}*/
|
|---|
| 43 |
|
|---|
| 44 | /*Object virtual functions definitions:*/
|
|---|
| 45 | /*FUNCTION VectorParam::Echo {{{*/
|
|---|
| 46 | void VectorParam::Echo(void){
|
|---|
| 47 |
|
|---|
| 48 | _printLine_("VectorParam:");
|
|---|
| 49 | _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
|
|---|
| 50 |
|
|---|
| 51 | }
|
|---|
| 52 | /*}}}*/
|
|---|
| 53 | /*FUNCTION VectorParam::DeepEcho{{{*/
|
|---|
| 54 | void VectorParam::DeepEcho(void){
|
|---|
| 55 |
|
|---|
| 56 | _printLine_("VectorParam:");
|
|---|
| 57 | _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
|
|---|
| 58 | value->Echo();
|
|---|
| 59 | }
|
|---|
| 60 | /*}}}*/
|
|---|
| 61 | /*FUNCTION VectorParam::Id{{{*/
|
|---|
| 62 | int VectorParam::Id(void){ return -1; }
|
|---|
| 63 | /*}}}*/
|
|---|
| 64 | /*FUNCTION VectorParam::ObjectEnum{{{*/
|
|---|
| 65 | int VectorParam::ObjectEnum(void){
|
|---|
| 66 |
|
|---|
| 67 | return VectorParamEnum;
|
|---|
| 68 |
|
|---|
| 69 | }
|
|---|
| 70 | /*}}}*/
|
|---|
| 71 | /*FUNCTION VectorParam::copy{{{*/
|
|---|
| 72 | Object* VectorParam::copy() {
|
|---|
| 73 |
|
|---|
| 74 | return new VectorParam(this->enum_type,this->value);
|
|---|
| 75 |
|
|---|
| 76 | }
|
|---|
| 77 | /*}}}*/
|
|---|
| 78 |
|
|---|
| 79 | /*VectorParam virtual functions definitions: */
|
|---|
| 80 | /*FUNCTION VectorParam::GetParameterValue{{{*/
|
|---|
| 81 | void VectorParam::GetParameterValue(Vector<IssmDouble>** poutput){
|
|---|
| 82 | Vector<IssmDouble>* output=NULL;
|
|---|
| 83 |
|
|---|
| 84 | if(value){
|
|---|
| 85 | output=value->Duplicate();
|
|---|
| 86 | value->Copy(output);
|
|---|
| 87 | }
|
|---|
| 88 | *poutput=output;
|
|---|
| 89 | }
|
|---|
| 90 | /*}}}*/
|
|---|
| 91 | /*FUNCTION VectorParam::GetParameterName{{{*/
|
|---|
| 92 | void VectorParam::GetParameterName(char**pname){
|
|---|
| 93 | EnumToStringx(pname,this->enum_type);
|
|---|
| 94 | }
|
|---|
| 95 | /*}}}*/
|
|---|
| 96 | /*FUNCTION VectorParam::SetValue{{{*/
|
|---|
| 97 | void VectorParam::SetValue(Vector<IssmDouble>* vector){
|
|---|
| 98 |
|
|---|
| 99 | /*avoid leak: */
|
|---|
| 100 | delete value;
|
|---|
| 101 |
|
|---|
| 102 | /*copy: */
|
|---|
| 103 | value=vector->Duplicate();
|
|---|
| 104 | vector->Copy(value);
|
|---|
| 105 | }
|
|---|
| 106 | /*}}}*/
|
|---|
| 107 | /*FUNCTION VectorParam::UnitConversion{{{*/
|
|---|
| 108 | void VectorParam::UnitConversion(int direction_enum){
|
|---|
| 109 | /*do nothing, no unit conversion*/
|
|---|
| 110 | }
|
|---|
| 111 | /*}}}*/
|
|---|