source: issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.cpp@ 12832

Last change on this file since 12832 was 12832, checked in by Eric.Larour, 13 years ago

Almost done migrating objects to classes

File size: 4.6 KB
Line 
1/*!\file PentaP1ElementResult.c
2 * \brief: implementation of the PentaP1ElementResult 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 "./ElementResultLocal.h"
14#include "../../classes.h"
15#include "../../../EnumDefinitions/EnumDefinitions.h"
16#include "../../../shared/shared.h"
17#include "../../../Container/Container.h"
18#include "../../../include/include.h"
19
20/*PentaP1ElementResult constructors and destructor*/
21/*FUNCTION PentaP1ElementResult::PentaP1ElementResult(){{{*/
22PentaP1ElementResult::PentaP1ElementResult(){
23 return;
24}
25/*}}}*/
26/*FUNCTION PentaP1ElementResult::PentaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){{{*/
27PentaP1ElementResult::PentaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){
28
29 int i;
30
31 enum_type=in_enum_type;
32 for(i=0;i<6;i++)values[i]=in_values[i];
33 step=in_step;
34 time=in_time;
35}
36/*}}}*/
37/*FUNCTION PentaP1ElementResult::~PentaP1ElementResult(){{{*/
38PentaP1ElementResult::~PentaP1ElementResult(){
39 return;
40}
41/*}}}*/
42
43/*Object virtual functions definitions:*/
44/*FUNCTION PentaP1ElementResult::Echo {{{*/
45void PentaP1ElementResult::Echo(void){
46 this->DeepEcho();
47}
48/*}}}*/
49/*FUNCTION PentaP1ElementResult::DeepEcho{{{*/
50void PentaP1ElementResult::DeepEcho(void){
51
52 _printLine_("PentaP1ElementResult:");
53 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
54 _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << " " << this->values[3] << " " << this->values[4] << " " << this->values[5] << "]");
55 _printLine_(" step: " << this->step);
56 _printLine_(" time: " << this->time);
57
58}
59/*}}}*/
60/*FUNCTION PentaP1ElementResult::Id{{{*/
61int PentaP1ElementResult::Id(void){ return -1; }
62/*}}}*/
63/*FUNCTION PentaP1ElementResult::MyRank{{{*/
64int PentaP1ElementResult::MyRank(void){
65 extern int my_rank;
66 return my_rank;
67}
68/*}}}*/
69/*FUNCTION PentaP1ElementResult::ObjectEnum{{{*/
70int PentaP1ElementResult::ObjectEnum(void){
71
72 return PentaP1ElementResultEnum;
73
74}
75/*}}}*/
76/*FUNCTION PentaP1ElementResult::copy{{{*/
77Object* PentaP1ElementResult::copy() {
78
79 return new PentaP1ElementResult(this->enum_type,this->values,this->step,this->time);
80
81}
82/*}}}*/
83
84/*ElementResult management*/
85/*FUNCTION PentaP1ElementResult::InstanceEnum{{{*/
86int PentaP1ElementResult::InstanceEnum(void){
87
88 return this->enum_type;
89
90}
91/*}}}*/
92/*FUNCTION PentaP1ElementResult::SpawnTriaElementResult{{{*/
93ElementResult* PentaP1ElementResult::SpawnTriaElementResult(int* indices){
94
95 /*output*/
96 TriaP1ElementResult* outresult=NULL;
97 IssmDouble newvalues[3];
98
99 /*Loop over the new indices*/
100 for(int i=0;i<3;i++){
101
102 /*Check index value*/
103 _assert_(indices[i]>=0 && indices[i]<6);
104
105 /*Assign value to new result*/
106 newvalues[i]=this->values[indices[i]];
107 }
108
109 /*Create new Tria result*/
110 outresult=new TriaP1ElementResult(this->enum_type,&newvalues[0],this->step,this->time);
111
112 /*Assign output*/
113 return outresult;
114
115}
116/*}}}*/
117/*FUNCTION PentaP1ElementResult::ProcessUnits{{{*/
118void PentaP1ElementResult::ProcessUnits(Parameters* parameters){
119
120 UnitConversion(this->values,6,IuToExtEnum,this->enum_type);
121
122}
123/*}}}*/
124/*FUNCTION PentaP1ElementResult::NumberOfNodalValues{{{*/
125int PentaP1ElementResult::NumberOfNodalValues(void){
126 return 6;
127}
128/*}}}*/
129/*FUNCTION PentaP1ElementResult::PatchFill{{{*/
130void PentaP1ElementResult::PatchFill(int row, Patch* patch){
131
132 /*Here, we fill the result information into the patch object. First, let's remember what is in a row
133 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values
134 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */
135 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P1Enum,this->values,6);
136
137}
138/*}}}*/
139/*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{*/
140void PentaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
141
142 IssmDouble data[6];
143
144 if(numdofs!=6)_error2_("Result " << EnumToStringx(this->enum_type) << " is a PentaP1ElementResult and cannot write vector of " << numdofs << " dofs");
145 for(int i=0;i<6;i++) data[i]=this->values[i]/(IssmDouble)connectivitylist[i];
146 vector->SetValues(numdofs,doflist,&data[0],ADD_VAL);
147
148} /*}}}*/
149/*FUNCTION PentaP1ElementResult::GetElementVectorFromResults{{{*/
150void PentaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){
151
152 _error2_("Result " << EnumToStringx(enum_type) << " is a PentaP1ElementResult and should not write vector of size numberofelemenrs");
153} /*}}}*/
Note: See TracBrowser for help on using the repository browser.