[13426] | 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(){{{*/
|
---|
| 21 | DependentObject::DependentObject(){
|
---|
| 22 | this->name=NoneEnum;
|
---|
| 23 | this->type=0;
|
---|
[13483] | 24 | this->index=-1;
|
---|
[13426] | 25 | }
|
---|
| 26 | /*}}}*/
|
---|
[13483] | 27 | /*FUNCTION DependentObject::DependentObject(int in_name, int in_type, int in_index){{{*/
|
---|
| 28 | DependentObject::DependentObject(int in_name, int in_type,int in_index){
|
---|
[13426] | 29 |
|
---|
| 30 | this->name=in_name;
|
---|
| 31 | this->type=in_type;
|
---|
[13483] | 32 | this->index=in_index;
|
---|
[13426] | 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() {{{*/
|
---|
| 39 | DependentObject::~DependentObject(){ //destructor
|
---|
| 40 | }
|
---|
| 41 | /*}}}*/
|
---|
| 42 |
|
---|
| 43 | /*Object virtual functions definitions:*/
|
---|
| 44 | /*FUNCTION DependentObject::Echo{{{*/
|
---|
| 45 | void 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);
|
---|
[13483] | 55 | if(this->index>=0) _printLine_(" index: " << this->index);
|
---|
[13426] | 56 | }
|
---|
| 57 | /*}}}*/
|
---|
| 58 | /*FUNCTION DependentObject::DeepEcho{{{*/
|
---|
| 59 | void DependentObject::DeepEcho(void){
|
---|
| 60 | this->Echo();
|
---|
| 61 | }
|
---|
| 62 | /*}}}*/
|
---|
| 63 | /*FUNCTION DependentObject::Id{{{*/
|
---|
| 64 | int DependentObject::Id(void){ return -1; }
|
---|
| 65 | /*}}}*/
|
---|
| 66 | /*FUNCTION DependentObject::ObjectEnum{{{*/
|
---|
| 67 | int DependentObject::ObjectEnum(void){
|
---|
| 68 |
|
---|
| 69 | return DependentObjectEnum;
|
---|
| 70 |
|
---|
| 71 | }
|
---|
| 72 | /*}}}*/
|
---|
| 73 | /*FUNCTION DependentObject::copy{{{*/
|
---|
| 74 | Object* DependentObject::copy(void) {
|
---|
[13483] | 75 | return new DependentObject(name,type,index);
|
---|
[13426] | 76 | } /*}}}*/
|
---|
| 77 |
|
---|
| 78 | /*DependentObject methods: */
|
---|
| 79 | /*FUNCTION DependentObject::NumDependents{{{*/
|
---|
| 80 | int 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 | /*}}}*/
|
---|
[13483] | 92 | /*FUNCTION DependentObject::Responsex{{{*/
|
---|
[13699] | 93 | void DependentObject::Responsex(IssmDouble* poutput_value,FemModel* femmodel){
|
---|
[13483] | 94 |
|
---|
| 95 | if(this->name==MassFluxEnum){
|
---|
| 96 |
|
---|
| 97 | /*to identify the mass flux that will be computed, we need the index of the profile: */
|
---|
[13699] | 98 | femmodel->parameters->SetParam(this->index,IndexEnum);
|
---|
[13483] | 99 | }
|
---|
[13622] | 100 |
|
---|
[13699] | 101 | femmodel->Responsex(poutput_value,this->name,false,0);
|
---|
[13483] | 102 |
|
---|
| 103 | }
|
---|
| 104 | /*}}}*/
|
---|