* <h5>Sparsity patterns</h5>
*
* At the time of writing this, the only class equipped to deal with the
- * situation just explained is CompressedSimpleSparsityPattern. A version of
- * the function CompressedSimpleSparsityPattern::reinit() exists that takes an
+ * situation just explained is DynamicSparsityPattern. A version of
+ * the function DynamicSparsityPattern::reinit() exists that takes an
* IndexSet argument that indicates which lines of the sparsity pattern to
* allocate memory for. In other words, it is safe to create such an object
* that will report as its size 1 billion, but in fact only stores only as
* When creating the sparsity pattern as well as when assembling the linear
* system, we need to know about constraints on degrees of freedom, for
* example resulting from hanging nodes or boundary conditions. Like the
- * CompressedSimpleSparsityPattern class, the ConstraintMatrix can also take
+ * DynamicSparsityPattern class, the ConstraintMatrix can also take
* an IndexSet upon construction that indicates for which of the possibly very
* large number of degrees of freedom it should actually store
* constraints. Unlike for the sparsity pattern, these are now only those
* store all necessary constraints on each processor: you will just generate
* wrong matrix entries, but the program will not abort. This is opposed to
* the situation of the sparsity pattern: there, if the IndexSet passed to the
- * CompressedSimpleSparsityPattern indicates that it should store too few rows
+ * DynamicSparsityPattern indicates that it should store too few rows
* of the matrix, the program will either abort when you attempt to write into
* matrix entries that do not exist or the matrix class will silently allocate
* more memory to accommodate them. As a consequence, it is useful to err on
* locations can be added any more. Only after compression can a sparsity
* pattern be associated to a matrix, since the latter requires the efficient
* compressed data format of the former. Building a sparsity pattern during
- * the dynamic phase often happens with the DoFTools:make_sparsity_pattern()
+ * the dynamic phase often happens with the DoFTools::make_sparsity_pattern()
* function. Although this may appear a restriction, it is typically not a
* significant problem to first build a sparsity pattern and then to write
* into the matrix only in the previously allocated locations, since in finite
* The main drawback of static sparsity patterns is that their efficient
* construction requires a reasonably good guess how many entries each of the
* rows may maximally have. During the actual construction, for example in the
- * DoFTools:make_sparsity_pattern() function, only at most as many entries can
+ * DoFTools::make_sparsity_pattern() function, only at most as many entries can
* be allocated as previously stated. This is a problem because it is often
* difficult to estimate the maximal number of entries per row. Consequently,
* a common strategy is to first build and intermediate sparsity pattern that
* with bad estimates requires huge amounts of memory, almost all of which
* will not be used and be de-allocated upon compression.
*
- * To avoid this, deal.II contains a number of "dynamic" or "compressed"
- * sparsity patterns that only allocate as much memory as necessary to hold
- * the currently added entries. While this saves much memory compared to the
- * worst-case behavior mentioned above, it requires the use of less efficient
- * storage schemes for insertion of elements, and the frequent allocation of
- * memory often also takes significant compute time. The tradeoff to avoid
- * excessive memory allocation cannot be avoided, however.
- *
- * The following classes implement this "dynamic" memory scheme in deal.II:
- * - CompressedSparsityPattern
- * - CompressedSimpleSparsityPattern
- * - CompressedSetSparsityPattern
- *
- * These classes have different performance characteristics and memory
- * requirements. Which one is the "best" changes from case to case because
- * it is dependent on the number of dofs, the number of couplings per dof,
- * the strategy used to insert and the amount of memory available.
- *
- * CompressedSparsityPattern and CompressedSimpleSparsityPattern are very
- * similar, where CompressedSimpleSparsityPattern trades some memory (requires
- * up to twice the memory in the worst case) for additional speed which is
- * noticeable in cases with many nonzero entries. CompressedSetSparsityPattern
- * on the other hand uses a lot more memory but may perform better in cases with
- * many nonzero entries per row. See for example the step-27
- * and step-22 tutorial programs.
- *
- * As a guideline you should start using CompressedSparsityPattern and try the
- * other variants if you run into problems. Switching between them should be as
- * simple as changing the class name because all classes have the same interface
- * for adding entries.
- * In either case, these classes are typically used in the following way
- * (replace the class CompressedSparsityPattern with a different one from above):
+ * To avoid this, deal.II contains a "dynamic" or "compressed" sparsity
+ * pattern called DynamicSparsityPattern that only allocate as much memory as
+ * necessary to hold the currently added entries. While this saves much memory
+ * compared to the worst-case behavior mentioned above, it requires the use of
+ * less efficient storage schemes for insertion of elements, and the frequent
+ * allocation of memory often also takes significant compute time. The
+ * tradeoff to avoid excessive memory allocation cannot be avoided, however.
+ *
+ * The class is typically used in the following way
* @verbatim
- * CompressedSparsityPattern compressed_pattern (dof_handler.n_dofs());
+ * DynamicSparsityPattern dsp (dof_handler.n_dofs());
* DoFTools::make_sparsity_pattern (dof_handler,
- * compressed_pattern);
- * constraints.condense (compressed_pattern);
+ * dsp);
+ * constraints.condense (dsp);
*
* SparsityPattern final_sparsity_pattern;
- * final_sparsity_pattern.copy_from (compressed_pattern);
+ * final_sparsity_pattern.copy_from (dsp);
* @endverbatim
*
* The intermediate, compressed sparsity pattern is directly copied into the
*
* <h4>Dynamic block sparsity patterns</h4>
*
- * The following classes implement an array of dynamic sparsity patterns:
- * - BlockCompressedSparsityPattern
- * - BlockCompressedSetSparsityPattern
- * - BlockCompressedSimpleSparsityPattern
- *
- * These classes inherit the same tradeoffs regarding their efficiency from
- * their non-block classes (see above). See their documentation and
+ * The class BlockDynamicSparsityPattern implements an array of dynamic
+ * sparsity patterns for contructing block matrices. See the documentation and
* step-22 for more information.
*
* @ingroup Matrices
std::vector<unsigned int> dofs_per_block(fe.n_blocks());
DoFTools::count_dofs_per_block(dof, dofs_per_block);
- BlockDynamicSparsityPattern c_sparsity(fe.n_blocks(), fe.n_blocks());
+ BlockDynamicSparsityPattern dsp(fe.n_blocks(), fe.n_blocks());
for (unsigned int i=0; i<fe.n_blocks(); ++i)
for (unsigned int j=0; j<fe.n_blocks(); ++j)
- c_sparsity.block(i,j).reinit(dofs_per_block[i],dofs_per_block[j]);
- c_sparsity.collect_sizes();
+ dsp.block(i,j).reinit(dofs_per_block[i],dofs_per_block[j]);
+ dsp.collect_sizes();
- DoFTools::make_sparsity_pattern(dof, c_sparsity);
- constraints.condense(c_sparsity);
+ DoFTools::make_sparsity_pattern(dof, dsp);
+ constraints.condense(dsp);
BlockSparsityPattern sparsity;
- sparsity.copy_from(c_sparsity);
+ sparsity.copy_from(dsp);
unsigned int ig = 0;
for (unsigned int ib=0; ib<fe.n_blocks(); ++ib)
#include <deal.II/numerics/matrix_tools.h>
// Just this one is new: it declares a class
-// <code>DynamicSparsityPattern</code>, which we will use and explain
+// DynamicSparsityPattern, which we will use and explain
// further down below.
#include <deal.II/lac/dynamic_sparsity_pattern.h>
//
// Since this can be so difficult that no reasonable answer can be given
// that allows allocation of only a reasonable amount of memory, there is
- // a class <code>DynamicSparsityPattern</code>, that can help us out
+ // a class DynamicSparsityPattern, that can help us out
// here. It does not require that we know in advance how many entries rows
// could have, but allows just about any length. It is thus significantly
// more flexible in case you do not have good estimates of row lengths,
// pattern due to the differential operator, then condense it with the
// constraints object which adds those positions in the sparsity pattern
// that are required for the elimination of the constraint.
- DynamicSparsityPattern csp (dof_handler.n_dofs(),
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(),
dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- mean_value_constraints.condense (csp);
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ mean_value_constraints.condense (dsp);
// Finally, once we have the full pattern, we can initialize an object of
// type <code>SparsityPattern</code> from it and in turn initialize the
// matrix with it. Note that this is actually necessary, since the
- // <code>DynamicSparsityPattern</code> is so inefficient compared to
+ // DynamicSparsityPattern is so inefficient compared to
// the <code>SparsityPattern</code> class due to the more flexible data
// structures it has to use, that we can impossibly base the sparse matrix
// class on it, but rather need an object of type
// compressed object right from the start, to which you cannot add new
// entries anymore. The <code>compress</code> call is therefore implicit
// in the <code>copy_from</code> call.
- sparsity_pattern.copy_from (csp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
}
// To build the sparsity pattern for DG discretizations, we can call the
// function analogue to DoFTools::make_sparsity_pattern, which is called
// DoFTools::make_flux_sparsity_pattern:
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_flux_sparsity_pattern (dof_handler, c_sparsity);
- sparsity_pattern.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_flux_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from(dsp);
// Finally, we set up the structure of all components of the linear
// system.
= &DoFTools::make_hanging_node_constraints;
// Start a side task then continue on the main thread
- Threads::Task<> side_task(std_cxx11::bind(mhnc_p,std_cxx11::cref(dof_handler),
- std_cxx11::ref(hanging_node_constraints)));
+ Threads::Task<> side_task
+ = Threads::new_task (mhnc_p,
+ dof_handler,
+ hanging_node_constraints);
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
side_task.join();
hanging_node_constraints.close ();
- hanging_node_constraints.condense (csp);
- sparsity_pattern.copy_from(csp);
+ hanging_node_constraints.condense (dsp);
+ sparsity_pattern.copy_from(dsp);
// Finally initialize the matrix and right hand side vector
= &DoFTools::make_hanging_node_constraints;
// Start a side task then continue on the main thread
- Threads::Task<> side_task(std_cxx11::bind(mhnc_p,std_cxx11::cref(dof_handler),
- std_cxx11::ref(hanging_node_constraints)));
+ Threads::Task<> side_task
+ = Threads::new_task (mhnc_p,
+ dof_handler,
+ hanging_node_constraints);
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
side_task.join();
hanging_node_constraints.close ();
- hanging_node_constraints.condense (csp);
- sparsity_pattern.copy_from(csp);
+ hanging_node_constraints.condense (dsp);
+ sparsity_pattern.copy_from(dsp);
matrix.reinit (sparsity_pattern);
rhs.reinit (dof_handler.n_dofs());
newton_update.reinit (dof_handler.n_dofs());
system_rhs.reinit (dof_handler.n_dofs());
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
- hanging_node_constraints.condense (c_sparsity);
+ hanging_node_constraints.condense (dsp);
- sparsity_pattern.copy_from(c_sparsity);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit (sparsity_pattern);
}
? ")" : ", ");
deallog << std::endl;
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
solution.reinit (dof_handler.n_dofs());
system_rhs.reinit (dof_handler.n_dofs());
constraints);
constraints.close ();
hanging_node_constraints.close ();
- constraints.condense (csp);
- sparsity_pattern.copy_from (csp);
+ constraints.condense (dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
// The multigrid constraints have to be initialized. They need to know
// matrices.
for (unsigned int level=0; level<n_levels; ++level)
{
- DynamicSparsityPattern csp (dof_handler.n_dofs(level),
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(level),
dof_handler.n_dofs(level));
- MGTools::make_sparsity_pattern(dof_handler, csp, level);
+ MGTools::make_sparsity_pattern(dof_handler, dsp, level);
- mg_sparsity_patterns[level].copy_from (csp);
+ mg_sparsity_patterns[level].copy_from (dsp);
mg_matrices[level].reinit(mg_sparsity_patterns[level]);
mg_interface_in[level].reinit(mg_sparsity_patterns[level]);
// to initialize this intermediate data structure, we have to give it the
// size of the matrix, which in our case will be square with as many rows
// and columns as there are degrees of freedom on the grid:
- DynamicSparsityPattern compressed_sparsity_pattern(dof_handler.n_dofs(),
- dof_handler.n_dofs());
+ DynamicSparsityPattern dynamic_sparsity_pattern(dof_handler.n_dofs(),
+ dof_handler.n_dofs());
// We then fill this object with the places where nonzero elements will be
// located given the present numbering of degrees of freedom:
- DoFTools::make_sparsity_pattern (dof_handler, compressed_sparsity_pattern);
+ DoFTools::make_sparsity_pattern (dof_handler, dynamic_sparsity_pattern);
// Now we are ready to create the actual sparsity pattern that we could
// later use for our matrix. It will just contain the data already assembled
// in the DynamicSparsityPattern.
SparsityPattern sparsity_pattern;
- sparsity_pattern.copy_from (compressed_sparsity_pattern);
+ sparsity_pattern.copy_from (dynamic_sparsity_pattern);
// With this, we can now write the results to a file:
std::ofstream out ("sparsity_pattern.1");
{
DoFRenumbering::Cuthill_McKee (dof_handler);
- DynamicSparsityPattern compressed_sparsity_pattern(dof_handler.n_dofs(),
- dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, compressed_sparsity_pattern);
+ DynamicSparsityPattern dynamic_sparsity_pattern(dof_handler.n_dofs(),
+ dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dynamic_sparsity_pattern);
SparsityPattern sparsity_pattern;
- sparsity_pattern.copy_from (compressed_sparsity_pattern);
+ sparsity_pattern.copy_from (dynamic_sparsity_pattern);
std::ofstream out ("sparsity_pattern.2");
sparsity_pattern.print_gnuplot (out);
// <code>n_u</code> and <code>n_p</code>, which hold the number of velocity
// and pressure variables. In the second step we have to instruct the block
// system to update its knowledge about the sizes of the blocks it manages;
- // this happens with the <code>c_sparsity.collect_sizes ()</code> call.
- BlockDynamicSparsityPattern c_sparsity(2, 2);
- c_sparsity.block(0, 0).reinit (n_u, n_u);
- c_sparsity.block(1, 0).reinit (n_p, n_u);
- c_sparsity.block(0, 1).reinit (n_u, n_p);
- c_sparsity.block(1, 1).reinit (n_p, n_p);
- c_sparsity.collect_sizes ();
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
+ // this happens with the <code>dsp.collect_sizes ()</code> call.
+ BlockDynamicSparsityPattern dsp(2, 2);
+ dsp.block(0, 0).reinit (n_u, n_u);
+ dsp.block(1, 0).reinit (n_p, n_u);
+ dsp.block(0, 1).reinit (n_u, n_p);
+ dsp.block(1, 1).reinit (n_p, n_p);
+ dsp.collect_sizes ();
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
// We use the compressed block sparsity pattern in the same way as the
// non-block version to create the sparsity pattern and then the system
// matrix:
- sparsity_pattern.copy_from(c_sparsity);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit (sparsity_pattern);
// Then we have to resize the solution and right hand side vectors in
// in step-11 and step-18.
//
// All this is done inside a new scope, which
- // means that the memory of <code>csp</code> will be released once the
+ // means that the memory of <code>dsp</code> will be released once the
// information has been copied to <code>sparsity_pattern</code>.
{
- BlockDynamicSparsityPattern csp (2,2);
+ BlockDynamicSparsityPattern dsp (2,2);
- csp.block(0,0).reinit (n_u, n_u);
- csp.block(1,0).reinit (n_p, n_u);
- csp.block(0,1).reinit (n_u, n_p);
- csp.block(1,1).reinit (n_p, n_p);
+ dsp.block(0,0).reinit (n_u, n_u);
+ dsp.block(1,0).reinit (n_p, n_u);
+ dsp.block(0,1).reinit (n_u, n_p);
+ dsp.block(1,1).reinit (n_p, n_p);
- csp.collect_sizes();
+ dsp.collect_sizes();
- DoFTools::make_sparsity_pattern (dof_handler, csp, constraints, false);
- sparsity_pattern.copy_from (csp);
+ DoFTools::make_sparsity_pattern (dof_handler, dsp, constraints, false);
+ sparsity_pattern.copy_from (dsp);
}
// Finally, the system matrix, solution and right hand side are created
<< std::endl
<< std::endl;
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from (dsp);
// Then comes a block where we have to initialize the 3 matrices we need
// in the course of the program: the mass matrix, the Laplace matrix, and
<< std::endl
<< std::endl;
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
mass_matrix.reinit (sparsity_pattern);
<< dof_handler.n_dofs()
<< std::endl;
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
mass_matrix.reinit (sparsity_pattern);
constraints);
constraints.close();
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler,
- c_sparsity,
+ dsp,
constraints,
/*keep_constrained_dofs = */ true);
- sparsity_pattern.copy_from(c_sparsity);
+ sparsity_pattern.copy_from(dsp);
mass_matrix.reinit(sparsity_pattern);
laplace_matrix.reinit(sparsity_pattern);
constraints);
constraints.close ();
- DynamicSparsityPattern csp (dof_handler.n_dofs(),
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(),
dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp, constraints, false);
- sparsity_pattern.copy_from (csp);
+ DoFTools::make_sparsity_pattern (dof_handler, dsp, constraints, false);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
}
system_matrix.clear ();
- DynamicSparsityPattern csp(n_dofs, n_dofs);
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- hanging_node_constraints.condense (csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp(n_dofs, n_dofs);
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ hanging_node_constraints.condense (dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
dof_handler.distribute_dofs (fe);
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
system_rhs.reinit (dof_handler.n_dofs());
// first creating a temporary structure, tagging those entries that might be
// nonzero, and then copying the data over to the SparsityPattern object
// that can then be used by the system matrix.
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
- sparsity_pattern.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from(dsp);
// Note that the SparsityPattern object does not hold the values of the
// matrix, it only stores the places where entries are. The entries
{
stokes_matrix.clear ();
- BlockDynamicSparsityPattern csp (2,2);
+ BlockDynamicSparsityPattern dsp (2,2);
- csp.block(0,0).reinit (n_u, n_u);
- csp.block(0,1).reinit (n_u, n_p);
- csp.block(1,0).reinit (n_p, n_u);
- csp.block(1,1).reinit (n_p, n_p);
+ dsp.block(0,0).reinit (n_u, n_u);
+ dsp.block(0,1).reinit (n_u, n_p);
+ dsp.block(1,0).reinit (n_p, n_u);
+ dsp.block(1,1).reinit (n_p, n_p);
- csp.collect_sizes ();
+ dsp.collect_sizes ();
Table<2,DoFTools::Coupling> coupling (dim+1, dim+1);
else
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern (stokes_dof_handler, coupling, csp,
+ DoFTools::make_sparsity_pattern (stokes_dof_handler, coupling, dsp,
stokes_constraints, false);
- stokes_matrix.reinit (csp);
+ stokes_matrix.reinit (dsp);
}
{
Mp_preconditioner.reset ();
stokes_preconditioner_matrix.clear ();
- BlockDynamicSparsityPattern csp (2,2);
+ BlockDynamicSparsityPattern dsp (2,2);
- csp.block(0,0).reinit (n_u, n_u);
- csp.block(0,1).reinit (n_u, n_p);
- csp.block(1,0).reinit (n_p, n_u);
- csp.block(1,1).reinit (n_p, n_p);
+ dsp.block(0,0).reinit (n_u, n_u);
+ dsp.block(0,1).reinit (n_u, n_p);
+ dsp.block(1,0).reinit (n_p, n_u);
+ dsp.block(1,1).reinit (n_p, n_p);
- csp.collect_sizes ();
+ dsp.collect_sizes ();
Table<2,DoFTools::Coupling> coupling (dim+1, dim+1);
for (unsigned int c=0; c<dim+1; ++c)
else
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern (stokes_dof_handler, coupling, csp,
+ DoFTools::make_sparsity_pattern (stokes_dof_handler, coupling, dsp,
stokes_constraints, false);
- stokes_preconditioner_matrix.reinit (csp);
+ stokes_preconditioner_matrix.reinit (dsp);
}
// The creation of the temperature matrix (or, rather, matrices, since we
temperature_stiffness_matrix.clear ();
temperature_matrix.clear ();
- DynamicSparsityPattern csp (n_T, n_T);
- DoFTools::make_sparsity_pattern (temperature_dof_handler, csp,
+ DynamicSparsityPattern dsp (n_T, n_T);
+ DoFTools::make_sparsity_pattern (temperature_dof_handler, dsp,
temperature_constraints, false);
- temperature_matrix.reinit (csp);
+ temperature_matrix.reinit (dsp);
temperature_mass_matrix.reinit (temperature_matrix);
temperature_stiffness_matrix.reinit (temperature_matrix);
}
template <int dim>
void ConservationLaw<dim>::setup_system ()
{
- DynamicSparsityPattern sparsity_pattern (dof_handler.n_dofs(),
- dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, sparsity_pattern);
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(),
+ dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
- system_matrix.reinit (sparsity_pattern);
+ system_matrix.reinit (dsp);
}
NavierStokesProjection<dim>::initialize_velocity_matrices()
{
{
- DynamicSparsityPattern csp(dof_handler_velocity.n_dofs(), dof_handler_velocity.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler_velocity, csp);
- sparsity_pattern_velocity.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler_velocity.n_dofs(), dof_handler_velocity.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler_velocity, dsp);
+ sparsity_pattern_velocity.copy_from (dsp);
}
vel_Laplace_plus_Mass.reinit (sparsity_pattern_velocity);
for (unsigned int d=0; d<dim; ++d)
NavierStokesProjection<dim>::initialize_pressure_matrices()
{
{
- DynamicSparsityPattern csp(dof_handler_pressure.n_dofs(), dof_handler_pressure.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler_pressure, csp);
- sparsity_pattern_pressure.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler_pressure.n_dofs(), dof_handler_pressure.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler_pressure, dsp);
+ sparsity_pattern_pressure.copy_from (dsp);
}
pres_Laplace.reinit (sparsity_pattern_pressure);
NavierStokesProjection<dim>::initialize_gradient_operator()
{
{
- DynamicSparsityPattern csp(dof_handler_velocity.n_dofs(), dof_handler_pressure.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler_velocity, dof_handler_pressure, csp);
- sparsity_pattern_pres_vel.copy_from (csp);
+ DynamicSparsityPattern dsp(dof_handler_velocity.n_dofs(), dof_handler_pressure.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler_velocity, dof_handler_pressure, dsp);
+ sparsity_pattern_pres_vel.copy_from (dsp);
}
InitGradPerTaskData per_task_data (0, fe_velocity.dofs_per_cell,
// previously. One way to do that would be to use code like this:
// @code
// DynamicSparsityPattern
- // csp (dof_handler.n_dofs(),
+ // dsp (dof_handler.n_dofs(),
// dof_handler.n_dofs());
- // DoFTools::make_sparsity_pattern (dof_handler, csp);
- // csp.compress ();
- // stiffness_matrix.reinit (csp);
- // mass_matrix.reinit (csp);
+ // DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ // dsp.compress ();
+ // stiffness_matrix.reinit (dsp);
+ // mass_matrix.reinit (dsp);
// @endcode
// instead of the two <code>reinit()</code> calls for the
// stiffness and mass matrices below.
<< " degrees of freedom."
<< std::endl;
- DynamicSparsityPattern csp (dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
// not know the row sizes in advance, we first fill a temporary
// DynamicSparsityPattern object and copy it to the regular
// SparsityPattern once it is complete.
- DynamicSparsityPattern c_sparsity(n_dofs);
- DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
- sparsity.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(n_dofs);
+ DoFTools::make_flux_sparsity_pattern(dof_handler, dsp);
+ sparsity.copy_from(dsp);
matrix.reinit(sparsity);
const unsigned int n_levels = triangulation.n_levels();
{
// These are roughly the same lines as above for the global matrix,
// now for each level.
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern(dof_handler, c_sparsity, level);
- mg_sparsity[level].copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(level));
+ MGTools::make_flux_sparsity_pattern(dof_handler, dsp, level);
+ mg_sparsity[level].copy_from(dsp);
mg_matrix[level].reinit(mg_sparsity[level]);
// Additionally, we need to initialize the transfer matrices at the
// object on level 0.
if (level>0)
{
- DynamicSparsityPattern ci_sparsity;
- ci_sparsity.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern_edge(dof_handler, ci_sparsity, level);
- mg_sparsity_dg_interface[level].copy_from(ci_sparsity);
+ DynamicSparsityPattern dsp;
+ dsp.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
+ MGTools::make_flux_sparsity_pattern_edge(dof_handler, dsp, level);
+ mg_sparsity_dg_interface[level].copy_from(dsp);
mg_matrix_dg_up[level].reinit(mg_sparsity_dg_interface[level]);
mg_matrix_dg_down[level].reinit(mg_sparsity_dg_interface[level]);
}
<< dof_handler.n_dofs()
<< std::endl;
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
- sparsity_pattern.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit (sparsity_pattern);
// entries that will exist in that part of the finite element matrix that
// it will own. The final step is to initialize the matrix with the
// sparsity pattern.
- DynamicSparsityPattern csp (locally_relevant_dofs);
+ DynamicSparsityPattern dsp (locally_relevant_dofs);
- DoFTools::make_sparsity_pattern (dof_handler, csp,
+ DoFTools::make_sparsity_pattern (dof_handler, dsp,
constraints, false);
- SparsityTools::distribute_sparsity_pattern (csp,
+ SparsityTools::distribute_sparsity_pattern (dsp,
dof_handler.n_locally_owned_dofs_per_processor(),
mpi_communicator,
locally_relevant_dofs);
system_matrix.reinit (locally_owned_dofs,
locally_owned_dofs,
- csp,
+ dsp,
mpi_communicator);
}
constraints);
constraints.close ();
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern (dof_handler,
- c_sparsity,
+ dsp,
constraints,
false);
- system_matrix.reinit (c_sparsity);
- complete_system_matrix.reinit (c_sparsity);
+ system_matrix.reinit (dsp);
+ complete_system_matrix.reinit (dsp);
solution.reinit (dof_handler.n_dofs());
system_rhs.reinit (dof_handler.n_dofs());
// diagonal, and in the following then first compute all of this as a
// matrix and then extract the diagonal elements for later use:
TrilinosWrappers::SparseMatrix mass_matrix;
- mass_matrix.reinit (c_sparsity);
+ mass_matrix.reinit (dsp);
assemble_mass_matrix_diagonal (mass_matrix);
diagonal_of_mass_matrix.reinit (dof_handler.n_dofs());
for (unsigned int j=0; j<solution.size (); j++)
{
darcy_matrix.clear ();
- BlockDynamicSparsityPattern csp (2,2);
+ BlockDynamicSparsityPattern dsp (2,2);
- csp.block(0,0).reinit (n_u, n_u);
- csp.block(0,1).reinit (n_u, n_p);
- csp.block(1,0).reinit (n_p, n_u);
- csp.block(1,1).reinit (n_p, n_p);
+ dsp.block(0,0).reinit (n_u, n_u);
+ dsp.block(0,1).reinit (n_u, n_p);
+ dsp.block(1,0).reinit (n_p, n_u);
+ dsp.block(1,1).reinit (n_p, n_p);
- csp.collect_sizes ();
+ dsp.collect_sizes ();
Table<2,DoFTools::Coupling> coupling (dim+1, dim+1);
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern (darcy_dof_handler, coupling, csp,
+ DoFTools::make_sparsity_pattern (darcy_dof_handler, coupling, dsp,
darcy_constraints, false);
- darcy_matrix.reinit (csp);
+ darcy_matrix.reinit (dsp);
}
{
Mp_preconditioner.reset ();
darcy_preconditioner_matrix.clear ();
- BlockDynamicSparsityPattern csp (2,2);
+ BlockDynamicSparsityPattern dsp (2,2);
- csp.block(0,0).reinit (n_u, n_u);
- csp.block(0,1).reinit (n_u, n_p);
- csp.block(1,0).reinit (n_p, n_u);
- csp.block(1,1).reinit (n_p, n_p);
+ dsp.block(0,0).reinit (n_u, n_u);
+ dsp.block(0,1).reinit (n_u, n_p);
+ dsp.block(1,0).reinit (n_p, n_u);
+ dsp.block(1,1).reinit (n_p, n_p);
- csp.collect_sizes ();
+ dsp.collect_sizes ();
Table<2,DoFTools::Coupling> coupling (dim+1, dim+1);
for (unsigned int c=0; c<dim+1; ++c)
else
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern (darcy_dof_handler, coupling, csp,
+ DoFTools::make_sparsity_pattern (darcy_dof_handler, coupling, dsp,
darcy_constraints, false);
- darcy_preconditioner_matrix.reinit (csp);
+ darcy_preconditioner_matrix.reinit (dsp);
}
{
saturation_matrix.clear ();
- DynamicSparsityPattern csp (n_s, n_s);
+ DynamicSparsityPattern dsp (n_s, n_s);
- DoFTools::make_sparsity_pattern (saturation_dof_handler, csp,
+ DoFTools::make_sparsity_pattern (saturation_dof_handler, dsp,
saturation_constraints, false);
- saturation_matrix.reinit (csp);
+ saturation_matrix.reinit (dsp);
}
darcy_solution.reinit (2);
const types::global_dof_index n_dofs_p = dofs_per_block[p_dof];
const types::global_dof_index n_dofs_J = dofs_per_block[J_dof];
- BlockDynamicSparsityPattern csp(n_blocks, n_blocks);
+ BlockDynamicSparsityPattern dsp(n_blocks, n_blocks);
- csp.block(u_dof, u_dof).reinit(n_dofs_u, n_dofs_u);
- csp.block(u_dof, p_dof).reinit(n_dofs_u, n_dofs_p);
- csp.block(u_dof, J_dof).reinit(n_dofs_u, n_dofs_J);
+ dsp.block(u_dof, u_dof).reinit(n_dofs_u, n_dofs_u);
+ dsp.block(u_dof, p_dof).reinit(n_dofs_u, n_dofs_p);
+ dsp.block(u_dof, J_dof).reinit(n_dofs_u, n_dofs_J);
- csp.block(p_dof, u_dof).reinit(n_dofs_p, n_dofs_u);
- csp.block(p_dof, p_dof).reinit(n_dofs_p, n_dofs_p);
- csp.block(p_dof, J_dof).reinit(n_dofs_p, n_dofs_J);
+ dsp.block(p_dof, u_dof).reinit(n_dofs_p, n_dofs_u);
+ dsp.block(p_dof, p_dof).reinit(n_dofs_p, n_dofs_p);
+ dsp.block(p_dof, J_dof).reinit(n_dofs_p, n_dofs_J);
- csp.block(J_dof, u_dof).reinit(n_dofs_J, n_dofs_u);
- csp.block(J_dof, p_dof).reinit(n_dofs_J, n_dofs_p);
- csp.block(J_dof, J_dof).reinit(n_dofs_J, n_dofs_J);
- csp.collect_sizes();
+ dsp.block(J_dof, u_dof).reinit(n_dofs_J, n_dofs_u);
+ dsp.block(J_dof, p_dof).reinit(n_dofs_J, n_dofs_p);
+ dsp.block(J_dof, J_dof).reinit(n_dofs_J, n_dofs_J);
+ dsp.collect_sizes();
// The global system matrix initially has the following structure
// @f{align*}
coupling[ii][jj] = DoFTools::always;
DoFTools::make_sparsity_pattern(dof_handler_ref,
coupling,
- csp,
+ dsp,
constraints,
false);
- sparsity_pattern.copy_from(csp);
+ sparsity_pattern.copy_from(dsp);
}
tangent_matrix.reinit(sparsity_pattern);
// Then we create the sparsity pattern and the system matrix and
// initialize the solution and right-hand side vectors. This is again as
// in step-3 or step-6, for example:
- DynamicSparsityPattern c_sparsity_pattern (dof_handler.n_dofs(),
- dof_handler.n_dofs());
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(),
+ dof_handler.n_dofs());
DoFTools::make_sparsity_pattern (dof_handler,
- c_sparsity_pattern,
+ dsp,
constraints,
false);
- c_sparsity_pattern.compress ();
- sparsity_pattern.copy_from (c_sparsity_pattern);
+ dsp.compress ();
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
system_rhs.reinit (dof_handler.n_dofs());
// extensively in the introduction, and use it to initialize the matrix;
// then also set vectors to their correct sizes:
{
- DynamicSparsityPattern csp (dof_handler.n_dofs(),
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(),
dof_handler.n_dofs());
Table<2,DoFTools::Coupling> cell_coupling (fe_collection.n_components(),
face_coupling[c][d] = DoFTools::always;
}
- DoFTools::make_flux_sparsity_pattern (dof_handler, csp,
+ DoFTools::make_flux_sparsity_pattern (dof_handler, dsp,
cell_coupling, face_coupling);
- constraints.condense (csp);
- sparsity_pattern.copy_from (csp);
+ constraints.condense (dsp);
+ sparsity_pattern.copy_from (dsp);
}
system_matrix.reinit (sparsity_pattern);
constraints.close();
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
- constraints.condense (c_sparsity);
+ constraints.condense (dsp);
- sparsity_pattern.copy_from(c_sparsity);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit (sparsity_pattern);
}
<< dof_handler.n_dofs()
<< std::endl;
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
- sparsity_pattern.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit (sparsity_pattern);
constraints.close ();
hanging_node_constraints.close ();
- DynamicSparsityPattern csp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (mg_dof_handler, csp, constraints);
- system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD, true);
+ DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (mg_dof_handler, dsp, constraints);
+ system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
// The multigrid constraints have to be
// initialized. They need to know about
// matrices.
for (unsigned int level=0; level<n_levels; ++level)
{
- DynamicSparsityPattern csp(mg_dof_handler.n_dofs(level),
+ DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(level),
mg_dof_handler.n_dofs(level));
- MGTools::make_sparsity_pattern(mg_dof_handler, csp, level);
+ MGTools::make_sparsity_pattern(mg_dof_handler, dsp, level);
mg_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level),
mg_dof_handler.locally_owned_mg_dofs(level),
- csp,
+ dsp,
MPI_COMM_WORLD, true);
mg_interface_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level),
mg_dof_handler.locally_owned_mg_dofs(level),
- csp,
+ dsp,
MPI_COMM_WORLD, true);
}
}
// to the number of dofs on a face, when copying this into the final
// sparsity pattern.
{
- DynamicSparsityPattern csp (dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp,
+ DynamicSparsityPattern dsp (dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp,
constraints, false);
- sparsity_pattern.copy_from(csp, fe.dofs_per_face);
+ sparsity_pattern.copy_from(dsp, fe.dofs_per_face);
}
system_matrix.reinit (sparsity_pattern);
}
VectorTools::interpolate_boundary_values(dof_handler,1,ZeroFunction<2>(),constraint_matrix);
constraint_matrix.close();
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(dof_handler,c_sparsity,constraint_matrix);
- sparsity_pattern.copy_from(c_sparsity);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern(dof_handler,dsp,constraint_matrix);
+ sparsity_pattern.copy_from(dsp);
system_matrix.reinit(sparsity_pattern);
mass_matrix.reinit(sparsity_pattern);
// constraints after assembling, we would have to pass <code>true</code>
// instead because then we would first write into these locations only to
// later set them to zero again during condensation.
- DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
+ DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler,
- c_sparsity,
+ dsp,
constraints,
/*keep_constrained_dofs = */ false);
// regularly assembling the matrix and those that were introduced by
// eliminating constraints). We can thus copy our intermediate object to the
// sparsity pattern:
- sparsity_pattern.copy_from(c_sparsity);
+ sparsity_pattern.copy_from(dsp);
// Finally, the so-constructed sparsity pattern serves as the basis on top
// of which we will create the sparse matrix:
hanging_node_constraints);
hanging_node_constraints.close ();
- DynamicSparsityPattern csp (dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, csp);
- hanging_node_constraints.condense (csp);
- sparsity_pattern.copy_from (csp);
+ DynamicSparsityPattern dsp (dof_handler.n_dofs(), dof_handler.n_dofs());
+ DoFTools::make_sparsity_pattern (dof_handler, dsp);
+ hanging_node_constraints.condense (dsp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
hanging_node_constraints);
hanging_node_constraints.close ();
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler,
- csp,
+ dsp,
hanging_node_constraints,
/*keep_constrained_dofs = */ true);
- sparsity_pattern.copy_from (csp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
hanging_node_constraints);
hanging_node_constraints.close ();
- DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler,
- csp,
+ dsp,
hanging_node_constraints,
/*keep_constrained_dofs = */ true);
- sparsity_pattern.copy_from (csp);
+ sparsity_pattern.copy_from (dsp);
system_matrix.reinit (sparsity_pattern);
/**
* This is the base class for block versions of the sparsity pattern and
- * compressed sparsity pattern classes. It has not much functionality, but
- * only administrates an array of sparsity pattern objects and delegates work
- * to them. It has mostly the same interface as has the SparsityPattern,
- * CompressedSparsityPattern, and CompressedSetSparsityPattern classes, and
- * simply transforms calls to its member functions to calls to the respective
- * member functions of the member sparsity patterns.
+ * dynamic sparsity pattern classes. It has not much functionality, but only
+ * administrates an array of sparsity pattern objects and delegates work to
+ * them. It has mostly the same interface as has the SparsityPattern, and
+ * DynamicSparsityPattern, and simply transforms calls to its member functions
+ * to calls to the respective member functions of the member sparsity
+ * patterns.
*
* The largest difference between the SparsityPattern and
- * CompressedSparsityPattern classes and this class is that mostly, the
+ * DynamicSparsityPattern classes and this class is that mostly, the
* matrices have different properties and you will want to work on the blocks
* making up the matrix rather than the whole matrix. You can access the
* different blocks using the <tt>block(row,col)</tt> function.
* the use of block indices causes some additional complications, we give a
* short example.
*
- * @dontinclude compressed_block_sparsity_pattern.cc
+ * @dontinclude block_dynamic_sparsity_pattern.cc
*
* After the the DoFHandler <tt>dof</tt> and the ConstraintMatrix
* <tt>constraints</tt> have been set up with a system element, we must count
* the degrees of freedom in each matrix block:
*
- * @skipline dofs_per_block @until count
+ * @skipline dofs_per_block
+ * @until count
*
* Now, we are ready to set up the BlockDynamicSparsityPattern.
*
*/
void reinit(const std::vector<IndexSet> &rows,
const std::vector<IndexSet> &cols,
- const BlockDynamicSparsityPattern &bcsp,
+ const BlockDynamicSparsityPattern &bdsp,
const MPI_Comm &com);
* Same as above but for a symmetric structure only.
*/
void reinit(const std::vector<IndexSet> &sizes,
- const BlockDynamicSparsityPattern &bcsp,
+ const BlockDynamicSparsityPattern &bdsp,
const MPI_Comm &com);
BlockSparseMatrix::
reinit(const std::vector<IndexSet> &rows,
const std::vector<IndexSet> &cols,
- const BlockDynamicSparsityPattern &bcsp,
+ const BlockDynamicSparsityPattern &bdsp,
const MPI_Comm &com)
{
- Assert(rows.size() == bcsp.n_block_rows(), ExcMessage("invalid size"));
- Assert(cols.size() == bcsp.n_block_cols(), ExcMessage("invalid size"));
+ Assert(rows.size() == bdsp.n_block_rows(), ExcMessage("invalid size"));
+ Assert(cols.size() == bdsp.n_block_cols(), ExcMessage("invalid size"));
clear();
- this->sub_objects.reinit (bcsp.n_block_rows(),
- bcsp.n_block_cols());
+ this->sub_objects.reinit (bdsp.n_block_rows(),
+ bdsp.n_block_cols());
std::vector<types::global_dof_index> row_sizes;
- for (unsigned int r=0; r<bcsp.n_block_rows(); ++r)
- row_sizes.push_back( bcsp.block(r,0).n_rows() );
+ for (unsigned int r=0; r<bdsp.n_block_rows(); ++r)
+ row_sizes.push_back( bdsp.block(r,0).n_rows() );
this->row_block_indices.reinit (row_sizes);
std::vector<types::global_dof_index> col_sizes;
- for (unsigned int c=0; c<bcsp.n_block_cols(); ++c)
- col_sizes.push_back( bcsp.block(0,c).n_cols() );
+ for (unsigned int c=0; c<bdsp.n_block_cols(); ++c)
+ col_sizes.push_back( bdsp.block(0,c).n_cols() );
this->column_block_indices.reinit (col_sizes);
for (unsigned int r=0; r<this->n_block_rows(); ++r)
for (unsigned int c=0; c<this->n_block_cols(); ++c)
{
- Assert(rows[r].size() == bcsp.block(r,c).n_rows(), ExcMessage("invalid size"));
- Assert(cols[c].size() == bcsp.block(r,c).n_cols(), ExcMessage("invalid size"));
+ Assert(rows[r].size() == bdsp.block(r,c).n_rows(), ExcMessage("invalid size"));
+ Assert(cols[c].size() == bdsp.block(r,c).n_cols(), ExcMessage("invalid size"));
BlockType *p = new BlockType();
p->reinit(rows[r],
cols[c],
- bcsp.block(r,c),
+ bdsp.block(r,c),
com);
this->sub_objects[r][c] = p;
}
void
BlockSparseMatrix::
reinit(const std::vector<IndexSet> &sizes,
- const BlockDynamicSparsityPattern &bcsp,
+ const BlockDynamicSparsityPattern &bdsp,
const MPI_Comm &com)
{
- reinit(sizes, sizes, bcsp, com);
+ reinit(sizes, sizes, bdsp, com);
}