00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <iostream>
00023
00024 #include "fem/fem.h"
00025 #include "fem/ele/tet10equilib.h"
00026 #include "linalg/vector.h"
00027
00028 using std::cout;
00029 using std::endl;
00030 using LinAlg::Vector;
00031
00032 int main(int argc, char **argv) try
00033 {
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00069 Array<REAL> sub_cam_prms;
00070 sub_cam_prms.push_back(0.0891);
00071 sub_cam_prms.push_back(0.0196);
00072 sub_cam_prms.push_back(0.20);
00073 sub_cam_prms.push_back(3.2);
00074 sub_cam_prms.push_back(5000);
00075
00077 Array<REAL> ini_data;
00078 Array<Array<REAL> > ini_vals;
00079 ini_data.push_back(2);
00080 ini_data.push_back(2);
00081 ini_data.push_back(2);
00082 ini_data.push_back(1.691);
00083 ini_data.push_back(1);
00084 ini_vals.push_back(ini_data);
00085
00087 Array<FEM::Node> N;
00088 N.resize(10);
00089 N[0].Initialize(0, 0, 0, 0);
00090 N[1].Initialize(1, 10, 0, 0);
00091 N[2].Initialize(2, 0,10, 0);
00092 N[3].Initialize(3, 0, 0,10);
00093 N[4].Initialize(4, 5, 0, 0);
00094 N[5].Initialize(5, 5, 5, 0);
00095 N[6].Initialize(6, 0, 5, 0);
00096 N[7].Initialize(7, 0, 0, 5);
00097 N[8].Initialize(8, 5, 0, 5);
00098 N[9].Initialize(9, 0, 5, 5);
00099
00101 FEM::Tet10Equilib E;
00102
00103
00104 for (int i=0; i<10; ++i)
00105 E.SetNode(i, &N[i]);
00106
00107
00108 E.ReAllocateModel("SubCam", sub_cam_prms, ini_vals);
00109
00111
00112
00113 Array<FEM::Node*> a_ptr_face_nodes;
00114 a_ptr_face_nodes.push_back( &N[1] );
00115 a_ptr_face_nodes.push_back( &N[2] );
00116 a_ptr_face_nodes.push_back( &N[3] );
00117 a_ptr_face_nodes.push_back( &N[5] );
00118 a_ptr_face_nodes.push_back( &N[9] );
00119 a_ptr_face_nodes.push_back( &N[8] );
00120
00121
00122 String str_dof_name;
00123 Vector<REAL> a_nodal_values;
00124 E.CalcFaceNodalValues("tz" ,
00125 -10 ,
00126 a_ptr_face_nodes,
00127 str_dof_name ,
00128 a_nodal_values );
00129
00130
00131 for (int m=0; m<6; ++m)
00132 {
00133
00134 FEM::Node::DOFVarsStruct & dof_var = a_ptr_face_nodes[m]->DOFVar(str_dof_name);
00135
00136
00137 dof_var.NaturalBry += a_nodal_values(m);
00138 dof_var.IsEssenPresc = false;
00139 }
00140
00142
00143 cout << "str_dof_name = " << str_dof_name << endl;
00144 cout << "Vector of nodal values=\n" << a_nodal_values << endl;
00145
00146 cout << "Nodes=\n";
00147 for (int i=0; i<10; ++i) cout << N[i];
00148
00149 return 0;
00150 }
00151 catch (Exception * e)
00152 {
00153 e->Cout();
00154 if (e->IsFatal()) exit(1);
00155 delete e;
00156 }
00157 catch (char const * s)
00158 {
00159 cout << "[1;31m Fatal:" << s << "[0m\n";
00160 exit(1);
00161 }
00162
00163