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