| 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 "../objects.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,double* in_values,int in_step, double in_time){{{*/
|
|---|
| 27 | PentaP1ElementResult::PentaP1ElementResult(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 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 | printf("PentaP1ElementResult:\n");
|
|---|
| 53 | printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(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 PentaP1ElementResult::Id{{{*/
|
|---|
| 61 | int PentaP1ElementResult::Id(void){ return -1; }
|
|---|
| 62 | /*}}}*/
|
|---|
| 63 | /*FUNCTION PentaP1ElementResult::MyRank{{{*/
|
|---|
| 64 | int PentaP1ElementResult::MyRank(void){
|
|---|
| 65 | extern int my_rank;
|
|---|
| 66 | return my_rank;
|
|---|
| 67 | }
|
|---|
| 68 | /*}}}*/
|
|---|
| 69 | /*FUNCTION PentaP1ElementResult::ObjectEnum{{{*/
|
|---|
| 70 | int PentaP1ElementResult::ObjectEnum(void){
|
|---|
| 71 |
|
|---|
| 72 | return PentaP1ElementResultEnum;
|
|---|
| 73 |
|
|---|
| 74 | }
|
|---|
| 75 | /*}}}*/
|
|---|
| 76 | /*FUNCTION PentaP1ElementResult::copy{{{*/
|
|---|
| 77 | Object* PentaP1ElementResult::copy() {
|
|---|
| 78 |
|
|---|
| 79 | return new PentaP1ElementResult(this->enum_type,this->values,this->step,this->time);
|
|---|
| 80 |
|
|---|
| 81 | }
|
|---|
| 82 | /*}}}*/
|
|---|
| 83 |
|
|---|
| 84 | /*ElementResult management*/
|
|---|
| 85 | /*FUNCTION PentaP1ElementResult::InstanceEnum{{{*/
|
|---|
| 86 | int PentaP1ElementResult::InstanceEnum(void){
|
|---|
| 87 |
|
|---|
| 88 | return this->enum_type;
|
|---|
| 89 |
|
|---|
| 90 | }
|
|---|
| 91 | /*}}}*/
|
|---|
| 92 | /*FUNCTION PentaP1ElementResult::SpawnTriaElementResult{{{*/
|
|---|
| 93 | ElementResult* PentaP1ElementResult::SpawnTriaElementResult(int* indices){
|
|---|
| 94 |
|
|---|
| 95 | /*output*/
|
|---|
| 96 | TriaP1ElementResult* outresult=NULL;
|
|---|
| 97 | double newvalues[3];
|
|---|
| 98 |
|
|---|
| 99 | /*Loop over the new indices*/
|
|---|
| 100 | for(int i=0;i<3;i++){
|
|---|
| 101 |
|
|---|
| 102 | /*Check index value*/
|
|---|
| 103 | _assert_(indices[i]>=0 && indices[i]<6);
|
|---|
| 104 |
|
|---|
| 105 | /*Assign value to new result*/
|
|---|
| 106 | newvalues[i]=this->values[indices[i]];
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | /*Create new Tria result*/
|
|---|
| 110 | outresult=new TriaP1ElementResult(this->enum_type,&newvalues[0],this->step,this->time);
|
|---|
| 111 |
|
|---|
| 112 | /*Assign output*/
|
|---|
| 113 | return outresult;
|
|---|
| 114 |
|
|---|
| 115 | }
|
|---|
| 116 | /*}}}*/
|
|---|
| 117 | /*FUNCTION PentaP1ElementResult::ProcessUnits{{{*/
|
|---|
| 118 | void PentaP1ElementResult::ProcessUnits(Parameters* parameters){
|
|---|
| 119 |
|
|---|
| 120 | UnitConversion(this->values,6,IuToExtEnum,this->enum_type);
|
|---|
| 121 |
|
|---|
| 122 | }
|
|---|
| 123 | /*}}}*/
|
|---|
| 124 | /*FUNCTION PentaP1ElementResult::NumberOfNodalValues{{{*/
|
|---|
| 125 | int PentaP1ElementResult::NumberOfNodalValues(void){
|
|---|
| 126 | return 6;
|
|---|
| 127 | }
|
|---|
| 128 | /*}}}*/
|
|---|
| 129 | /*FUNCTION PentaP1ElementResult::PatchFill{{{*/
|
|---|
| 130 | void PentaP1ElementResult::PatchFill(int row, Patch* patch){
|
|---|
| 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 | /*}}}*/
|
|---|
| 139 | /*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{*/
|
|---|
| 140 | void PentaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
|
|---|
| 141 |
|
|---|
| 142 | double data[6];
|
|---|
| 143 |
|
|---|
| 144 | if(numdofs!=6)_error_("Result %s is a PentaP1ElementResult and cannot write vector of %i dofs",numdofs);
|
|---|
| 145 | for(int i=0;i<6;i++) data[i]=this->values[i]/(double)connectivitylist[i];
|
|---|
| 146 | vector->SetValues(numdofs,doflist,&data[0],ADD_VAL);
|
|---|
| 147 |
|
|---|
| 148 | } /*}}}*/
|
|---|
| 149 | /*FUNCTION PentaP1ElementResult::GetElementVectorFromResults{{{*/
|
|---|
| 150 | void PentaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){
|
|---|
| 151 |
|
|---|
| 152 | _error_("Result %s is a PentaP1ElementResult and should not write vector of size numberofelemenrs",EnumToStringx(enum_type));
|
|---|
| 153 | } /*}}}*/
|
|---|