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