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

Last change on this file since 4899 was 4899, checked in by seroussi, 15 years ago

removed all Sing elements

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