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

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

CHG: got rid of the include/include.h headere file, finally :)

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