Reference documentation for deal.II version 8.5.1
point_value_history.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/lac/vector.h>
18 #include <deal.II/lac/block_vector.h>
19 #include <deal.II/lac/la_vector.h>
20 #include <deal.II/lac/la_parallel_vector.h>
21 #include <deal.II/lac/la_parallel_block_vector.h>
22 #include <deal.II/lac/petsc_vector.h>
23 #include <deal.II/lac/petsc_block_vector.h>
24 #include <deal.II/lac/trilinos_vector.h>
25 #include <deal.II/lac/trilinos_block_vector.h>
26 
27 #include <deal.II/numerics/vector_tools.h>
28 
29 #include <deal.II/numerics/point_value_history.h>
30 
31 #include <algorithm>
32 
33 
34 DEAL_II_NAMESPACE_OPEN
35 
36 
37 namespace internal
38 {
39  namespace PointValueHistory
40  {
42  template <int dim>
44  ::PointGeometryData (const Point <dim> &new_requested_location,
45  const std::vector <Point <dim> > &new_locations,
46  const std::vector <types::global_dof_index> &new_sol_indices)
47  {
48  requested_location = new_requested_location;
49  support_point_locations = new_locations;
50  solution_indices = new_sol_indices;
51  }
52  }
53 }
54 
55 
56 
57 template <int dim>
59 ::PointValueHistory (const unsigned int n_independent_variables) :
60  n_indep (n_independent_variables)
61 {
62  closed = false;
63  cleared = false;
64  triangulation_changed = false;
65  have_dof_handler = false;
66 
67  // make a vector for keys
68  dataset_key = std::vector <double> (); // initialize the std::vector
69 
70  // make a vector of independent values
71  independent_values
72  = std::vector<std::vector <double> > (n_indep, std::vector <double> (0));
73  indep_names = std::vector <std::string> ();
74 }
75 
76 
77 
78 template <int dim>
80  const unsigned int n_independent_variables) :
81  dof_handler (&dof_handler),
82  n_indep (n_independent_variables)
83 {
84  closed = false;
85  cleared = false;
86  triangulation_changed = false;
87  have_dof_handler = true;
88 
89  // make a vector to store keys
90  dataset_key = std::vector <double> (); // initialize the std::vector
91 
92  // make a vector for the independent values
94  = std::vector<std::vector <double> > (n_indep, std::vector <double> (0));
95  indep_names = std::vector <std::string> ();
96 
97  tria_listener = dof_handler.get_triangulation().signals.any_change.connect (std_cxx11::bind (&PointValueHistory<dim>::tria_change_listener,
98  std_cxx11::ref(*this)));
99 }
100 
101 
102 
103 template <int dim>
105 {
106  dataset_key = point_value_history.dataset_key;
107  independent_values = point_value_history.independent_values;
108  indep_names = point_value_history.indep_names;
109  data_store = point_value_history.data_store;
110  component_mask = point_value_history.component_mask;
111  component_names_map = point_value_history.component_names_map;
112  point_geometry_data = point_value_history.point_geometry_data;
113 
114  closed = point_value_history.closed;
115  cleared = point_value_history.cleared;
116 
117  dof_handler = point_value_history.dof_handler;
118 
119  triangulation_changed = point_value_history.triangulation_changed;
120  have_dof_handler = point_value_history.have_dof_handler;
121  n_indep = point_value_history.n_indep;
122 
123  // What to do with tria_listener?
124  // Presume subscribe new instance?
125  if (have_dof_handler)
126  {
127  tria_listener = dof_handler->get_triangulation().signals.any_change.connect (std_cxx11::bind (&PointValueHistory<dim>::tria_change_listener,
128  std_cxx11::ref(*this)));
129  }
130 }
131 
132 
133 
134 template <int dim>
137 {
138  dataset_key = point_value_history.dataset_key;
139  independent_values = point_value_history.independent_values;
140  indep_names = point_value_history.indep_names;
141  data_store = point_value_history.data_store;
142  component_mask = point_value_history.component_mask;
143  component_names_map = point_value_history.component_names_map;
144  point_geometry_data = point_value_history.point_geometry_data;
145 
146  closed = point_value_history.closed;
147  cleared = point_value_history.cleared;
148 
149  dof_handler = point_value_history.dof_handler;
150 
151  triangulation_changed = point_value_history.triangulation_changed;
152  have_dof_handler = point_value_history.have_dof_handler;
153  n_indep = point_value_history.n_indep;
154 
155  // What to do with tria_listener?
156  // Presume subscribe new instance?
157  if (have_dof_handler)
158  {
159  tria_listener = dof_handler->get_triangulation().signals.any_change.connect (std_cxx11::bind (&PointValueHistory<dim>::tria_change_listener,
160  std_cxx11::ref(*this)));
161  }
162 
163  return * this;
164 }
165 
166 
167 
168 template <int dim>
171 {
172  if (have_dof_handler)
173  {
174  tria_listener.disconnect ();
175  }
176 }
177 
178 
179 
180 template <int dim>
182 ::add_point (const Point <dim> &location)
183 {
184  // can't be closed to add additional points
185  // or vectors
186  AssertThrow (!closed, ExcInvalidState ());
187  AssertThrow (!cleared, ExcInvalidState ());
188  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
189  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
190 
191  // Implementation assumes that support
192  // points locations are dofs locations
193  AssertThrow (dof_handler->get_fe ().has_support_points (), ExcNotImplemented ());
194 
195  // While in general quadrature points seems
196  // to refer to Gauss quadrature points, in
197  // this case the quadrature points are
198  // forced to be the support points of the
199  // FE.
201  support_point_quadrature (dof_handler->get_fe ().get_unit_support_points ());
202  FEValues<dim> fe_values (dof_handler->get_fe (),
203  support_point_quadrature,
205  unsigned int n_support_points
206  = dof_handler->get_fe ().get_unit_support_points ().size ();
207  unsigned int n_components
208  = dof_handler->get_fe ().n_components ();
209 
210  // set up a loop over all the cells in the
211  // DoFHandler
213  cell = dof_handler->begin_active ();
215  endc = dof_handler->end ();
216 
217  // default values to be replaced as closer
218  // points are found however they need to be
219  // consistent in case they are actually
220  // chosen
221  typename DoFHandler<dim>::active_cell_iterator current_cell = cell;
222  std::vector <unsigned int> current_fe_index (n_components, 0); // need one index per component
223  fe_values.reinit (cell);
224  std::vector <Point <dim> > current_points (n_components, Point <dim > ());
225  for (unsigned int support_point = 0;
226  support_point < n_support_points; support_point++)
227  {
228  // setup valid data in the empty
229  // vectors
230  unsigned int component
231  = dof_handler->get_fe ().system_to_component_index (support_point).first;
232  current_points [component] = fe_values.quadrature_point (support_point);
233  current_fe_index [component] = support_point;
234  }
235 
236  // check each cell to find a suitable
237  // support points
238  // GridTools::find_active_cell_around_point
239  // is an alternative. That method is not
240  // used here mostly because of the history
241  // of the class. The algorithm used in
242  // add_points below may be slightly more
243  // efficient than find_active_cell_around_point
244  // because it operates on a set of points.
245 
246  for (; cell != endc; cell++)
247  {
248  fe_values.reinit (cell);
249 
250  for (unsigned int support_point = 0;
251  support_point < n_support_points; support_point++)
252  {
253  unsigned int component
254  = dof_handler->get_fe ().system_to_component_index (support_point).first;
255  Point<dim> test_point
256  = fe_values.quadrature_point (support_point);
257 
258  if (location.distance (test_point) <
259  location.distance (current_points [component]))
260  {
261  // save the data
262  current_points [component] = test_point;
263  current_cell = cell;
264  current_fe_index [component] = support_point;
265  }
266  }
267  }
268 
269 
270  std::vector<types::global_dof_index>
271  local_dof_indices (dof_handler->get_fe ().dofs_per_cell);
272  std::vector <types::global_dof_index> new_solution_indices;
273  current_cell->get_dof_indices (local_dof_indices);
274  // there is an implicit assumption here
275  // that all the closest support point to
276  // the requested point for all finite
277  // element components lie in the same cell.
278  // this could possibly be violated if
279  // components use different fe orders,
280  // requested points are on the edge or
281  // vertex of a cell and we are unlucky with
282  // floating point rounding. Worst case
283  // scenario however is that the point
284  // selected isn't the closest possible, it
285  // will still lie within one cell distance.
286  // calling
287  // GridTools::find_active_cell_around_point
288  // to obtain a cell to search is an
289  // option for these methods, but currently
290  // the GridTools function does not cater for
291  // a vector of points, and does not seem to
292  // be intrinsicly faster than this method.
293  for (unsigned int component = 0;
294  component < dof_handler->get_fe ().n_components (); component++)
295  {
296  new_solution_indices
297  .push_back (local_dof_indices[current_fe_index [component]]);
298  }
299 
301  new_point_geometry_data (location, current_points, new_solution_indices);
302  point_geometry_data.push_back (new_point_geometry_data);
303 
304  std::map <std::string, std::vector <std::vector <double> > >::iterator
305  data_store_begin = data_store.begin ();
306  for (; data_store_begin != data_store.end (); ++data_store_begin)
307  {
308  // add an extra row to each vector
309  // entry
310  const ComponentMask &current_mask = (component_mask.find (data_store_begin->first))->second;
311  unsigned int n_stored = current_mask.n_selected_components();
312  for (unsigned int component = 0; component < n_stored; component++)
313  {
314  data_store_begin->second.push_back (std::vector<double> (0));
315  }
316  }
317 }
318 
319 
320 
321 template <int dim>
323 ::add_points (const std::vector <Point <dim> > &locations)
324 {
325  // This algorithm adds points in the same
326  // order as they appear in the vector
327  // locations and users may depend on this
328  // so do not change order added!
329 
330  // can't be closed to add additional points or vectors
331  AssertThrow (!closed, ExcInvalidState ());
332  AssertThrow (!cleared, ExcInvalidState ());
333  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
334  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
335 
336 
337  // Implementation assumes that support
338  // points locations are dofs locations
339  AssertThrow (dof_handler->get_fe ().has_support_points (), ExcNotImplemented ());
340 
341  // While in general quadrature points seems
342  // to refer to Gauss quadrature points, in
343  // this case the quadrature points are
344  // forced to be the support points of the
345  // FE.
346  Quadrature<dim> support_point_quadrature (dof_handler->get_fe ().get_unit_support_points ());
347  FEValues<dim> fe_values (dof_handler->get_fe (), support_point_quadrature, update_quadrature_points);
348  unsigned int n_support_points = dof_handler->get_fe ().get_unit_support_points ().size ();
349  unsigned int n_components = dof_handler->get_fe ().n_components ();
350 
351  // set up a loop over all the cells in the
352  // DoFHandler
353  typename DoFHandler<dim>::active_cell_iterator cell = dof_handler->begin_active ();
354  typename DoFHandler<dim>::active_cell_iterator endc = dof_handler->end ();
355 
356  // default values to be replaced as closer
357  // points are found however they need to be
358  // consistent in case they are actually
359  // chosen vector <vector>s defined where
360  // previously single vectors were used
361 
362  // need to store one value per point per component
363  std::vector <typename DoFHandler<dim>::active_cell_iterator > current_cell (locations.size (), cell);
364 
365  fe_values.reinit (cell);
366  std::vector <Point <dim> > temp_points (n_components, Point <dim > ());
367  std::vector <unsigned int> temp_fe_index (n_components, 0);
368  for (unsigned int support_point = 0; support_point < n_support_points; support_point++)
369  {
370  // setup valid data in the empty
371  // vectors
372  unsigned int component = dof_handler->get_fe ().system_to_component_index (support_point).first;
373  temp_points [component] = fe_values.quadrature_point (support_point);
374  temp_fe_index [component] = support_point;
375  }
376  std::vector <std::vector <Point <dim> > > current_points (locations.size (), temp_points); // give a valid start point
377  std::vector <std::vector <unsigned int> > current_fe_index (locations.size (), temp_fe_index);
378 
379  // check each cell to find suitable support
380  // points
381  // GridTools::find_active_cell_around_point
382  // is an alternative. That method is not
383  // used here mostly because of the history
384  // of the class. The algorithm used here
385  // may be slightly more
386  // efficient than find_active_cell_around_point
387  // because it operates on a set of points.
388  for (; cell != endc; cell++)
389  {
390  fe_values.reinit (cell);
391  for (unsigned int support_point = 0; support_point < n_support_points; support_point++)
392  {
393  unsigned int component = dof_handler->get_fe ().system_to_component_index (support_point).first;
394  Point<dim> test_point = fe_values.quadrature_point (support_point);
395 
396  for (unsigned int point = 0; point < locations.size (); point++)
397  {
398  if (locations[point].distance (test_point) < locations[point].distance (current_points[point][component]))
399  {
400  // save the data
401  current_points[point][component] = test_point;
402  current_cell[point] = cell;
403  current_fe_index[point][component] = support_point;
404  }
405  }
406  }
407  }
408 
409  std::vector<types::global_dof_index> local_dof_indices (dof_handler->get_fe ().dofs_per_cell);
410  for (unsigned int point = 0; point < locations.size (); point++)
411  {
412  current_cell[point]->get_dof_indices (local_dof_indices);
413  std::vector<types::global_dof_index> new_solution_indices;
414 
415  for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++)
416  {
417  new_solution_indices.push_back (local_dof_indices[current_fe_index[point][component]]);
418  }
419 
420  internal::PointValueHistory::PointGeometryData<dim> new_point_geometry_data (locations[point], current_points[point], new_solution_indices);
421 
422  point_geometry_data.push_back (new_point_geometry_data);
423 
424  std::map <std::string, std::vector <std::vector <double> > >::iterator
425  data_store_begin = data_store.begin ();
426  for (; data_store_begin != data_store.end (); ++data_store_begin)
427  {
428  // add an extra row to each vector
429  // entry
430  const ComponentMask current_mask = (component_mask.find (data_store_begin->first))->second;
431  unsigned int n_stored = current_mask.n_selected_components();
432  for (unsigned int component = 0; component < n_stored; component++)
433  {
434  data_store_begin->second.push_back (std::vector<double> (0));
435  }
436  }
437  }
438 }
439 
440 
441 
442 
443 
444 
445 template <int dim>
447 ::add_field_name (const std::string &vector_name,
448  const ComponentMask &mask)
449 {
450  // can't be closed to add additional points
451  // or vectors
452  AssertThrow (!closed, ExcInvalidState ());
453  AssertThrow (!cleared, ExcInvalidState ());
454  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
455  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
456 
457  // insert a component mask that is always of the right size
458  if (mask.represents_the_all_selected_mask() == false)
459  component_mask.insert (std::make_pair (vector_name, mask));
460  else
461  component_mask.insert (std::make_pair (vector_name,
462  ComponentMask(std::vector<bool>(dof_handler->get_fe().n_components(), true))));
463 
464  // insert an empty vector of strings
465  // to ensure each field has an entry
466  // in the map
467  std::pair <std::string, std::vector <std::string> >
468  empty_names (vector_name, std::vector <std::string> ());
469  component_names_map.insert (empty_names);
470 
471  // make and add a new vector
472  // point_geometry_data.size() long
473  std::pair<std::string, std::vector <std::vector <double> > > pair_data;
474  pair_data.first = vector_name;
475  const unsigned int n_stored = (mask.represents_the_all_selected_mask() == false
476  ?
477  mask.n_selected_components()
478  :
479  dof_handler->get_fe().n_components());
480 
481  int n_datastreams = point_geometry_data.size () * n_stored; // each point has n_stored sub parts
482  std::vector < std::vector <double> > vector_size (n_datastreams,
483  std::vector <double> (0));
484  pair_data.second = vector_size;
485  data_store.insert (pair_data);
486 }
487 
488 
489 template <int dim>
491 ::add_field_name(const std::string &vector_name, const unsigned int n_components)
492 {
493  std::vector <bool> temp_mask (n_components, true);
494  add_field_name (vector_name, temp_mask);
495 }
496 
497 
498 template <int dim>
500 ::add_component_names(const std::string &vector_name,
501  const std::vector <std::string> &component_names)
502 {
503  typename std::map <std::string, std::vector <std::string> >::iterator names = component_names_map.find(vector_name);
504  Assert (names != component_names_map.end(), ExcMessage("vector_name not in class"));
505 
506  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(vector_name);
507  Assert (mask != component_mask.end(), ExcMessage("vector_name not in class"));
508  unsigned int n_stored = mask->second.n_selected_components();
509  (void)n_stored;
510  Assert (component_names.size() == n_stored, ExcDimensionMismatch (component_names.size(), n_stored));
511 
512  names->second = component_names;
513 }
514 
515 
516 template <int dim>
518 ::add_independent_names(const std::vector <std::string> &independent_names)
519 {
520  Assert (independent_names.size() == n_indep, ExcDimensionMismatch (independent_names.size(), n_indep));
521 
522  indep_names = independent_names;
523 }
524 
525 
526 template <int dim>
529 {
530  closed = true;
531 }
532 
533 
534 
535 template <int dim>
538 {
539  cleared = true;
540  dof_handler = 0;
541  have_dof_handler = false;
542 }
543 
544 // Need to test that the internal data has a full and complete dataset for
545 // each key. That is that the data has not got 'out of sync'. Testing that
546 // dataset_key is within 1 of independent_values is cheap and is done in all
547 // three methods. Evaluate_field will check that its vector_name is within 1
548 // of dataset_key. However this leaves the possibility that the user has
549 // neglected to call evaluate_field on one vector_name consistently. To catch
550 // this case start_new_dataset will call bool deap_check () which will test
551 // all vector_names and return a bool. This can be called from an Assert
552 // statement.
553 
554 
555 
556 template <int dim>
557 template <typename VectorType>
559 ::evaluate_field (const std::string &vector_name, const VectorType &solution)
560 {
561  // must be closed to add data to internal
562  // members.
563  Assert (closed, ExcInvalidState ());
564  Assert (!cleared, ExcInvalidState ());
565  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
566  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
567 
568  if (n_indep != 0) // hopefully this will get optimized, can't test independent_values[0] unless n_indep > 0
569  {
570  Assert (std::abs ((int) dataset_key.size () - (int) independent_values[0].size ()) < 2, ExcDataLostSync ());
571  }
572  // Look up the field name and get an
573  // iterator for the map. Doing this
574  // up front means that it only needs
575  // to be done once and also allows us
576  // to check vector_name is in the map.
577  typename std::map <std::string, std::vector <std::vector <double> > >::iterator data_store_field = data_store.find(vector_name);
578  Assert (data_store_field != data_store.end(), ExcMessage("vector_name not in class"));
579  // Repeat for component_mask
580  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(vector_name);
581  Assert (mask != component_mask.end(), ExcMessage("vector_name not in class"));
582 
583  unsigned int n_stored = mask->second.n_selected_components(dof_handler->get_fe ().n_components ());
584 
585  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
586  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
587  {
588  // Look up the components to add
589  // in the component_mask, and
590  // access the data associated with
591  // those components
592 
593  for (unsigned int store_index = 0, comp = 0; comp < dof_handler->get_fe ().n_components (); comp++)
594  {
595  if (mask->second[comp])
596  {
597  unsigned int solution_index = point->solution_indices[comp];
598  data_store_field->second[data_store_index * n_stored + store_index].push_back (solution (solution_index));
599  store_index++;
600  }
601  }
602  }
603 }
604 
605 
606 
607 
608 
609 template <int dim>
610 template <typename VectorType>
612 ::evaluate_field (const std::vector <std::string> &vector_names,
613  const VectorType &solution,
614  const DataPostprocessor< dim> &data_postprocessor,
615  const Quadrature<dim> &quadrature)
616 {
617  // must be closed to add data to internal
618  // members.
619  Assert (closed, ExcInvalidState ());
620  Assert (!cleared, ExcInvalidState ());
621  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
622  if (n_indep != 0) // hopefully this will get optimized, can't test independent_values[0] unless n_indep > 0
623  {
624  Assert (std::abs ((int) dataset_key.size () - (int) independent_values[0].size ()) < 2, ExcDataLostSync ());
625  }
626 
627  // Make an FEValues object
628  const UpdateFlags update_flags = data_postprocessor.get_needed_update_flags() | update_quadrature_points;
629  Assert (!(update_flags & update_normal_vectors),
630  ExcMessage("The update of normal vectors may not be requested for evaluation of "
631  "data on cells via DataPostprocessor."));
632  FEValues<dim> fe_values (dof_handler->get_fe (), quadrature, update_flags);
633  unsigned int n_components = dof_handler->get_fe ().n_components ();
634  unsigned int n_quadrature_points = quadrature.size();
635 
636  unsigned int n_output_variables = data_postprocessor.get_names().size();
637 
638  // Loop over points and find correct cell
639  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
640  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
641  {
642  // we now have a point to query,
643  // need to know what cell it is in
644  Point <dim> requested_location = point->requested_location;
646 
647 
648  fe_values.reinit (cell);
649  std::vector< Vector< double > > computed_quantities (1, Vector <double> (n_output_variables)); // just one point needed
650 
651  // The case of a scalar FE
652  if (n_components == 1)
653  {
654  // Extract data for the
655  // PostProcessor object
656  std::vector< typename VectorType::value_type > solution_values (n_quadrature_points, 0.0);
657  std::vector< Tensor< 1, dim, typename VectorType::value_type > > solution_gradients (n_quadrature_points, Tensor <1, dim, typename VectorType::value_type> ());
658  std::vector< Tensor< 2, dim, typename VectorType::value_type > > solution_hessians (n_quadrature_points, Tensor <2, dim, typename VectorType::value_type> ());
659  std::vector<Point<dim> > dummy_normals (1, Point<dim> ());
660  std::vector<Point<dim> > evaluation_points;
661  // at each point there is
662  // only one component of
663  // value, gradient etc.
664  if (update_flags & update_values)
665  fe_values.get_function_values (solution,
666  solution_values);
667  if (update_flags & update_gradients)
668  fe_values.get_function_gradients (solution,
669  solution_gradients);
670  if (update_flags & update_hessians)
671  fe_values.get_function_hessians (solution,
672  solution_hessians);
673 
674  // find the closest quadrature point
675  evaluation_points = fe_values.get_quadrature_points();
676  double distance = cell->diameter ();
677  unsigned int selected_point = 0;
678  for (unsigned int q_point = 0; q_point < n_quadrature_points; q_point++)
679  {
680  if (requested_location.distance (evaluation_points[q_point]) < distance)
681  {
682  selected_point = q_point;
683  distance = requested_location.distance (evaluation_points[q_point]);
684  }
685  }
686 
687  // Call compute_derived_quantities_vector
688  // or compute_derived_quantities_scalar
689  // TODO this function should also operate with typename VectorType::value_type
690  data_postprocessor.
691  compute_derived_quantities_scalar(std::vector< double > (1, solution_values[selected_point]),
692  std::vector< Tensor< 1, dim > > (1, Tensor< 1, dim >(solution_gradients[selected_point]) ),
693  std::vector< Tensor< 2, dim > > (1, Tensor< 2, dim >(solution_hessians[selected_point]) ),
694  dummy_normals,
695  std::vector<Point<dim> > (1, evaluation_points[selected_point]),
696  computed_quantities);
697 
698  }
699  else // The case of a vector FE
700  {
701  // Extract data for the PostProcessor object
702  std::vector< Vector< typename VectorType::value_type > > solution_values (n_quadrature_points, Vector <typename VectorType::value_type> (n_components));
703  std::vector< std::vector< Tensor< 1, dim, typename VectorType::value_type > > > solution_gradients (n_quadrature_points, std::vector< Tensor< 1, dim, typename VectorType::value_type > > (n_components, Tensor< 1, dim, typename VectorType::value_type >()));
704  std::vector< std::vector< Tensor< 2, dim, typename VectorType::value_type > > > solution_hessians (n_quadrature_points, std::vector< Tensor< 2, dim, typename VectorType::value_type > > (n_components, Tensor< 2, dim, typename VectorType::value_type >()));
705  std::vector<Point<dim> > dummy_normals (1, Point<dim> ());
706  std::vector<Point<dim> > evaluation_points;
707  // at each point there is
708  // a vector valued
709  // function and its
710  // derivative...
711  if (update_flags & update_values)
712  fe_values.get_function_values (solution,
713  solution_values);
714  if (update_flags & update_gradients)
715  fe_values.get_function_gradients (solution,
716  solution_gradients);
717  if (update_flags & update_hessians)
718  fe_values.get_function_hessians (solution,
719  solution_hessians);
720 
721  // find the closest quadrature point
722  evaluation_points = fe_values.get_quadrature_points();
723  double distance = cell->diameter ();
724  unsigned int selected_point = 0;
725  for (unsigned int q_point = 0; q_point < n_quadrature_points; q_point++)
726  {
727  if (requested_location.distance (evaluation_points[q_point]) < distance)
728  {
729  selected_point = q_point;
730  distance = requested_location.distance (evaluation_points[q_point]);
731  }
732  }
733 
734  // FIXME: We need tmp vectors below because the data
735  // postprocessors are not equipped to deal with anything but
736  // doubles (scalars and tensors).
737  const Vector< typename VectorType::value_type > &solution_values_s = solution_values[selected_point];
738  const std::vector< Tensor< 1, dim, typename VectorType::value_type > > &solution_gradients_s = solution_gradients[selected_point];
739  const std::vector< Tensor< 2, dim, typename VectorType::value_type > > &solution_hessians_s = solution_hessians[selected_point];
740  std::vector< Tensor< 1, dim > > tmp_d (solution_gradients_s.size());
741  for (unsigned int i = 0; i < solution_gradients_s.size(); i++)
742  tmp_d[i] = solution_gradients_s[i];
743 
744  std::vector< Tensor< 2, dim > > tmp_dd (solution_hessians_s.size());
745  for (unsigned int i = 0; i < solution_hessians_s.size(); i++)
746  tmp_dd[i] = solution_hessians_s[i];
747 
748  Vector< double > tmp(solution_values_s.size());
749  for (unsigned int i = 0; i < solution_values_s.size(); i++)
750  tmp[i] = solution_values_s[i];
751  // Call compute_derived_quantities_vector
752  // or compute_derived_quantities_scalar
753  data_postprocessor.
754  compute_derived_quantities_vector(std::vector< Vector< double > > (1, tmp),
755  std::vector< std::vector< Tensor< 1, dim > > > (1, tmp_d),
756  std::vector< std::vector< Tensor< 2, dim > > > (1, tmp_dd),
757  dummy_normals,
758  std::vector<Point<dim> > (1, evaluation_points[selected_point]),
759  computed_quantities);
760  }
761 
762 
763  // we now have the data and need to save it
764  // loop over data names
765  typename std::vector<std::string>::const_iterator name = vector_names.begin();
766  for (; name != vector_names.end(); ++name)
767  {
768  typename std::map <std::string, std::vector <std::vector <double> > >::iterator data_store_field = data_store.find(*name);
769  Assert (data_store_field != data_store.end(), ExcMessage("vector_name not in class"));
770  // Repeat for component_mask
771  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(*name);
772  Assert (mask != component_mask.end(), ExcMessage("vector_name not in class"));
773 
774  unsigned int n_stored = mask->second.n_selected_components(n_output_variables);
775 
776  // Push back computed quantities according
777  // to the component_mask.
778  for (unsigned int store_index = 0, comp = 0; comp < n_output_variables; comp++)
779  {
780  if (mask->second[comp])
781  {
782  data_store_field->second[data_store_index * n_stored + store_index].push_back (computed_quantities[0](comp));
783  store_index++;
784  }
785  }
786  }
787  } // end of loop over points
788 }
789 
790 
791 template <int dim>
792 template <typename VectorType>
794 ::evaluate_field (const std::string &vector_name,
795  const VectorType &solution,
796  const DataPostprocessor<dim> &data_postprocessor,
797  const Quadrature<dim> &quadrature)
798 {
799  std::vector <std::string> vector_names;
800  vector_names.push_back (vector_name);
801  evaluate_field (vector_names, solution, data_postprocessor, quadrature);
802 }
803 
804 
805 
806 template <int dim>
807 template <typename VectorType>
809 ::evaluate_field_at_requested_location (const std::string &vector_name,
810  const VectorType &solution)
811 {
812  typedef typename VectorType::value_type number;
813  // must be closed to add data to internal
814  // members.
815  Assert (closed, ExcInvalidState ());
816  Assert (!cleared, ExcInvalidState ());
817  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
818 
819  if (n_indep != 0) // hopefully this will get optimized, can't test independent_values[0] unless n_indep > 0
820  {
821  Assert (std::abs ((int) dataset_key.size () - (int) independent_values[0].size ()) < 2, ExcDataLostSync ());
822  }
823  // Look up the field name and get an
824  // iterator for the map. Doing this
825  // up front means that it only needs
826  // to be done once and also allows us
827  // to check vector_name is in the map.
828  typename std::map <std::string, std::vector <std::vector <double> > >::iterator data_store_field = data_store.find(vector_name);
829  Assert (data_store_field != data_store.end(), ExcMessage("vector_name not in class"));
830  // Repeat for component_mask
831  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(vector_name);
832  Assert (mask != component_mask.end(), ExcMessage("vector_name not in class"));
833 
834  unsigned int n_stored = mask->second.n_selected_components(dof_handler->get_fe ().n_components ());
835 
836  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
837  Vector <number> value (dof_handler->get_fe().n_components());
838  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
839  {
840  // Make a Vector <double> for the value
841  // at the point. It will have as many
842  // components as there are in the fe.
843  VectorTools::point_value (*dof_handler, solution, point->requested_location, value);
844 
845  // Look up the component_mask and add
846  // in components according to that mask
847  for (unsigned int store_index = 0, comp = 0; comp < mask->second.size(); comp++)
848  {
849  if (mask->second[comp])
850  {
851  data_store_field->second[data_store_index * n_stored + store_index].push_back (value (comp));
852  store_index++;
853  }
854  }
855  }
856 }
857 
858 
859 template <int dim>
862 {
863  // must be closed to add data to internal
864  // members.
865  Assert (closed, ExcInvalidState ());
866  Assert (!cleared, ExcInvalidState ());
867  Assert (deep_check (false), ExcDataLostSync ());
868 
869  dataset_key.push_back (key);
870 }
871 
872 
873 
874 template <int dim>
876 ::push_back_independent (const std::vector <double> &indep_values)
877 {
878  // must be closed to add data to internal
879  // members.
880  Assert (closed, ExcInvalidState ());
881  Assert (!cleared, ExcInvalidState ());
882  Assert (indep_values.size () == n_indep, ExcDimensionMismatch (indep_values.size (), n_indep));
883  Assert (n_indep != 0, ExcNoIndependent ());
884  Assert (std::abs ((int) dataset_key.size () - (int) independent_values[0].size ()) < 2, ExcDataLostSync ());
885 
886  for (unsigned int component = 0; component < n_indep; component++)
887  independent_values[component].push_back (indep_values[component]);
888 }
889 
890 
891 
892 template <int dim>
894 ::write_gnuplot (const std::string &base_name,
895  const std::vector <Point <dim> > &postprocessor_locations)
896 {
897  AssertThrow (closed, ExcInvalidState ());
898  AssertThrow (!cleared, ExcInvalidState ());
899  AssertThrow (deep_check (true), ExcDataLostSync ());
900 
901  // write inputs to a file
902  if (n_indep != 0)
903  {
904  std::string filename = base_name + "_indep.gpl";
905  std::ofstream to_gnuplot (filename.c_str ());
906 
907  to_gnuplot << "# Data independent of mesh location\n";
908 
909  // write column headings
910  to_gnuplot << "# <Key> ";
911 
912  if (indep_names.size() > 0)
913  {
914  for (unsigned int name = 0; name < indep_names.size(); name++)
915  {
916  to_gnuplot << "<" << indep_names [name] << "> ";
917  }
918  to_gnuplot << "\n";
919  }
920  else
921  {
922  for (unsigned int component = 0; component < n_indep; component++)
923  {
924  to_gnuplot << "<Indep_" << component << "> ";
925  }
926  to_gnuplot << "\n";
927  }
928  // write general data stored
929  for (unsigned int key = 0; key < dataset_key.size (); key++)
930  {
931  to_gnuplot << dataset_key[key];
932 
933  for (unsigned int component = 0; component < n_indep; component++)
934  {
935  to_gnuplot << " " << independent_values[component][key];
936  }
937  to_gnuplot << "\n";
938  }
939 
940  to_gnuplot.close ();
941  }
942 
943 
944 
945  // write points to a file
946  if (have_dof_handler)
947  {
948  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
949  AssertThrow (postprocessor_locations.size() == 0 || postprocessor_locations.size() == point_geometry_data.size(), ExcDimensionMismatch (postprocessor_locations.size(), point_geometry_data.size()));
950  // We previously required the
951  // number of dofs to remain the
952  // same to provide some sort of
953  // test on the relevance of the
954  // support point indices stored.
955  // We now relax that to allow
956  // adaptive refinement strategies
957  // to make use of the
958  // evaluate_field_requested_locations
959  // method. Note that the support point
960  // information is not meaningful if
961  // the number of dofs has changed.
962  //AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
963 
964  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
965  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
966  {
967  // for each point, open a file to
968  // be written to
969  std::string filename = base_name + "_" + Utilities::int_to_string (data_store_index, 2) + ".gpl"; // store by order pushed back
970  // due to
971  // Utilities::int_to_string(data_store_index,
972  // 2) call, can handle up to 100
973  // points
974  std::ofstream to_gnuplot (filename.c_str ());
975 
976  // put helpful info about the
977  // support point into the file as
978  // comments
979  to_gnuplot << "# Requested location: " << point->requested_location << "\n";
980  to_gnuplot << "# DoF_index : Support location (for each component)\n";
981  for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++)
982  {
983  to_gnuplot << "# " << point->solution_indices[component] << " : " << point->support_point_locations [component] << "\n";
984  }
985  if (triangulation_changed)
986  to_gnuplot << "# (Original components and locations, may be invalidated by mesh change.)\n";
987 
988  if (postprocessor_locations.size() != 0)
989  {
990  to_gnuplot << "# Postprocessor location: " << postprocessor_locations[data_store_index];
991  if (triangulation_changed)
992  to_gnuplot << " (may be approximate)\n";
993  }
994  to_gnuplot << "#\n";
995 
996 
997  // write column headings
998  to_gnuplot << "# <Key> ";
999 
1000  if (indep_names.size() > 0)
1001  {
1002  for (unsigned int name = 0; name < indep_names.size(); name++)
1003  {
1004  to_gnuplot << "<" << indep_names [name] << "> ";
1005  }
1006  }
1007  else
1008  {
1009  for (unsigned int component = 0; component < n_indep; component++)
1010  {
1011  to_gnuplot << "<Indep_" << component << "> ";
1012  }
1013  }
1014 
1015  for (std::map <std::string, std::vector <std::vector <double> > >::iterator
1016  data_store_begin = data_store.begin (); data_store_begin != data_store.end (); ++data_store_begin)
1017  {
1018  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(data_store_begin->first);
1019  unsigned int n_stored = mask->second.n_selected_components();
1020  std::vector <std::string> names = (component_names_map.find (data_store_begin->first))->second;
1021 
1022  if (names.size() > 0)
1023  {
1024  AssertThrow (names.size() == n_stored, ExcDimensionMismatch (names.size(), n_stored));
1025  for (unsigned int component = 0; component < names.size(); component++)
1026  {
1027  to_gnuplot << "<" << names[component] << "> ";
1028  }
1029  }
1030  else
1031  {
1032  for (unsigned int component = 0; component < n_stored; component++)
1033  {
1034  to_gnuplot << "<" << data_store_begin->first << "_" << component << "> ";
1035  }
1036  }
1037  }
1038  to_gnuplot << "\n";
1039 
1040  // write data stored for the point
1041  for (unsigned int key = 0; key < dataset_key.size (); key++)
1042  {
1043  to_gnuplot << dataset_key[key];
1044 
1045  for (unsigned int component = 0; component < n_indep; component++)
1046  {
1047  to_gnuplot << " " << independent_values[component][key];
1048  }
1049 
1050  for (std::map <std::string, std::vector <std::vector <double> > >::iterator
1051  data_store_begin = data_store.begin ();
1052  data_store_begin != data_store.end (); ++data_store_begin)
1053  {
1054  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(data_store_begin->first);
1055  unsigned int n_stored = mask->second.n_selected_components();
1056 
1057  for (unsigned int component = 0; component < n_stored; component++)
1058  {
1059  to_gnuplot << " " << (data_store_begin->second)[data_store_index * n_stored + component][key];
1060  }
1061  }
1062  to_gnuplot << "\n";
1063  }
1064 
1065  to_gnuplot.close ();
1066  }
1067  }
1068 }
1069 
1070 
1071 
1072 template <int dim>
1075 {
1076  // a method to put a one at each point on
1077  // the grid where a location is defined
1078  AssertThrow (!cleared, ExcInvalidState ());
1079  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
1080  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
1081 
1082  Vector<double> dof_vector (dof_handler->n_dofs ());
1083 
1084  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
1085  for (; point != point_geometry_data.end (); ++point)
1086  {
1087  for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++)
1088  {
1089  dof_vector (point->solution_indices[component]) = 1;
1090  }
1091  }
1092  return dof_vector;
1093 }
1094 
1095 
1096 template <int dim>
1098 ::get_support_locations (std::vector <std::vector<Point <dim> > > &locations)
1099 {
1100  AssertThrow (!cleared, ExcInvalidState ());
1101  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
1102  AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
1103 
1104  std::vector <std::vector <Point <dim> > > actual_points;
1105  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
1106 
1107  for (; point != point_geometry_data.end (); ++point)
1108  {
1109  actual_points.push_back (point->support_point_locations);
1110  }
1111  locations = actual_points;
1112 }
1113 
1114 
1115 template <int dim>
1117 ::get_points (std::vector <std::vector<Point <dim> > > &locations)
1118 {
1119  get_support_locations (locations);
1120 }
1121 
1122 
1123 template <int dim>
1125 ::get_postprocessor_locations (const Quadrature<dim> &quadrature, std::vector<Point <dim> > &locations)
1126 {
1127  Assert (!cleared, ExcInvalidState ());
1128  AssertThrow (have_dof_handler, ExcDoFHandlerRequired ());
1129 
1130  locations = std::vector<Point <dim> > ();
1131 
1132  FEValues<dim> fe_values (dof_handler->get_fe (), quadrature, update_quadrature_points);
1133  unsigned int n_quadrature_points = quadrature.size();
1134  std::vector<Point<dim> > evaluation_points;
1135 
1136  // Loop over points and find correct cell
1137  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
1138  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
1139  {
1140  // we now have a point to query,
1141  // need to know what cell it is in
1142  Point <dim> requested_location = point->requested_location;
1144  fe_values.reinit (cell);
1145 
1146  evaluation_points = fe_values.get_quadrature_points();
1147  double distance = cell->diameter ();
1148  unsigned int selected_point = 0;
1149 
1150  for (unsigned int q_point = 0; q_point < n_quadrature_points; q_point++)
1151  {
1152  if (requested_location.distance (evaluation_points[q_point]) < distance)
1153  {
1154  selected_point = q_point;
1155  distance = requested_location.distance (evaluation_points[q_point]);
1156  }
1157  }
1158 
1159  locations.push_back (evaluation_points[selected_point]);
1160  }
1161 }
1162 
1163 
1164 template <int dim>
1166 ::status (std::ostream &out)
1167 {
1168  out << "***PointValueHistory status output***\n\n";
1169  out << "Closed: " << closed << "\n";
1170  out << "Cleared: " << cleared << "\n";
1171  out << "Triangulation_changed: " << triangulation_changed << "\n";
1172  out << "Have_dof_handler: " << have_dof_handler << "\n";
1173  out << "Geometric Data" << "\n";
1174 
1175  typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
1176  if (point == point_geometry_data.end ())
1177  {
1178  out << "No points stored currently\n";
1179  }
1180  else
1181  {
1182  if (!cleared)
1183  {
1184  for (; point != point_geometry_data.end (); ++point)
1185  {
1186  out << "# Requested location: " << point->requested_location << "\n";
1187  out << "# DoF_index : Support location (for each component)\n";
1188  for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++)
1189  {
1190  out << point->solution_indices[component] << " : " << point->support_point_locations [component] << "\n";
1191  }
1192  out << "\n";
1193  }
1194  }
1195  else
1196  {
1197  out << "#Cannot access DoF_indices once cleared\n";
1198  }
1199  }
1200  out << "\n";
1201 
1202  if (independent_values.size () != 0)
1203  {
1204  out << "Independent value(s): " << independent_values.size () << " : " << independent_values[0].size () << "\n";
1205  if (indep_names.size() > 0)
1206  {
1207  out << "Names: ";
1208  for (unsigned int name = 0; name < indep_names.size(); name++)
1209  {
1210  out << "<" << indep_names [name] << "> ";
1211  }
1212  out << "\n";
1213  }
1214  }
1215  else
1216  {
1217  out << "No independent values stored\n";
1218  }
1219 
1220  std::map <std::string, std::vector <std::vector <double> > >::iterator
1221  data_store_begin = data_store.begin ();
1222  if (data_store_begin != data_store.end())
1223  {
1224  out << "Mnemonic: data set size (mask size, n true components) : n data sets\n";
1225  }
1226  for (; data_store_begin != data_store.end (); ++data_store_begin)
1227  {
1228  // Find field mnemonic
1229  std::string vector_name = data_store_begin->first;
1230  typename std::map <std::string, ComponentMask>::iterator mask = component_mask.find(vector_name);
1231  Assert (mask != component_mask.end(), ExcMessage("vector_name not in class"));
1232  typename std::map <std::string, std::vector <std::string> >::iterator component_names = component_names_map.find(vector_name);
1233  Assert (component_names != component_names_map.end(), ExcMessage("vector_name not in class"));
1234 
1235  if (data_store_begin->second.size () != 0)
1236  {
1237  out << data_store_begin->first << ": " << data_store_begin->second.size () << " (";
1238  out << mask->second.size() << ", " << mask->second.n_selected_components() << ") : ";
1239  out << (data_store_begin->second)[0].size () << "\n";
1240  }
1241  else
1242  {
1243  out << data_store_begin->first << ": " << data_store_begin->second.size () << " (";
1244  out << mask->second.size() << ", " << mask->second.n_selected_components() << ") : ";
1245  out << "No points added" << "\n";
1246  }
1247  // add names, if available
1248  if (component_names->second.size() > 0)
1249  {
1250  for (unsigned int name = 0; name < component_names->second.size(); name++)
1251  {
1252  out << "<" << component_names->second[name] << "> ";
1253  }
1254  out << "\n";
1255  }
1256  }
1257  out << "\n";
1258  out << "***end of status output***\n\n";
1259 }
1260 
1261 
1262 
1263 template <int dim>
1265 ::deep_check (const bool strict)
1266 {
1267  // test ways that it can fail, if control
1268  // reaches last statement return true
1269  if (strict)
1270  {
1271  if (n_indep != 0)
1272  {
1273  if (dataset_key.size () != independent_values[0].size ())
1274  {
1275  return false;
1276  }
1277  }
1278  std::map <std::string, std::vector <std::vector <double> > >::iterator
1279  data_store_begin = data_store.begin ();
1280  if (have_dof_handler)
1281  {
1282  for (; data_store_begin != data_store.end (); ++data_store_begin)
1283  {
1284  Assert (data_store_begin->second.size() > 0,
1285  ExcInternalError());
1286  if ((data_store_begin->second)[0].size () != dataset_key.size ())
1287  return false;
1288  // this loop only tests one
1289  // member for each name,
1290  // i.e. checks the user it will
1291  // not catch internal errors
1292  // which do not update all
1293  // fields for a name.
1294  }
1295  }
1296  return true;
1297  }
1298  if (n_indep != 0)
1299  {
1300  if (std::abs ((int) dataset_key.size () - (int) independent_values[0].size ()) >= 2)
1301  {
1302  return false;
1303  }
1304  }
1305 
1306  if (have_dof_handler)
1307  {
1308  std::map <std::string, std::vector <std::vector <double> > >::iterator
1309  data_store_begin = data_store.begin ();
1310  for (; data_store_begin != data_store.end (); ++data_store_begin)
1311  {
1312  Assert (data_store_begin->second.size() > 0,
1313  ExcInternalError());
1314 
1315  if (std::abs ((int) (data_store_begin->second)[0].size () - (int) dataset_key.size ()) >= 2)
1316  return false;
1317  // this loop only tests one member
1318  // for each name, i.e. checks the
1319  // user it will not catch internal
1320  // errors which do not update all
1321  // fields for a name.
1322  }
1323  }
1324  return true;
1325 }
1326 
1327 
1328 
1329 template <int dim>
1332 {
1333  // this function is called by the
1334  // Triangulation whenever something
1335  // changes, by virtue of having
1336  // attached the function to the
1337  // signal handler in the
1338  // triangulation object
1339 
1340  // we record the fact that the mesh
1341  // has changed. we need to take
1342  // this into account next time we
1343  // evaluate the solution
1344  triangulation_changed = true;
1345 }
1346 
1347 
1348 // explicit instantiations
1349 #include "point_value_history.inst"
1350 
1351 
1352 DEAL_II_NAMESPACE_CLOSE
Shape function values.
std::map< std::string, std::vector< std::vector< double > > > data_store
void get_postprocessor_locations(const Quadrature< dim > &quadrature, std::vector< Point< dim > > &locations)
void point_value(const DoFHandler< dim, spacedim > &dof, const VectorType &fe_function, const Point< spacedim > &point, Vector< typename VectorType::value_type > &value)
PointValueHistory(const unsigned int n_independent_variables=0)
cell_iterator end() const
Definition: dof_handler.cc:756
const FiniteElement< dim, spacedim > & get_fe() const
PointGeometryData(const Point< dim > &new_requested_location, const std::vector< Point< dim > > &new_locations, const std::vector< types::global_dof_index > &new_sol_indices)
Only a constructor needed for this class (a struct really)
std::vector< double > dataset_key
bool represents_the_all_selected_mask() const
Transformed quadrature points.
#define AssertThrow(cond, exc)
Definition: exceptions.h:369
std::vector< std::string > indep_names
void add_points(const std::vector< Point< dim > > &locations)
std::vector< internal::PointValueHistory::PointGeometryData< dim > > point_geometry_data
active_cell_iterator begin_active(const unsigned int level=0) const
Definition: dof_handler.cc:740
void add_component_names(const std::string &vector_name, const std::vector< std::string > &component_names)
void add_field_name(const std::string &vector_name, const ComponentMask &component_mask=ComponentMask())
boost::signals2::connection tria_listener
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
Definition: exceptions.h:313
UpdateFlags
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void evaluate_field_at_requested_location(const std::string &name, const VectorType &solution)
std::vector< std::vector< double > > independent_values
std::size_t size() const
void evaluate_field(const std::string &name, const VectorType &solution)
void start_new_dataset(const double key)
SmartPointer< const DoFHandler< dim >, PointValueHistory< dim > > dof_handler
PointValueHistory & operator=(const PointValueHistory &point_value_history)
Second derivatives of shape functions.
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition: utilities.cc:85
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
unsigned int size() const
void write_gnuplot(const std::string &base_name, const std::vector< Point< dim > > &postprocessor_locations=std::vector< Point< dim > >())
void add_independent_names(const std::vector< std::string > &independent_names)
Vector< double > mark_support_locations()
bool deep_check(const bool strict)
Definition: mpi.h:41
std::map< std::string, ComponentMask > component_mask
Shape function gradients.
Normal vectors.
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
void status(std::ostream &out)
static ::ExceptionBase & ExcNotImplemented()
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
void add_point(const Point< dim > &location)
void get_points(std::vector< std::vector< Point< dim > > > &locations)
std::map< std::string, std::vector< std::string > > component_names_map
void get_support_locations(std::vector< std::vector< Point< dim > > > &locations)
MeshType< dim, spacedim >::active_cell_iterator find_active_cell_around_point(const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p)
Definition: grid_tools.cc:1298
virtual std::vector< std::string > get_names() const =0
static ::ExceptionBase & ExcInternalError()
virtual UpdateFlags get_needed_update_flags() const =0
void push_back_independent(const std::vector< double > &independent_values)