source: issm/trunk-jpl/src/c/classes/objects/Inputs/DatasetInput.cpp@ 12822

Last change on this file since 12822 was 12530, checked in by utke, 13 years ago

in the first round the assumption was made that the inputs remain passive but in the second round after discussion with M. Morlighem all inputs were consistently made active with the exception of the xyz_list arguments

File size: 2.9 KB
Line 
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 "../objects.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(){{{*/
22DatasetInput::DatasetInput(){
23 enum_type=UNDEF;
24 inputs=NULL;
25}
26/*}}}*/
27/*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{*/
28DatasetInput::DatasetInput(int in_enum_type){
29
30 enum_type = in_enum_type;
31 inputs = new Inputs();
32}
33/*}}}*/
34/*FUNCTION DatasetInput::~DatasetInput(){{{*/
35DatasetInput::~DatasetInput(){
36 delete inputs;
37}
38/*}}}*/
39
40/*Object virtual functions definitions:*/
41 /*FUNCTION DatasetInput::Echo {{{*/
42void DatasetInput::Echo(void){
43 this->DeepEcho();
44}
45/*}}}*/
46/*FUNCTION DatasetInput::DeepEcho{{{*/
47void 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{{{*/
55int DatasetInput::Id(void){ return -1; }
56/*}}}*/
57/*FUNCTION DatasetInput::MyRank{{{*/
58int DatasetInput::MyRank(void){
59 extern int my_rank;
60 return my_rank;
61}
62/*}}}*/
63/*FUNCTION DatasetInput::ObjectEnum{{{*/
64int DatasetInput::ObjectEnum(void){
65
66 return DatasetInputEnum;
67
68}
69/*}}}*/
70/*FUNCTION DatasetInput::copy{{{*/
71Object* 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{{{*/
83Input* 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{{{*/
100int DatasetInput::InstanceEnum(void){
101
102 return this->enum_type;
103
104}
105/*}}}*/
106
107/*Object functions*/
108/*FUNCTION DatasetInput::Configure{{{*/
109void DatasetInput::Configure(Parameters* parameters){
110 /*do nothing: */
111}
112/*}}}*/
113/*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){{{*/
114void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){
115
116 /*Get requested input within dataset*/
117 if(index<0 || index > inputs->Size()-1) _error2_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")");
118 Input* input=(Input*)this->inputs->GetObjectByOffset(index);
119
120 input->GetInputValue(pvalue,gauss);
121}
122/*}}}*/
Note: See TracBrowser for help on using the repository browser.