source: issm/branches/trunk-jpl-damage/src/c/objects/Inputs/DatasetInput.cpp@ 12168

Last change on this file since 12168 was 12168, checked in by cborstad, 13 years ago

merged trunk-jpl into branch through revision 12167

File size: 2.9 KB
Line 
1/*!\file DatasetInput.c
2 * \brief: implementation of the datasetinput object
3 */
4/*Headers{{{1*/
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(){{{1*/
22DatasetInput::DatasetInput(){
23 enum_type=UNDEF;
24 inputs=NULL;
25}
26/*}}}*/
27/*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{1*/
28DatasetInput::DatasetInput(int in_enum_type){
29
30 enum_type = in_enum_type;
31 inputs = new Inputs();
32}
33/*}}}*/
34/*FUNCTION DatasetInput::~DatasetInput(){{{1*/
35DatasetInput::~DatasetInput(){
36 delete inputs;
37}
38/*}}}*/
39
40/*Object virtual functions definitions:*/
41 /*FUNCTION DatasetInput::Echo {{{1*/
42void DatasetInput::Echo(void){
43 this->DeepEcho();
44}
45/*}}}*/
46/*FUNCTION DatasetInput::DeepEcho{{{1*/
47void DatasetInput::DeepEcho(void){
48
49 printf("DatasetInput:\n");
50 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));
51 printf("---inputs: \n"); inputs->Echo();
52}
53/*}}}*/
54/*FUNCTION DatasetInput::Id{{{1*/
55int DatasetInput::Id(void){ return -1; }
56/*}}}*/
57/*FUNCTION DatasetInput::MyRank{{{1*/
58int DatasetInput::MyRank(void){
59 extern int my_rank;
60 return my_rank;
61}
62/*}}}*/
63/*FUNCTION DatasetInput::ObjectEnum{{{1*/
64int DatasetInput::ObjectEnum(void){
65
66 return DatasetInputEnum;
67
68}
69/*}}}*/
70/*FUNCTION DatasetInput::copy{{{1*/
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{{{1*/
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{{{1*/
100int DatasetInput::InstanceEnum(void){
101
102 return this->enum_type;
103
104}
105/*}}}*/
106
107/*Object functions*/
108/*FUNCTION DatasetInput::Configure{{{1*/
109void DatasetInput::Configure(Parameters* parameters){
110 /*do nothing: */
111}
112/*}}}*/
113/*FUNCTION DatasetInput::GetInputValue(double* pvalue,GaussTria* gauss,int index){{{1*/
114void DatasetInput::GetInputValue(double* pvalue,GaussTria* gauss,int index){
115
116 /*Get requested input within dataset*/
117 if(index<0 || index > inputs->Size()-1) _error_("index requested (%i) exceeds dataset size (%i)",index,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.