[4050] | 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"
|
---|
[4236] | 17 | #include "../../Container/Container.h"
|
---|
[4050] | 18 | #include "../../include/include.h"
|
---|
| 19 |
|
---|
[4248] | 20 | /*PentaVertexElementResult constructors and destructor*/
|
---|
[4050] | 21 | /*FUNCTION PentaVertexElementResult::PentaVertexElementResult(){{{1*/
|
---|
| 22 | PentaVertexElementResult::PentaVertexElementResult(){
|
---|
| 23 | return;
|
---|
| 24 | }
|
---|
| 25 | /*}}}*/
|
---|
| 26 | /*FUNCTION PentaVertexElementResult::PentaVertexElementResult(int in_enum_type,double* in_values,int in_step, double in_time){{{1*/
|
---|
[4239] | 27 | PentaVertexElementResult::PentaVertexElementResult(int in_enum_type,double* in_values,int in_step, double in_time){
|
---|
[4050] | 28 |
|
---|
[4239] | 29 | int i;
|
---|
| 30 |
|
---|
| 31 | enum_type=in_enum_type;
|
---|
| 32 | for(i=0;i<6;i++)values[i]=in_values[i];
|
---|
[4050] | 33 | step=in_step;
|
---|
| 34 | time=in_time;
|
---|
| 35 | }
|
---|
| 36 | /*}}}*/
|
---|
| 37 | /*FUNCTION PentaVertexElementResult::~PentaVertexElementResult(){{{1*/
|
---|
| 38 | PentaVertexElementResult::~PentaVertexElementResult(){
|
---|
| 39 | return;
|
---|
| 40 | }
|
---|
| 41 | /*}}}*/
|
---|
| 42 |
|
---|
[4248] | 43 | /*Object virtual functions definitions:*/
|
---|
| 44 | /*FUNCTION PentaVertexElementResult::Echo {{{1*/
|
---|
| 45 | void PentaVertexElementResult::Echo(void){
|
---|
| 46 | this->DeepEcho();
|
---|
[4050] | 47 | }
|
---|
| 48 | /*}}}*/
|
---|
| 49 | /*FUNCTION PentaVertexElementResult::DeepEcho{{{1*/
|
---|
| 50 | void PentaVertexElementResult::DeepEcho(void){
|
---|
| 51 |
|
---|
| 52 | printf("PentaVertexElementResult:\n");
|
---|
[5103] | 53 | printf(" enum: %i (%s)\n",this->enum_type,EnumToString(this->enum_type));
|
---|
[4239] | 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]);
|
---|
[4050] | 55 | printf(" step: %i\n",this->step);
|
---|
| 56 | printf(" time: %g\n",this->time);
|
---|
| 57 |
|
---|
| 58 | }
|
---|
| 59 | /*}}}*/
|
---|
[4248] | 60 | /*FUNCTION PentaVertexElementResult::Id{{{1*/
|
---|
| 61 | int PentaVertexElementResult::Id(void){ return -1; }
|
---|
[4050] | 62 | /*}}}*/
|
---|
[4248] | 63 | /*FUNCTION PentaVertexElementResult::MyRank{{{1*/
|
---|
| 64 | int PentaVertexElementResult::MyRank(void){
|
---|
| 65 | extern int my_rank;
|
---|
| 66 | return my_rank;
|
---|
[4050] | 67 | }
|
---|
| 68 | /*}}}*/
|
---|
| 69 | /*FUNCTION PentaVertexElementResult::Marshall{{{1*/
|
---|
| 70 | void 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*/
|
---|
| 94 | int 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 | /*}}}*/
|
---|
[4248] | 103 | /*FUNCTION PentaVertexElementResult::Demarshall{{{1*/
|
---|
| 104 | void 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;
|
---|
[4050] | 122 | }
|
---|
| 123 | /*}}}*/
|
---|
[4248] | 124 | /*FUNCTION PentaVertexElementResult::Enum{{{1*/
|
---|
| 125 | int PentaVertexElementResult::Enum(void){
|
---|
[4050] | 126 |
|
---|
[4248] | 127 | return PentaVertexElementResultEnum;
|
---|
| 128 |
|
---|
| 129 | }
|
---|
| 130 | /*}}}*/
|
---|
| 131 | /*FUNCTION PentaVertexElementResult::copy{{{1*/
|
---|
| 132 | Object* 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*/
|
---|
| 141 | int PentaVertexElementResult::EnumType(void){
|
---|
| 142 |
|
---|
| 143 | return this->enum_type;
|
---|
| 144 |
|
---|
| 145 | }
|
---|
| 146 | /*}}}*/
|
---|
[4050] | 147 | /*FUNCTION PentaVertexElementResult::SpawnTriaElementResult{{{1*/
|
---|
| 148 | ElementResult* PentaVertexElementResult::SpawnTriaElementResult(int* indices){
|
---|
| 149 |
|
---|
| 150 | /*output*/
|
---|
| 151 | TriaVertexElementResult* outresult=NULL;
|
---|
| 152 | double newvalues[3];
|
---|
| 153 |
|
---|
| 154 | /*Loop over the new indices*/
|
---|
| 155 | for(int i=0;i<3;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 Tria result*/
|
---|
| 165 | outresult=new TriaVertexElementResult(this->enum_type,&newvalues[0],this->step,this->time);
|
---|
| 166 |
|
---|
| 167 | /*Assign output*/
|
---|
| 168 | return outresult;
|
---|
| 169 |
|
---|
| 170 | }
|
---|
| 171 | /*}}}*/
|
---|
[4546] | 172 | /*FUNCTION PentaVertexElementResult::ProcessUnits{{{1*/
|
---|
[4050] | 173 | void PentaVertexElementResult::ProcessUnits(Parameters* parameters){
|
---|
| 174 |
|
---|
| 175 | NodalValuesUnitConversion(this->values,6,this->enum_type,parameters);
|
---|
| 176 |
|
---|
| 177 | }
|
---|
| 178 | /*}}}*/
|
---|
[4546] | 179 | /*FUNCTION PentaVertexElementResult::NumberOfNodalValues{{{1*/
|
---|
[4050] | 180 | int PentaVertexElementResult::NumberOfNodalValues(void){
|
---|
| 181 | return 6;
|
---|
| 182 | }
|
---|
| 183 | /*}}}*/
|
---|
[4546] | 184 | /*FUNCTION PentaVertexElementResult::PatchFill{{{1*/
|
---|
[4050] | 185 | void PentaVertexElementResult::PatchFill(int row, Patch* patch){
|
---|
| 186 |
|
---|
| 187 | /*Here, we fill the result information into the patch object. First, let's remember what is in a row
|
---|
| 188 | * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values
|
---|
| 189 | * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */
|
---|
| 190 | patch->fillresultinfo(row,this->enum_type,this->step,this->time,P1Enum,this->values,6);
|
---|
| 191 |
|
---|
| 192 | }
|
---|
| 193 | /*}}}*/
|
---|