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::MyRank{{{*/
|
---|
58 | int DatasetInput::MyRank(void){
|
---|
59 | extern int my_rank;
|
---|
60 | return my_rank;
|
---|
61 | }
|
---|
62 | /*}}}*/
|
---|
63 | /*FUNCTION DatasetInput::ObjectEnum{{{*/
|
---|
64 | int DatasetInput::ObjectEnum(void){
|
---|
65 |
|
---|
66 | return DatasetInputEnum;
|
---|
67 |
|
---|
68 | }
|
---|
69 | /*}}}*/
|
---|
70 | /*FUNCTION DatasetInput::copy{{{*/
|
---|
71 | Object* DatasetInput::copy() {
|
---|
72 |
|
---|
73 | DatasetInput* output=NULL;
|
---|
74 |
|
---|
75 | output = new DatasetInput();
|
---|
76 | output->enum_type=this->enum_type;
|
---|
77 | output->inputs=(Inputs*)this->inputs->Copy();
|
---|
78 |
|
---|
79 | return output;
|
---|
80 | }
|
---|
81 | /*}}}*/
|
---|
82 | /*FUNCTION DatasetInput::SpawnTriaInput{{{*/
|
---|
83 | Input* DatasetInput::SpawnTriaInput(int* indices){
|
---|
84 |
|
---|
85 | /*output*/
|
---|
86 | DatasetInput* outinput=NULL;
|
---|
87 |
|
---|
88 | /*Create new Datasetinput (copy of current input)*/
|
---|
89 | outinput=new DatasetInput();
|
---|
90 | outinput->enum_type=this->enum_type;
|
---|
91 | outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
|
---|
92 |
|
---|
93 | /*Assign output*/
|
---|
94 | return outinput;
|
---|
95 | }
|
---|
96 | /*}}}*/
|
---|
97 |
|
---|
98 | /*DatasetInput management*/
|
---|
99 | /*FUNCTION DatasetInput::InstanceEnum{{{*/
|
---|
100 | int DatasetInput::InstanceEnum(void){
|
---|
101 |
|
---|
102 | return this->enum_type;
|
---|
103 |
|
---|
104 | }
|
---|
105 | /*}}}*/
|
---|
106 |
|
---|
107 | /*Object functions*/
|
---|
108 | /*FUNCTION DatasetInput::Configure{{{*/
|
---|
109 | void DatasetInput::Configure(Parameters* parameters){
|
---|
110 | /*do nothing: */
|
---|
111 | }
|
---|
112 | /*}}}*/
|
---|
113 | /*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){{{*/
|
---|
114 | void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){
|
---|
115 |
|
---|
116 | /*Get requested input within dataset*/
|
---|
117 | if(index<0 || index > inputs->Size()-1) _error_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")");
|
---|
118 | Input* input=(Input*)this->inputs->GetObjectByOffset(index);
|
---|
119 |
|
---|
120 | input->GetInputValue(pvalue,gauss);
|
---|
121 | }
|
---|
122 | /*}}}*/
|
---|