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