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