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