51 #include "rheolef/rheostream.h"
52 #include "rheolef/iorheo.h"
73 _side_basis(side_basis),
86 warning_macro(
"continuous approximation restricted to sides not yet supported");
96 base::_ndof_on_subgeo [
d].fill (0);
97 base::_nnod_on_subgeo [
d].fill (0);
105 base::_ndof_on_subgeo [
d][subgeo_variant] = _side_basis.ndof_on_subgeo (
d-1, subgeo_variant);
106 base::_nnod_on_subgeo [
d][subgeo_variant] = _side_basis.nnod_on_subgeo (
d-1, subgeo_variant);
109 bool is_continuous =
false;
110 base::_helper_discontinuous_ndof_on_subgeo_inplace_change (is_continuous, base::_ndof_on_subgeo);
111 base::_helper_discontinuous_ndof_on_subgeo_inplace_change (is_continuous, base::_nnod_on_subgeo);
112 base::_helper_initialize_first_ixxx_by_dimension_from_nxxx_on_subgeo (base::_ndof_on_subgeo, base::_first_idof_by_dimension);
113 base::_helper_initialize_first_ixxx_by_dimension_from_nxxx_on_subgeo (base::_nnod_on_subgeo, base::_first_inod_by_dimension);
124 _first_sid_idof [
variant].fill (0);
126 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& tilde_node = _hat_node [
variant];
127 tilde_node.resize (loc_nnod);
129 for (
size_type loc_isid = 0, loc_nsid = tilde_K.
n_side(); loc_isid < loc_nsid; ++loc_isid) {
132 const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& side_hat_node = _side_basis.hat_node (hat_S);
134 for (
size_type loc_sid_inod = 0; loc_sid_inod < loc_sid_nnod; ++loc_sid_inod) {
136 size_type loc_inod = loc_first_sid_inod + loc_sid_inod;
139 loc_first_sid_inod += loc_sid_nnod;
140 _first_sid_idof [
variant][loc_isid+1] = loc_first_sid_inod;
145 const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&
148 base::_initialize_data_guard (hat_K);
149 return _hat_node [hat_K.
variant()];
160 Eigen::Matrix<T,Eigen::Dynamic,1>&
value)
const
162 base::_initialize_data_guard (tilde_K);
165 value.resize (loc_ndof);
169 _side_basis.evaluate (hat_S, hat_x, _sid_value);
170 for (
size_type loc_sid_idof = 0, loc_sid_ndof = _sid_value.size(); loc_sid_idof < loc_sid_ndof; ++loc_sid_idof) {
171 size_type loc_idof = loc_first_sid_idof + loc_sid_idof;
172 value [loc_idof] = _sid_value [loc_sid_idof];
182 base::_initialize_data_guard (tilde_K);
191 Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof)
const
193 base::_initialize_data_guard (tilde_K);
198 loc_idof.resize (loc_sid_nnod);
199 for (
size_type loc_sid_inod = 0; loc_sid_inod < loc_sid_nnod; ++loc_sid_inod) {
200 loc_idof [loc_sid_inod] = first_loc_inod + loc_sid_inod;
208 const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod,
209 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
const
211 check_macro (is_nodal(),
"_compute_dofs: only supported for nodal basis");
221 bool verbose = iorheo::getverbose(os);
222 bool clean = iorheo::getclean(os);
223 bool execute = iorheo::getexecute(os);
224 size_type nsub = iorheo::getsubdivide(os);
225 if (nsub <= 1) nsub = 20;
233 string plot_name =
basename +
".plot";
234 string gdat_name =
basename +
".gdat";
235 ofstream plot (plot_name.c_str());
236 cerr <<
"! file \"" << plot_name <<
"\" created" << endl;
237 filelist +=
" " + plot_name;
240 plot <<
"gdat = \"" << gdat_name <<
"\"" << endl
241 <<
"set colors classic" << endl
242 <<
"set size square" << endl
243 <<
"pause_duration = 1.5" << endl
244 <<
"set view 55, 145" << endl
247 plot <<
"set xrange [-0.1:1.1]" << endl
248 <<
"set yrange [-0.1:1.1]" << endl
249 <<
"set zrange [-1.1:1.1]" << endl
250 <<
"set arrow from 0,0,0 to 1,0,0 nohead lc 0" << endl
251 <<
"set arrow from 1,0,0 to 0,1,0 nohead lc 0" << endl
252 <<
"set arrow from 0,1,0 to 0,0,0 nohead lc 0" << endl
255 plot <<
"set xrange [-1.1:1.1]" << endl
256 <<
"set yrange [-1.1:1.1]" << endl
257 <<
"set zrange [-1.1:1.1]" << endl
258 <<
"set arrow from -1,-1,0 to 1,-1,0 nohead lc 0" << endl
259 <<
"set arrow from 1,-1,0 to 1, 1,0 nohead lc 0" << endl
260 <<
"set arrow from 1, 1,0 to -1, 1,0 nohead lc 0" << endl
261 <<
"set arrow from -1, 1,0 to -1,-1,0 nohead lc 0" << endl
264 plot <<
"do for [loc_isid=0:"<<tilde_K.
n_side()-1<<
"] {" << endl
265 <<
" loc_sid_ndof=" << degree()+1 << endl
266 <<
" do for [i=0:loc_sid_ndof-1] {" << endl
267 <<
" ip3=i+3" << endl
268 <<
" splot gdat index loc_isid u 1:2:ip3 t sprintf(\"side %d: L%d\",loc_isid,i) w l lc 1" << endl
269 <<
" pause pause_duration" << endl
272 <<
"pause -1 \"<return>\"" << endl
278 ofstream gdat (gdat_name.c_str());
279 cerr <<
"! file \"" << gdat_name <<
"\" created" << endl;
280 filelist +=
" " + gdat_name;
281 gdat << setprecision(std::numeric_limits<T>::digits10)
283 <<
"# element " << tilde_K.
name() << endl
284 <<
"# degree " << degree() << endl
286 Eigen::Matrix<T,Eigen::Dynamic,1>
value;
287 for (
size_type loc_isid = 0, loc_nsid = tilde_K.
n_side(); loc_isid < loc_nsid; ++loc_isid) {
290 size_type loc_sid_ndof = first_sid_idof (tilde_K,loc_isid+1) - first_sid_idof (tilde_K,loc_isid);
291 gdat <<
"# side " << loc_isid <<
": size " << loc_sid_ndof << endl
293 for (
size_type loc_sid_idof = 0; loc_sid_idof < loc_sid_ndof; ++loc_sid_idof) {
294 gdat <<
" L" << loc_sid_idof+1;
303 gdat << tilde_x[0] <<
" " << tilde_x[1];
304 for (
size_type loc_idof = first_sid_idof (tilde_K,loc_isid), last_loc_idof = first_sid_idof (tilde_K,loc_isid+1);
305 loc_idof < last_loc_idof; ++loc_idof) {
306 gdat <<
" " <<
value[loc_idof];
310 gdat << endl << endl;
320 string command =
"gnuplot " + plot_name;
327 string command =
"/bin/rm -f " + filelist;
337 #define _RHEOLEF_instanciation(T) \
338 template class basis_fem_sides<T>;