source: issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp@ 4050

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

Split results between element results and external results.
element results are held in the Results* dataset of each element.
external results are held in the femmodel->Results* dataset, and hold anything that cannot fit in the elements.

File size: 6.7 KB
Line 
1/*!\file PentaVertexElementResult.c
2 * \brief: implementation of the PentaVertexElementResult 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 "../objects.h"
15#include "../../EnumDefinitions/EnumDefinitions.h"
16#include "../../shared/shared.h"
17#include "../../DataSet/DataSet.h"
18#include "../../include/include.h"
19
20/*Object constructors and destructor*/
21/*FUNCTION PentaVertexElementResult::PentaVertexElementResult(){{{1*/
22PentaVertexElementResult::PentaVertexElementResult(){
23 return;
24}
25/*}}}*/
26/*FUNCTION PentaVertexElementResult::PentaVertexElementResult(int in_enum_type,double* in_values,int in_step, double in_time){{{1*/
27PentaVertexElementResult::PentaVertexElementResult(int in_enum_type,double* in_values,int in_step, double in_time): PentaVertexInput(in_enum_type,in_values){
28
29 step=in_step;
30 time=in_time;
31}
32/*}}}*/
33/*FUNCTION PentaVertexElementResult::~PentaVertexElementResult(){{{1*/
34PentaVertexElementResult::~PentaVertexElementResult(){
35 return;
36}
37/*}}}*/
38
39/*Object management*/
40/*FUNCTION PentaVertexElementResult::copy{{{1*/
41Object* PentaVertexElementResult::copy() {
42
43 return new PentaVertexElementResult(this->enum_type,this->values,this->step,this->time);
44
45}
46/*}}}*/
47/*FUNCTION PentaVertexElementResult::DeepEcho{{{1*/
48void PentaVertexElementResult::DeepEcho(void){
49
50 printf("PentaVertexElementResult:\n");
51 PentaVertexElementResult::DeepEcho();
52 printf(" step: %i\n",this->step);
53 printf(" time: %g\n",this->time);
54
55}
56/*}}}*/
57/*FUNCTION PentaVertexElementResult::Demarshall{{{1*/
58void PentaVertexElementResult::Demarshall(char** pmarshalled_dataset){
59
60 char* marshalled_dataset=NULL;
61 int i;
62
63 /*recover marshalled_dataset: */
64 marshalled_dataset=*pmarshalled_dataset;
65
66 /*this time, no need to get enum type, the pointer directly points to the beginning of the
67 *object data (thanks to DataSet::Demarshall):*/
68 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
69 memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
70 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
71 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
72
73 /*return: */
74 *pmarshalled_dataset=marshalled_dataset;
75 return;
76}
77/*}}}*/
78/*FUNCTION PentaVertexElementResult::Echo {{{1*/
79void PentaVertexElementResult::Echo(void){
80 this->DeepEcho();
81}
82/*}}}*/
83/*FUNCTION PentaVertexElementResult::Enum{{{1*/
84int PentaVertexElementResult::Enum(void){
85
86 return PentaVertexElementResultEnum;
87
88}
89/*}}}*/
90/*FUNCTION PentaVertexElementResult::EnumType{{{1*/
91int PentaVertexElementResult::EnumType(void){
92
93 return this->enum_type;
94
95}
96/*}}}*/
97/*FUNCTION PentaVertexElementResult::Id{{{1*/
98int PentaVertexElementResult::Id(void){ return -1; }
99/*}}}*/
100/*FUNCTION PentaVertexElementResult::Marshall{{{1*/
101void PentaVertexElementResult::Marshall(char** pmarshalled_dataset){
102
103 char* marshalled_dataset=NULL;
104 int enum_value=0;
105
106 /*recover marshalled_dataset: */
107 marshalled_dataset=*pmarshalled_dataset;
108
109 /*get enum value of PentaVertexElementResult: */
110 enum_value=PentaVertexElementResultEnum;
111
112 /*marshall enum: */
113 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
114
115 /*marshall PentaVertexElementResult data: */
116 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
117 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
118 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
119 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
120
121 *pmarshalled_dataset=marshalled_dataset;
122}
123/*}}}*/
124/*FUNCTION PentaVertexElementResult::MarshallSize{{{1*/
125int PentaVertexElementResult::MarshallSize(){
126
127 return sizeof(values)+
128 +sizeof(enum_type)
129 +sizeof(time)
130 +sizeof(step)
131 +sizeof(int); //sizeof(int) for enum value
132}
133/*}}}*/
134/*FUNCTION PentaVertexElementResult::MyRank{{{1*/
135int PentaVertexElementResult::MyRank(void){
136 extern int my_rank;
137 return my_rank;
138}
139/*}}}*/
140
141/*ElementResult functions*/
142/*FUNCTION PentaVertexElementResult::SpawnSingElementResult{{{1*/
143ElementResult* PentaVertexElementResult::SpawnSingElementResult(int index){
144
145 /*output*/
146 SingVertexElementResult* outresult=NULL;
147
148 /*Create new Sing result (copy of current result)*/
149 ISSMASSERT(index<6 && index>=0);
150 outresult=new SingVertexElementResult(this->enum_type,this->values[index],this->step,this->time);
151
152 /*Assign output*/
153 return outresult;
154
155}
156/*}}}*/
157/*FUNCTION PentaVertexElementResult::SpawnBeamElementResult{{{1*/
158ElementResult* PentaVertexElementResult::SpawnBeamElementResult(int* indices){
159
160 /*output*/
161 BeamVertexElementResult* outresult=NULL;
162 double newvalues[2];
163
164 /*Loop over the new indices*/
165 for(int i=0;i<2;i++){
166
167 /*Check index value*/
168 ISSMASSERT(indices[i]>=0 && indices[i]<6);
169
170 /*Assign value to new result*/
171 newvalues[i]=this->values[indices[i]];
172 }
173
174 /*Create new Beam result*/
175 outresult=new BeamVertexElementResult(this->enum_type,&newvalues[0],this->step,this->time);
176
177 /*Assign output*/
178 return outresult;
179
180}
181/*}}}*/
182/*FUNCTION PentaVertexElementResult::SpawnTriaElementResult{{{1*/
183ElementResult* PentaVertexElementResult::SpawnTriaElementResult(int* indices){
184
185 /*output*/
186 TriaVertexElementResult* outresult=NULL;
187 double newvalues[3];
188
189 /*Loop over the new indices*/
190 for(int i=0;i<3;i++){
191
192 /*Check index value*/
193 ISSMASSERT(indices[i]>=0 && indices[i]<6);
194
195 /*Assign value to new result*/
196 newvalues[i]=this->values[indices[i]];
197 }
198
199 /*Create new Tria result*/
200 outresult=new TriaVertexElementResult(this->enum_type,&newvalues[0],this->step,this->time);
201
202 /*Assign output*/
203 return outresult;
204
205}
206/*}}}*/
207/*FUNCTION PentaVertexElementResult::ProcessUnits(Parameters* parameters){{{1*/
208void PentaVertexElementResult::ProcessUnits(Parameters* parameters){
209
210 NodalValuesUnitConversion(this->values,6,this->enum_type,parameters);
211
212}
213/*}}}*/
214/*FUNCTION PentaVertexElementResult::NumberOfNodalValues(void){{{1*/
215int PentaVertexElementResult::NumberOfNodalValues(void){
216 return 6;
217}
218/*}}}*/
219/*FUNCTION PentaVertexElementResult::PentaVertexElementResult::PatchFill(int row, Patch* patch){{{1*/
220void PentaVertexElementResult::PatchFill(int row, Patch* patch){
221
222 /*Here, we fill the result information into the patch object. First, let's remember what is in a row
223 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values
224 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */
225 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P1Enum,this->values,6);
226
227}
228/*}}}*/
Note: See TracBrowser for help on using the repository browser.