source: issm/trunk/src/c/classes/objects/DependentObject.cpp@ 13975

Last change on this file since 13975 was 13975, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13974

File size: 2.7 KB
Line 
1/*!\file DependentObject.c
2 * \brief: implementation of the DependentObject object
3 */
4
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/*DependentObject constructors and destructor*/
20/*FUNCTION DependentObject::DependentObject(){{{*/
21DependentObject::DependentObject(){
22 this->name=NoneEnum;
23 this->type=0;
24 this->index=-1;
25}
26/*}}}*/
27/*FUNCTION DependentObject::DependentObject(int in_name, int in_type, int in_index){{{*/
28DependentObject::DependentObject(int in_name, int in_type,int in_index){
29
30 this->name=in_name;
31 this->type=in_type;
32 this->index=in_index;
33 if(in_type!=0 && in_type!=1)_error_("cannot create an DependentObject of type " << in_type);
34 if(in_type==1)_error_("not implemented yet!");
35
36}
37/*}}}*/
38/*FUNCTION DependentObject::~DependentObject() {{{*/
39DependentObject::~DependentObject(){ //destructor
40}
41/*}}}*/
42
43/*Object virtual functions definitions:*/
44/*FUNCTION DependentObject::Echo{{{*/
45void DependentObject::Echo(void){
46
47 _printLine_("DependentObject:");
48 _printLine_(" name: " << EnumToStringx(this->name));
49 if(this->type==0)
50 _printLine_(" type: scalar");
51 else if(this->type==1)
52 _printLine_(" type: vertex");
53 else
54 _error_(" unknown type: " << this->type);
55 if(this->index>=0) _printLine_(" index: " << this->index);
56}
57/*}}}*/
58/*FUNCTION DependentObject::DeepEcho{{{*/
59void DependentObject::DeepEcho(void){
60 this->Echo();
61}
62/*}}}*/
63/*FUNCTION DependentObject::Id{{{*/
64int DependentObject::Id(void){ return -1; }
65/*}}}*/
66/*FUNCTION DependentObject::ObjectEnum{{{*/
67int DependentObject::ObjectEnum(void){
68
69 return DependentObjectEnum;
70
71}
72/*}}}*/
73/*FUNCTION DependentObject::copy{{{*/
74Object* DependentObject::copy(void) {
75 return new DependentObject(name,type,index);
76} /*}}}*/
77
78/*DependentObject methods: */
79/*FUNCTION DependentObject::NumDependents{{{*/
80int DependentObject::NumDependents(void){
81
82 /*Branch according to the type of variable: */
83 if(type==0){ /*scalar:*/
84 return 1;
85 }
86 else if(type==1){ /* vector:*/
87 _error_("not implemented yet!");
88 }
89 else _error_("should not have a type of " << type);
90}
91/*}}}*/
92/*FUNCTION DependentObject::Responsex{{{*/
93void DependentObject::Responsex(IssmDouble* poutput_value,FemModel* femmodel){
94
95 if(this->name==MassFluxEnum){
96
97 /*to identify the mass flux that will be computed, we need the index of the profile: */
98 femmodel->parameters->SetParam(this->index,IndexEnum);
99 }
100
101 femmodel->Responsex(poutput_value,this->name,false,0);
102
103}
104/*}}}*/
Note: See TracBrowser for help on using the repository browser.