1 | /*!\file DatasetInput.c
|
---|
2 | * \brief: implementation of the datasetinput object
|
---|
3 | */
|
---|
4 | /*Headers{{{*/
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <config.h>
|
---|
7 | #else
|
---|
8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #include <stdio.h>
|
---|
12 | #include <string.h>
|
---|
13 | #include "../../classes.h"
|
---|
14 | #include "../../../EnumDefinitions/EnumDefinitions.h"
|
---|
15 | #include "../../../shared/shared.h"
|
---|
16 | #include "../../../Container/Container.h"
|
---|
17 | #include "../../../include/include.h"
|
---|
18 | /*}}}*/
|
---|
19 |
|
---|
20 | /*DatasetInput constructors and destructor*/
|
---|
21 | /*FUNCTION DatasetInput::DatasetInput(){{{*/
|
---|
22 | DatasetInput::DatasetInput(){
|
---|
23 | enum_type=UNDEF;
|
---|
24 | inputs=NULL;
|
---|
25 | }
|
---|
26 | /*}}}*/
|
---|
27 | /*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{*/
|
---|
28 | DatasetInput::DatasetInput(int in_enum_type){
|
---|
29 |
|
---|
30 | enum_type = in_enum_type;
|
---|
31 | inputs = new Inputs();
|
---|
32 | }
|
---|
33 | /*}}}*/
|
---|
34 | /*FUNCTION DatasetInput::~DatasetInput(){{{*/
|
---|
35 | DatasetInput::~DatasetInput(){
|
---|
36 | delete inputs;
|
---|
37 | }
|
---|
38 | /*}}}*/
|
---|
39 |
|
---|
40 | /*Object virtual functions definitions:*/
|
---|
41 | /*FUNCTION DatasetInput::Echo {{{*/
|
---|
42 | void DatasetInput::Echo(void){
|
---|
43 | this->DeepEcho();
|
---|
44 | }
|
---|
45 | /*}}}*/
|
---|
46 | /*FUNCTION DatasetInput::DeepEcho{{{*/
|
---|
47 | void DatasetInput::DeepEcho(void){
|
---|
48 |
|
---|
49 | _printLine_("DatasetInput:");
|
---|
50 | _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
|
---|
51 | _printLine_("---inputs: "); inputs->Echo();
|
---|
52 | }
|
---|
53 | /*}}}*/
|
---|
54 | /*FUNCTION DatasetInput::Id{{{*/
|
---|
55 | int DatasetInput::Id(void){ return -1; }
|
---|
56 | /*}}}*/
|
---|
57 | /*FUNCTION DatasetInput::ObjectEnum{{{*/
|
---|
58 | int DatasetInput::ObjectEnum(void){
|
---|
59 |
|
---|
60 | return DatasetInputEnum;
|
---|
61 |
|
---|
62 | }
|
---|
63 | /*}}}*/
|
---|
64 | /*FUNCTION DatasetInput::copy{{{*/
|
---|
65 | Object* DatasetInput::copy() {
|
---|
66 |
|
---|
67 | DatasetInput* output=NULL;
|
---|
68 |
|
---|
69 | output = new DatasetInput();
|
---|
70 | output->enum_type=this->enum_type;
|
---|
71 | output->inputs=(Inputs*)this->inputs->Copy();
|
---|
72 |
|
---|
73 | return output;
|
---|
74 | }
|
---|
75 | /*}}}*/
|
---|
76 | /*FUNCTION DatasetInput::SpawnTriaInput{{{*/
|
---|
77 | Input* DatasetInput::SpawnTriaInput(int* indices){
|
---|
78 |
|
---|
79 | /*output*/
|
---|
80 | DatasetInput* outinput=NULL;
|
---|
81 |
|
---|
82 | /*Create new Datasetinput (copy of current input)*/
|
---|
83 | outinput=new DatasetInput();
|
---|
84 | outinput->enum_type=this->enum_type;
|
---|
85 | outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
|
---|
86 |
|
---|
87 | /*Assign output*/
|
---|
88 | return outinput;
|
---|
89 | }
|
---|
90 | /*}}}*/
|
---|
91 |
|
---|
92 | /*DatasetInput management*/
|
---|
93 | /*FUNCTION DatasetInput::InstanceEnum{{{*/
|
---|
94 | int DatasetInput::InstanceEnum(void){
|
---|
95 |
|
---|
96 | return this->enum_type;
|
---|
97 |
|
---|
98 | }
|
---|
99 | /*}}}*/
|
---|
100 |
|
---|
101 | /*Object functions*/
|
---|
102 | /*FUNCTION DatasetInput::Configure{{{*/
|
---|
103 | void DatasetInput::Configure(Parameters* parameters){
|
---|
104 | /*do nothing: */
|
---|
105 | }
|
---|
106 | /*}}}*/
|
---|
107 | /*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){{{*/
|
---|
108 | void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){
|
---|
109 |
|
---|
110 | /*Get requested input within dataset*/
|
---|
111 | if(index<0 || index > inputs->Size()-1) _error_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")");
|
---|
112 | Input* input=(Input*)this->inputs->GetObjectByOffset(index);
|
---|
113 |
|
---|
114 | input->GetInputValue(pvalue,gauss);
|
---|
115 | }
|
---|
116 | /*}}}*/
|
---|