]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add refinement strategies.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 08:38:46 +0000 (08:38 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 08:38:46 +0000 (08:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@238 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_handler.cc
deal.II/deal.II/source/grid/tria.cc

index 563da357c3c02b16b3082ed2741d2700a28f470b..2e9e44657640fc3c5fdd5ccc963aac11f530e9fc 100644 (file)
@@ -1064,7 +1064,7 @@ void DoFHandler<1>::make_sparsity_pattern (dSMatrixStruct &sparsity) const {
 
                                   // set up an array which dofs are used
                                   // on a specific cell
-  unsigned int      *dofs_on_this_cell = new unsigned int[selected_fe->total_dofs];
+  unsigned int *dofs_on_this_cell = new unsigned int[selected_fe->total_dofs];
   
   for (; cell!=endc; ++cell) 
     {
index 43156902bcc4594c455cf04557bfa3c5f47e34f1..f1242121c3ec637533f47f911c12674ecffe7e80 100644 (file)
@@ -5,6 +5,7 @@
 #include <grid/tria.h>
 #include <basic/magic_numbers.h>
 #include <basic/data_io.h>
+#include <lac/dvector.h>
 #include <iostream>
 #include <algorithm>
 #include <map>
@@ -1721,6 +1722,39 @@ void Triangulation<2>::print_gnuplot (ostream &out,
 
 
 
+
+template <int dim>
+void Triangulation<dim>::refine (const dVector &criteria,
+                                const double   threshold) {
+  Assert (criteria.n() == n_active_cells(),
+         ExcInvalidVectorSize(criteria.n(), n_active_cells()));
+
+  active_cell_iterator cell = begin_active();
+  const unsigned int n_cells = criteria.n();
+  
+  for (unsigned int index=0; index<n_cells; ++cell, ++index)
+    if (criteria(index) > threshold)
+      cell->set_refine_flag();
+};
+
+
+
+template <int dim>
+void Triangulation<dim>::refine_fixed_number (const dVector &criteria,
+                                             const double   fraction) {
+  dVector tmp(criteria);
+  nth_element (tmp.begin(),
+              tmp.begin()+static_cast<int>(fraction*tmp.n()),
+              tmp.end(),
+              greater<double>());
+
+  refine (criteria, *(tmp.begin() +
+                     static_cast<int>(fraction*tmp.n())));
+};
+
+
+
+
 void Triangulation<1>::execute_refinement () {
   prepare_refinement ();
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.