} else {
$status = "$status $work $rep ";
}
-
+
+ $tag =~ s/ .*//;
$tag = '' if ($tag eq '(none)');
$date = '' if ($date eq '(none)');
$opt = '' if ($opt eq '(none)');
- $opt = '' if ($opt eq '-kk');
+# $opt = '' if ($opt eq '-kk');
my $stick = $tag . $date . $opt;
- $stick = "Stick $stick" unless ($stick eq '');
+ $stick = "$stick" unless ($stick eq '');
$status .= $stick;
- printf "%-40s %-20s %s\n", $file, $status,
+ printf "%-40s %-30s %s\n", $file, $status,
(($short) ? '' : $rep_file)
unless ($compress && ($status eq 'OK '));
}
//
-// time: Mon Dec 10 11:19:00 2001
+// time: Sun Feb 22 22:08:26 2004
//
-// version: 3.1.2 (format), 4.1.3 (DX)
+// version: 3.1.2 (format), 4.2.0 (DX)
//
// Message Window:
-// window: position = (0.5148,0.0039), size = 0.4781x0.2568
+// window: position = (0.5149,0.0038), size = 0.4780x0.2571
//
-// panel[0]: position = (0.6203,0.5889), size = 0.3047x0.2666, startup = 1, devstyle = 1
+// panel[0]: position = (0.6202,0.5886), size = 0.3048x0.2667, startup = 1, devstyle = 1
// title: value = Control Panel
//
// workspace: width = 196, height = 145
// layout: snap = 1, width = 50, height = 50, align = NL
//
-// interactor FileSelector[1]: num_components = 1, value = NULL
+// interactor FileSelector[1]: num_components = 1, value = "/home/kanschat/deal.II/gk/n/slug.04.dx"
// instance: panel = 0, x = 0, y = 6, style = FileSelector, vertical = 1, size = 196x57
// filter = *.dx
//
-// interactor Integer[1]: num_components = 1, value = 11
-// component[0]: minimum = 0, maximum = 14, global increment = 1, decimal = 0, global continuous = 0
+// interactor Integer[1]: num_components = 1, value = 2
+// component[0]: minimum = 0, maximum = 4, global increment = 1, decimal = 0, global continuous = 0
// instance: panel = 0, x = 0, y = 89, style = Stepper, vertical = 1, size = 118x56
// label: value = Component:
// local continuous: value = 1, mode = local
// local increment[0]: value = 1, mode = global
//
// node Image[1]:
-// depth: value = 8
-// window: position = (0.0000,0.1338), size = 0.5195x0.6553
+// depth: value = 24
+// window: position = (0.0000,0.1333), size = 0.5196x0.6552
// input[1]: defaulting = 0, value = "Image_1"
// input[4]: defaulting = 0, value = 1
-// input[5]: defaulting = 0, value = [0 0 0]
-// input[6]: defaulting = 0, value = [0 0 5.55279]
-// input[7]: defaulting = 0, value = 2.97574
-// input[8]: defaulting = 0, value = 651
-// input[9]: defaulting = 0, value = 0.963902
+// input[5]: defaulting = 0, value = [0.5 1 0]
+// input[6]: defaulting = 0, value = [0.5 1 7.10757]
+// input[7]: defaulting = 0, value = 3.80895
+// input[8]: defaulting = 0, value = 859
+// input[9]: defaulting = 0, value = 0.75
// input[10]: defaulting = 0, value = [0 1 0]
-// input[11]: defaulting = 1, value = 30.0001
+// input[11]: defaulting = 0, value = 30.0001
// input[12]: defaulting = 0, value = 0
// input[14]: defaulting = 0, value = 1
// input[15]: defaulting = 1, value = "none"
// input[19]: defaulting = 0, value = 0
// input[22]: defaulting = 0, value = "white"
// input[26]: defaulting = 0, value = "eps color dpi=65 orient=landscape"
-// input[29]: defaulting = 0, value = 1
+// input[29]: defaulting = 0, value = 0
// input[30]: defaulting = 0, value = {"x", "y", "z"}
// input[33]: defaulting = 0, value = 0
// input[36]: defaulting = 0, value = 0
//
-// time: Mon Dec 10 11:19:00 2001
+// time: Sun Feb 22 22:08:26 2004
//
-// version: 3.1.2 (format), 4.1.3 (DX)
+// version: 3.1.2 (format), 4.2.0 (DX)
//
//
// MODULE main
-// page assignment: Color order=2, windowed=0, showing=1
-// page assignment: Display order=3, windowed=0, showing=0
-// page assignment: Input order=1, windowed=0, showing=0
-// workspace: width = 500, height = 551
+// page assignment: Color order=3, windowed=0, showing=1
+// page assignment: Display order=4, windowed=0, showing=0
+// page assignment: Input order=2, windowed=0, showing=0
+// workspace: width = 435, height = 551
// layout: snap = 1, width = 50, height = 80, align = CC
//
macro main(
) {
//
// node FileSelector[1]: x = 331, y = 9, inputs = 0, label = FileSelector
- // output[1]: visible = 1, type = 32, value = NULL
- // output[2]: visible = 1, type = 32, value = NULL
+ // output[1]: visible = 1, type = 32, value = "/home/kanschat/deal.II/gk/n/slug.04.dx"
+ // output[2]: visible = 1, type = 32, value = "slug.04.dx"
// page group: Input
//
//
//
// node Integer[1]: x = 141, y = 329, inputs = 11, label = Integer
// input[1]: defaulting = 0, visible = 0, type = 32, value = "Integer_1"
- // input[3]: defaulting = 0, visible = 0, type = 1, value = 11
+ // input[3]: defaulting = 0, visible = 0, type = 1, value = 2
// input[4]: visible = 1
// input[5]: defaulting = 0, visible = 1, type = 1, value = 0
- // input[6]: defaulting = 1, visible = 1, type = 1, value = 14
+ // input[6]: defaulting = 1, visible = 1, type = 1, value = 4
// input[7]: defaulting = 1, visible = 1, type = 5, value = 1.0
// input[8]: visible = 1
// input[9]: defaulting = 1, visible = 0, type = 1, value = 0
// input[11]: defaulting = 1, visible = 1, type = 32, value = "Component select"
- // output[1]: visible = 1, type = 1, value = 11
+ // output[1]: visible = 1, type = 1, value = 2
// page group: Input
//
main_Integer_1_out_1[cache: 2] =
// node Image[1]: x = 239, y = 329, inputs = 49, label = Image
// input[1]: defaulting = 0, visible = 0, type = 67108863, value = "Image_1"
// input[4]: defaulting = 0, visible = 0, type = 1, value = 1
- // input[5]: defaulting = 0, visible = 0, type = 8, value = [0 0 0]
- // input[6]: defaulting = 0, visible = 0, type = 8, value = [0 0 5.55279]
- // input[7]: defaulting = 0, visible = 0, type = 5, value = 2.97574
- // input[8]: defaulting = 0, visible = 0, type = 1, value = 651
- // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.963902
+ // input[5]: defaulting = 0, visible = 0, type = 8, value = [0.5 1 0]
+ // input[6]: defaulting = 0, visible = 0, type = 8, value = [0.5 1 7.10757]
+ // input[7]: defaulting = 0, visible = 0, type = 5, value = 3.80895
+ // input[8]: defaulting = 0, visible = 0, type = 1, value = 859
+ // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.75
// input[10]: defaulting = 0, visible = 0, type = 8, value = [0 1 0]
- // input[11]: defaulting = 1, visible = 0, type = 5, value = 30.0001
+ // input[11]: defaulting = 0, visible = 0, type = 5, value = 30.0001
// input[12]: defaulting = 0, visible = 0, type = 1, value = 0
// input[14]: defaulting = 0, visible = 0, type = 1, value = 1
// input[15]: defaulting = 1, visible = 0, type = 32, value = "none"
// input[16]: defaulting = 1, visible = 0, type = 32, value = "none"
// input[17]: defaulting = 1, visible = 0, type = 1, value = 1
// input[18]: defaulting = 1, visible = 0, type = 1, value = 1
- // input[19]: defaulting = 0, visible = 0, type = 3, value = 0
+ // input[19]: defaulting = 0, visible = 0, type = 1, value = 0
// input[22]: defaulting = 0, visible = 0, type = 32, value = "white"
// input[26]: defaulting = 0, visible = 0, type = 32, value = "eps color dpi=65 orient=landscape"
- // input[29]: defaulting = 0, visible = 0, type = 3, value = 1
+ // input[29]: defaulting = 0, visible = 0, type = 3, value = 0
// input[30]: defaulting = 0, visible = 0, type = 16777248, value = {"x", "y", "z"}
// input[33]: defaulting = 0, visible = 0, type = 3, value = 0
// input[36]: defaulting = 0, visible = 0, type = 3, value = 0
// input[39]: defaulting = 0, visible = 0, type = 5, value = 0.5
// input[41]: defaulting = 0, visible = 0, type = 32, value = "none"
// page group: Display
- // depth: value = 8
- // window: position = (0.0000,0.1338), size = 0.5195x0.6553
+ // depth: value = 24
+ // window: position = (0.0000,0.1333), size = 0.5196x0.6552
// internal caching: 1
//
main_Image_1_out_1[cache: 0],
// network: end of macro body
CacheScene(main_Image_1_in_1, main_Image_1_out_1, main_Image_1_out_2);
}
-main_FileSelector_1_out_1 = NULL;
-main_FileSelector_1_out_2 = NULL;
+main_FileSelector_1_out_1 = "/home/kanschat/deal.II/gk/n/slug.04.dx";
+main_FileSelector_1_out_2 = "slug.04.dx";
main_Import_1_in_2 = NULL;
main_Import_1_in_3 = NULL;
main_Import_1_in_4 = NULL;
main_Inquire_1_out_1 = NULL;
main_Integer_1_in_1 = "Integer_1";
main_Integer_1_in_2 = NULL;
-main_Integer_1_in_3 = 11 ;
+main_Integer_1_in_3 = 2;
main_Integer_1_in_4 = NULL;
main_Integer_1_in_5 = 0;
main_Integer_1_in_7 = NULL;
main_Integer_1_in_9 = NULL;
main_Integer_1_in_10 = NULL;
main_Integer_1_in_11 = NULL;
-main_Integer_1_out_1 = 11 ;
+main_Integer_1_out_1 = 2;
main_Compute_1_in_1 = "select($0,$1)";
main_Compute_1_out_1 = NULL;
main_Transmitter_1_out_1 = NULL;
RECformat) [instance: 2, cache: 1];
}
main_Image_1_in_1 = "Image_1";
-main_Image_1_in_3 = "X8,,";
+main_Image_1_in_3 = "X24,,";
main_Image_1_in_4 = 1;
-main_Image_1_in_5 = [0 0 0];
-main_Image_1_in_6 = [0 0 5.55279];
-main_Image_1_in_7 = 2.97574;
-main_Image_1_in_8 = 651;
-main_Image_1_in_9 = 0.963902;
+main_Image_1_in_5 = [0.5 1 0];
+main_Image_1_in_6 = [0.5 1 7.10757];
+main_Image_1_in_7 = 3.80895;
+main_Image_1_in_8 = 859;
+main_Image_1_in_9 = 0.75;
main_Image_1_in_10 = [0 1 0];
-main_Image_1_in_11 = NULL;
+main_Image_1_in_11 = 30.0001;
main_Image_1_in_12 = 0;
main_Image_1_in_13 = NULL;
main_Image_1_in_14 = 1;
main_Image_1_in_26 = "eps color dpi=65 orient=landscape";
main_Image_1_in_27 = NULL;
main_Image_1_in_28 = NULL;
-main_Image_1_in_29 = 1;
+main_Image_1_in_29 = 0;
main_Image_1_in_30 = {"x", "y", "z"};
main_Image_1_in_31 = NULL;
main_Image_1_in_32 = NULL;
main_Image_1_in_47 = NULL;
main_Image_1_in_48 = NULL;
main_Image_1_in_49 = NULL;
-Executive("product version 4 1 3");
+Executive("product version 4 2 0");
$sync
main();
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* multilevel algorithms. It has no relation to the actual matrix type
* and takes the vector class as only template argument.
*
- * Usually, the derived class @ref{MGMatrix}, operating on an
- * @ref{MGLevelObject} of matrices will be sufficient for applications.
+ * Usually, the derived class MGMatrix, operating on an
+ * MGLevelObject of matrices will be sufficient for applications.
*
* @author Guido Kanschat, 2002
*/
/**
* Base class used to declare the operations needed by a concrete class
* implementing prolongation and restriction of vectors in the multigrid
- * context. This class is an abstract one and has no implementations of
- * possible algorithms for these operations.
+ * context. This class is abstract and has no implementation of
+ * these operations.
*
* There are several derived classes, reflecting the fact that vector
* types and numbering of the fine-grid discretization and of the
* multi-level implementation are independent.
*
* If you use multigrid for your complete system of equations, you
- * will use @ref{MGTransferPrebuilt} together with Multigrid for
- * Vector objects. The fine-grid vectors may still be of type
- * BlockVector.
+ * will use MGTransferPrebuilt together with Multigrid. The vector
+ * types used on the fine grid as well as for the multilevel
+ * operations may be Vector or BlockVector. In both cases,
+ * MGTransferPrebuilt will operate on all components of the solution.
*
* For mixed systems, it may be required to do multigrid only for a
* single component or for some components. The classes
- * @ref{MGTransferSelect} and @ref{MGTransferBlock} handle these cases.
+ * MGTransferSelect and MGTransferBlock handle these cases.
*
- * MGTransferSelect is used if you use mutligrid (on Vector oblects)
+ * MGTransferSelect is used if you use mutligrid (on Vector objects)
* for a single component, possibly grouped using
- * @p{mg_target_component}.
+ * <tt>mg_target_component</tt>.
*
* The class MGTransferBlock handles the case where your multigrid
* method operates on BlockVector objects. These can contain all or a
/**
* Prolongate a vector from level
- * @p{to_level-1} to level
- * @p{to_level}. The previous
- * content of @p{dst} is
+ * <tt>to_level-1</tt> to level
+ * <tt>to_level</tt>. The previous
+ * content of <tt>dst</tt> is
* overwritten.
*
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the coarser level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the finer
- * level.
+ * @arg src is a vector with as
+ * many elements as there are
+ * degrees of freedom on the
+ * coarser level involved.
+ *
+ * @arg dst has as many elements
+ * as there are degrees of
+ * freedom on the finer level.
*/
virtual void prolongate (const unsigned int to_level,
VECTOR& dst,
/**
* Restrict a vector from level
- * @p{from_level} to level
- * @p{from_level-1} and add this
- * restriction to
- * @p{dst}. Obviously, if the
- * refined region on level
- * @p{from_level} is smaller than
- * that on level @p{from_level-1},
- * some degrees of freedom in
- * @p{dst} are not covered and will
- * not be altered. For the other
- * degress of freedom, the result
- * of the restriction is added.
+ * <tt>from_level</tt> to level
+ * <tt>from_level-1</tt> and add
+ * this restriction to
+ * <tt>dst</tt>. If the region
+ * covered by cells on level
+ * <tt>from_level</tt> is smaller
+ * than that of level
+ * <tt>from_level-1</tt> (local
+ * refinement), then some degrees
+ * of freedom in <tt>dst</tt> are
+ * active and will not be
+ * altered. For the other degress
+ * of freedom, the result of the
+ * restriction is added.
*
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the finer level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
+ * @arg src is a vector with as
+ * many elements as there are
+ * degrees of freedom on the
+ * finer level
+ *
+ * @arg dst has as many elements as there
* are degrees of freedom on the coarser
* level.
+ *
*/
virtual void restrict_and_add (const unsigned int from_level,
VECTOR& dst,
#ifndef __deal2__mg_transfer_h
#define __deal2__mg_transfer_h
+#include <base/config.h>
#include <lac/block_vector.h>
#ifdef DEAL_PREFER_MATRIX_EZ
*/
/**
- * Implementation of the @p{MGTransferBase} interface for which the transfer
+ * Implementation of the MGTransferBase interface for which the transfer
* operations are prebuilt upon construction of the object of this class as
* matrices. This is the fast way, since it only needs to build the operation
* once by looping over all cells and storing the result in a matrix for
* each level, but requires additional memory.
*
- * See @ref{MGTransferBase} to find out which of the transfer classes
+ * See MGTransferBase to find out which of the transfer classes
* is best for your needs.
*
- * @author Wolfgang Bangerth, Guido Kanschat, 1999-2003
+ * @author Wolfgang Bangerth, Guido Kanschat, 1999-2004
*/
-template <typename number>
-class MGTransferPrebuilt : public MGTransferBase<Vector<number> >
+template <class VECTOR>
+class MGTransferPrebuilt : public MGTransferBase<VECTOR>
{
public:
/**
template <int dim>
void build_matrices (const MGDoFHandler<dim> &mg_dof);
- /**
- * Prolongate a vector from level
- * @p{to_level-1} to level
- * @p{to_level}. The previous
- * content of @p{dst} is
- * overwritten.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the coarser level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the finer
- * level.
- */
virtual void prolongate (const unsigned int to_level,
- Vector<number> &dst,
- const Vector<number> &src) const;
+ VECTOR &dst,
+ const VECTOR &src) const;
- /**
- * Restrict a vector from level
- * @p{from_level} to level
- * @p{from_level-1} and add this
- * restriction to
- * @p{dst}. Obviously, if the
- * refined region on level
- * @p{from_level} is smaller than
- * that on level @p{from_level-1},
- * some degrees of freedom in
- * @p{dst} are not covered and will
- * not be altered. For the other
- * degress of freedom, the result
- * of the restriction is added.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the finer level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the coarser
- * level.
- */
virtual void restrict_and_add (const unsigned int from_level,
- Vector<number> &dst,
- const Vector<number> &src) const;
+ VECTOR &dst,
+ const VECTOR &src) const;
/**
* Transfer from a vector on the
*/
template <int dim, class InVector>
void
- copy_to_mg (const MGDoFHandler<dim> &mg_dof,
- MGLevelObject<Vector<number> > &dst,
- const InVector &src) const;
+ copy_to_mg (const MGDoFHandler<dim>& mg_dof,
+ MGLevelObject<VECTOR>& dst,
+ const InVector& src) const;
/**
* Transfer from multi-level vector to
void
copy_from_mg (const MGDoFHandler<dim> &mg_dof,
OutVector &dst,
- const MGLevelObject<Vector<number> > &src) const;
+ const MGLevelObject<VECTOR> &src) const;
/**
* Add a multi-level vector to a
void
copy_from_mg_add (const MGDoFHandler<dim> &mg_dof,
OutVector &dst,
- const MGLevelObject<Vector<number> > &src) const;
+ const MGLevelObject<VECTOR> &src) const;
/**
* Finite element does not
/**
* Implementation of the
- * @p{copy_to_mg} function for
+ * copy_to_mg() function for
* 1d. We have to resort to some
* template trickery because we
* can't specialize template
template <int dim, class InVector>
void
copy_to_mg (const MGDoFHandler<dim> &mg_dof,
- MGLevelObject<Vector<number> > &dst,
+ MGLevelObject<VECTOR> &dst,
const InVector &src,
const is_1d<true> &) const;
template <int dim, class InVector>
void
copy_to_mg (const MGDoFHandler<dim> &mg_dof,
- MGLevelObject<Vector<number> > &dst,
+ MGLevelObject<VECTOR> &dst,
const InVector &src,
const is_1d<false> &) const;
};
/**
- * Implementation of matrix generation for @ref{MGTransferBlock} and
- * @p{MGTransferSelect}.
+ * Implementation of matrix generation for MGTransferBlock and
+ * MGTransferSelect.
*
* @author Guido Kanschat, 2001-2003
*/
*
* This function is only called
* by derived classes. These can
- * also set the member variable
- * @p{target_component} for
+ * also set the member variables
+ * #target_component and
+ * #mg_target_component for
* re-ordering and grouping of
* components.
*/
/**
* Flag of selected components.
+ *
+ * The transfer operators only act
+ * on the components having a
+ * <tt>true</tt> entry here. If
+ * renumbering by
+ * #target_component is used,
+ * this refers to the
+ * <b>renumbered</b> components.
*/
std::vector<bool> selected;
+ /**
+ * Flag of selected components.
+ *
+ * The transfer operators only act
+ * on the components having a
+ * <tt>true</tt> entry here. If
+ * renumbering by
+ * #mg_target_component is used,
+ * this refers to the
+ * <b>renumbered</b> components.
+ */
+ std::vector<bool> mg_selected;
+
/**
- * Target component if renumbering is required.
+ * Target component of the
+ * fine-level vector if
+ * renumbering is required.
*/
std::vector<unsigned int> target_component;
std::vector<std::vector<unsigned int> > mg_component_start;
/**
- * Call @p{build_matrices}
+ * Call build_matrices()
* function first.
*/
DeclException0(ExcMatricesNotBuilt);
//TODO:[GK] Update this class
/**
- * Implementation of the @p{MGTransferBase} interface for block
+ * Implementation of the MGTransferBase interface for block
* matrices and block vectors.
*
* Warning! Due to additional requirements on MGTransferSelect, the
/**
* Build the prolongation
* matrices for each level.
- *
- * If a field selected is given,
- * only matrices for these
- * components are to be built. By
- * default, all matrices are
- * built.
- *
- * The last argument
- * @p{target_component} allows
- * grouping of components the
- * same way as in
- * @p{DoFRenumbering::component_wise}.
*
* This function is a front-end
* for the same function in
- * @ref{MGTransferBlockBase}.
+ * MGTransferBlockBase.
+ *
+ * @arg selected: Opional
+ * argument indicating that only
+ * matrices for these components
+ * are to be built. By default,
+ * all matrices are built.
+ *
+ * If <tt>mg_target_component</tt> is
+ * present, this refers to the
+ * renumbered components.
+ *
+ * @arg target_component: this
+ * argument allows grouping and
+ * renumbering of components in
+ * the fine-level vector (see
+ * DoFRenumbering::component_wise).
+ *
+ * @arg mg_target_component: this
+ * argument allows grouping and
+ * renumbering of components in
+ * the level vectors (see
+ * DoFRenumbering::component_wise). It
+ * also affects the behavior of
+ * the <tt>selected</tt> argument
*/
template <int dim>
void build_matrices (const MGDoFHandler<dim> &mg_dof,
const std::vector<unsigned int>& mg_target_component
=std::vector<unsigned int>());
- /**
- * Prolongate a vector from level
- * @p{to_level-1} to level
- * @p{to_level}. The previous
- * content of @p{dst} is
- * overwritten.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the coarser level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the finer
- * level.
- */
virtual void prolongate (const unsigned int to_level,
BlockVector<number> &dst,
const BlockVector<number> &src) const;
- /**
- * Restrict a vector from level
- * @p{from_level} to level
- * @p{from_level-1} and add this
- * restriction to
- * @p{dst}. Obviously, if the
- * refined region on level
- * @p{from_level} is smaller than
- * that on level @p{from_level-1},
- * some degrees of freedom in
- * @p{dst} are not covered and will
- * not be altered. For the other
- * degress of freedom, the result
- * of the restriction is added.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the finer level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the coarser
- * level.
- */
virtual void restrict_and_add (const unsigned int from_level,
BlockVector<number> &dst,
const BlockVector<number> &src) const;
/**
* Transfer from a vector on the
- * global grid to vectors defined
- * on each of the levels
- * separately, i.a. an @p{MGVector}.
+ * global grid to a multilevel
+ * vector.
+ *
+ * The action for discontinuous
+ * elements is as follows: on an
+ * active mesh cell, the global
+ * vector entries are simply
+ * copied to the corresponding
+ * entries of the level
+ * vector. Then, these values are
+ * restricted down to the
+ * coarsest level.
+ *
+ * If the arguments
+ * <tt>target_component</tt> and
+ * <tt>mg_target_component</tt>
+ * was used in build_matrices(),
+ * then the blocks are shuffled
+ * around accordingly.
*/
template <int dim, class InVector>
void
* normal vector.
*
* Copies data from active
- * portions of an MGVector into
- * the respective positions of a
- * @p{Vector<number>}. In order to
- * keep the result consistent,
- * constrained degrees of freedom
- * are set to zero.
+ * portions of a multilevel
+ * vector into the respective
+ * positions of a global vector.
+ *
+ * If the arguments
+ * <tt>target_component</tt> and
+ * <tt>mg_target_component</tt>
+ * was used in build_matrices(),
+ * then the blocks are shuffled
+ * around accordingly.
*/
template <int dim, class OutVector>
void
//TODO:[GK] Update documentation for copy_* functions
/**
- * Implementation of the @p{MGTransferBase} interface for block
- * matrices and simple vectors. This class uses @ref{MGTransferBlockBase}
+ * Implementation of the MGTransferBase interface for block
+ * matrices and simple vectors. This class uses MGTransferBlockBase
* selecting a single component or grouping several components into a
* single block. The transfer operators themselves are implemented for
* Vector and BlockVector objects.
*
- * See @ref{MGTransferBase} to find out which of the transfer classes
+ * See MGTransferBase to find out which of the transfer classes
* is best for your needs.
*
* @author Guido Kanschat, 2001, 2002, 2003
* Actually build the prolongation
* matrices for grouped components.
*
- * @p{selected} tells the copy
- * functions operating on single
- * vectors, which component this
- * vector belongs to.
+ * This function is a front-end
+ * for the same function in
+ * MGTransferBlockBase.
+ *
+ * @arg selected: Number of the
+ * component of the global vector
+ * to be copied from and to the
+ * multilevel vector. This number
+ * refers to the renumbering by
+ * <tt>target_component</tt>.
*
- * @p{mg_selected} is the number
+ * @arg mg_selected: Number
* of the component for which the
* transfer matrices should be
* built.
*
- * The argument
- * @p{target_component}
- * corresponds to the grouping
- * mechanism of
- * @p{DoFRenumbering::component_wise(...)},
- * which should be used to create
- * the corresponding block
- * structure in matrices and
- * vectors.
+ * If <tt>mg_target_component</tt> is
+ * present, this refers to the
+ * renumbered components.
*
- * This function is a front-end
- * for the same function in
- * @ref{MGTransferBlockBase}.
+ * @arg target_component: this
+ * argument allows grouping and
+ * renumbering of components in
+ * the fine-level vector (see
+ * DoFRenumbering::component_wise).
+ *
+ * @arg mg_target_component: this
+ * argument allows grouping and
+ * renumbering of components in
+ * the level vectors (see
+ * DoFRenumbering::component_wise). It
+ * also affects the behavior of
+ * the <tt>selected</tt> argument
*/
template <int dim>
void build_matrices (const MGDoFHandler<dim> &mg_dof,
* Change selected
* component. Handle with care!
*/
- void select (const unsigned int component);
+ void select (const unsigned int component,
+ const unsigned int mg_component = deal_II_numbers::invalid_unsigned_int);
- /**
- * Prolongate a vector from level
- * @p{to_level-1} to level
- * @p{to_level}. The previous
- * content of @p{dst} is
- * overwritten.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the coarser level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the finer
- * level.
- */
virtual void prolongate (const unsigned int to_level,
Vector<number> &dst,
const Vector<number> &src) const;
- /**
- * Restrict a vector from level
- * @p{from_level} to level
- * @p{from_level-1} and add this
- * restriction to
- * @p{dst}. Obviously, if the
- * refined region on level
- * @p{from_level} is smaller than
- * that on level @p{from_level-1},
- * some degrees of freedom in
- * @p{dst} are not covered and will
- * not be altered. For the other
- * degress of freedom, the result
- * of the restriction is added.
- *
- * @p{src} is assumed to be a vector with
- * as many elements as there are degrees
- * of freedom on the finer level of
- * the two involved levels, while @p{src}
- * shall have as many elements as there
- * are degrees of freedom on the coarser
- * level.
- */
virtual void restrict_and_add (const unsigned int from_level,
Vector<number> &dst,
const Vector<number> &src) const;
/**
* Structure that is used to
* disambiguate calls to
- * @p{copy_to_mg} for 1d and
+ * copy_to_mg() for 1d and
* non-1d. We provide two
- * functions of @p{copy_to_mg},
+ * functions of copy_to_mg(),
* where the 1d function takes an
* argument of type
- * @p{is_1d<true>} and the other
- * one of type @p{is_1d<false>}.
+ * <tt>is_1d<true></tt> and the other
+ * one of type <tt>is_1d<false></tt>}.
*/
template <bool> struct is_1d {};
/**
* Transfer from a vector on the
- * global grid to vectors defined
- * on each of the levels
- * separately, i.a. an @p{MGVector}.
+ * global grid to a multilevel vector.
*/
template <int dim, typename number2>
void
const Vector<number2> &src) const;
/**
- * Transfer from multi-level vector to
+ * Transfer from multilevel vector to
* normal vector.
*
* Copies data from active
- * portions of an MGVector into
- * the respective positions of a
- * @p{Vector<number>}. In order to
- * keep the result consistent,
- * constrained degrees of freedom
- * are set to zero.
+ * portions of an multilevel
+ * vector into the respective
+ * positions of a Vector.
*/
template <int dim, typename number2>
void
/**
* Transfer from a vector on the
- * global grid to vectors defined
- * on each of the levels
- * separately, i.a. an @p{MGVector}.
+ * global grid to multilevel vectors.
*/
template <int dim, typename number2>
void
const BlockVector<number2> &src) const;
/**
- * Transfer from multi-level vector to
+ * Transfer from multilevel vector to
* normal vector.
*
* Copies data from active
- * portions of an MGVector into
- * the respective positions of a
- * @p{Vector<number>}. In order to
- * keep the result consistent,
- * constrained degrees of freedom
- * are set to zero.
+ * portions of a multilevel
+ * vector into the respective
+ * positions of a global
+ * BlockVector.
*/
template <int dim, typename number2>
void
private:
/**
- * Transfer from multi-level vector to
- * normal vector.
- *
- * Copies data from active
- * portions of an MGVector into
- * the respective positions of a
- * @p{Vector<number>}. In order to
- * keep the result consistent,
- * constrained degrees of freedom
- * are set to zero.
+ * Implementation of the public
+ * function.
*/
template <int dim, class OutVector>
void
const unsigned int offset) const;
/**
- * Add a multi-level vector to a
- * normal vector.
- *
- * Works as the previous
- * function, but probably not for
- * continuous elements.
+ * Implementation of the public
+ * function.
*/
template <int dim, class OutVector>
void
/**
* Implementation of the
- * @p{copy_to_mg} function for
+ * copy_to_mg() function for
* 1d. We have to resort to some
* template trickery because we
* can't specialize template
const is_1d<true> &) const;
/**
- * Same for all other space
- * dimensions.
+ * Implementation of the
+ * copy_to_mg() function for
+ * higher dimensions.
*/
template <int dim, class InVector>
void
const is_1d<false> &) const;
/**
- * Selected component.
+ * Selected component of global vector.
*/
unsigned int selected_component;
+ /**
+ * Selected component inside multigrid.
+ */
+ unsigned int mg_selected_component;
};
//----------------------------------------------------------------------//
template <typename number>
inline void
-MGTransferSelect<number>::select(const unsigned int component)
+MGTransferSelect<number>::select(const unsigned int component,
+ const unsigned int mg_component)
{
selected_component = component;
+ mg_selected_component = (mg_component == deal_II_numbers::invalid_unsigned_int)
+ ? component
+ : mg_component;
}
-template <typename number>
+template <class VECTOR>
template <int dim, class InVector>
void
-MGTransferPrebuilt<number>::copy_to_mg (
+MGTransferPrebuilt<VECTOR>::copy_to_mg (
const MGDoFHandler<dim> &mg_dof_handler,
- MGLevelObject<Vector<number> > &dst,
+ MGLevelObject<VECTOR> &dst,
const InVector &src) const
{
// forward to the correct
}
-template <typename number>
+template <class VECTOR>
template <int dim, class InVector>
void
-MGTransferPrebuilt<number>::copy_to_mg (
+MGTransferPrebuilt<VECTOR>::copy_to_mg (
const MGDoFHandler<dim> &,
- MGLevelObject<Vector<number> > &,
+ MGLevelObject<VECTOR> &,
const InVector &,
const is_1d<true> &) const
{
}
-template <typename number>
+template <class VECTOR>
template <int dim, class InVector>
void
-MGTransferPrebuilt<number>::copy_to_mg (
- const MGDoFHandler<dim> &mg_dof_handler,
- MGLevelObject<Vector<number> > &dst,
- const InVector &src,
- const is_1d<false> &) const
+MGTransferPrebuilt<VECTOR>::copy_to_mg (
+ const MGDoFHandler<dim>& mg_dof_handler,
+ MGLevelObject<VECTOR>& dst,
+ const InVector& src,
+ const is_1d<false>&) const
{
// Make src a real finite element function
// InVector src = osrc;
Assert(sizes.size()==mg_dof_handler.get_tria().n_levels(),
ExcMatricesNotBuilt());
- for (unsigned int l=minlevel;l<=maxlevel;++l)
- dst[l].reinit(sizes[l]);
+// for (unsigned int l=minlevel;l<=maxlevel;++l)
+// dst[l].reinit(sizes[l]);
std::vector<unsigned int> global_dof_indices (dofs_per_cell);
std::vector<unsigned int> level_dof_indices (dofs_per_cell);
-template <typename number>
+template <class VECTOR>
template <int dim, class OutVector>
void
-MGTransferPrebuilt<number>::copy_from_mg(
- const MGDoFHandler<dim> &mg_dof_handler,
- OutVector &dst,
- const MGLevelObject<Vector<number> > &src) const
+MGTransferPrebuilt<VECTOR>::copy_from_mg(
+ const MGDoFHandler<dim>& mg_dof_handler,
+ OutVector& dst,
+ const MGLevelObject<VECTOR>& src) const
{
const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
-template <typename number>
+template <class VECTOR>
template <int dim, class OutVector>
void
-MGTransferPrebuilt<number>::copy_from_mg_add (
+MGTransferPrebuilt<VECTOR>::copy_from_mg_add (
const MGDoFHandler<dim> &mg_dof_handler,
OutVector &dst,
- const MGLevelObject<Vector<number> > &src) const
+ const MGLevelObject<VECTOR> &src) const
{
const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
}
-template <typename number>
+template <class VECTOR>
unsigned int
-MGTransferPrebuilt<number>::memory_consumption () const
+MGTransferPrebuilt<VECTOR>::memory_consumption () const
{
unsigned int result = sizeof(*this);
result += sizeof(unsigned int) * sizes.size();
{
// forward to the correct
// specialization
- do_copy_to_mg (mg_dof_handler, dst, src, 0, is_1d<(dim==1)>());
+ do_copy_to_mg (mg_dof_handler, dst, src,
+ 0, //component_start[selected_component],
+ is_1d<(dim==1)>());
}
Assert(sizes.size()==mg_dof_handler.get_tria().n_levels(),
ExcMatricesNotBuilt());
- MGTools::reinit_vector(mg_dof_handler, dst, selected, mg_target_component);
+ MGTools::reinit_vector(mg_dof_handler, dst,
+ mg_selected, mg_target_component);
std::vector<unsigned int> global_dof_indices (dofs_per_cell);
std::vector<unsigned int> level_dof_indices (dofs_per_cell);
{
const unsigned int component
= mg_target_component[fe.system_to_component_index(i).first];
- if (selected[component])
+ if (mg_selected[component])
{
const unsigned int level_start
= mg_component_start[level][component];
}
}
- for (unsigned int face_n=0; face_n<GeometryInfo<dim>::faces_per_cell; ++face_n)
- {
- const typename MGDoFHandler<dim>::face_iterator
- face = level_cell->face(face_n);
- if (face->has_children())
- {
- face->get_mg_dof_indices(level_face_indices);
+// for (unsigned int face_n=0; face_n<GeometryInfo<dim>::faces_per_cell; ++face_n)
+// {
+// const typename MGDoFHandler<dim>::face_iterator
+// face = level_cell->face(face_n);
+// if (face->has_children())
+// {
+// face->get_mg_dof_indices(level_face_indices);
// Delete values on refinement edge,
// for (unsigned int i=0; i<dofs_per_face; ++i)
// dst[level](level_face_indices[i])
// = 0.;
- };
- };
- };
+// };
+// };
+ }
// for that part of the level
// which is further refined:
// get the defect by
{
const unsigned int component
= mg_target_component[fe.system_to_component_index(i).first];
- if (selected[component])
+ if (mg_selected[component])
{
const unsigned int level_start
= mg_component_start[level][component];
{
const unsigned int component
= mg_target_component[fe.system_to_component_index(i).first];
- if (selected[component])
+ if (mg_selected[component])
{
const unsigned int level_start
= mg_component_start[level][component];
dst.clear();
- MGTools::reinit_vector(mg_dof_handler, dst, selected, mg_target_component);
+ MGTools::reinit_vector(mg_dof_handler, dst, mg_selected, mg_target_component);
std::vector<unsigned int> global_dof_indices (dofs_per_cell);
std::vector<unsigned int> level_dof_indices (dofs_per_cell);
* Implementation of the multigrid method.
*
* Warning: multigrid on locally refined meshes only works with
- * discontinuous finite elements.
+ * <b>discontinuous finite elements</b> right now. It is not clear,
+ * whether the paradigm of local smoothing we use is applicable to
+ * continuous elements with hanging nodes; in fact, most people you
+ * meet on conferences seem to deny this.
*
* The function actually performing a multi-level cycle,
* @p{level_mgstep}, as well as the function @p{vcycle}, calling it,
{
mg_target_component.resize(mg_dof.get_fe().n_components());
for (unsigned int i=0;i<mg_target_component.size();++i)
- mg_target_component[i] = i;
+ mg_target_component[i] = target_component[i];
} else {
Assert (mg_target_component.size() == mg_dof.get_fe().n_components(),
ExcDimensionMismatch(mg_target_component.size(),
// Selected refers to the component
// in mg_target_component.
- selected = select;
+ mg_selected = select;
- Assert (selected.size() == fe.n_components(),
- ExcDimensionMismatch(selected.size(), fe.n_components()));
+ Assert (mg_selected.size() == fe.n_components(),
+ ExcDimensionMismatch(mg_selected.size(), fe.n_components()));
// Compute the lengths of all blocks
sizes.resize(n_levels);
= fe.system_to_component_index(i).first;
const unsigned int jcomp
= fe.system_to_component_index(j).first;
- if ((icomp==jcomp) && selected[mg_target_component[icomp]])
+ if ((icomp==jcomp) && mg_selected[mg_target_component[icomp]])
prolongation_sparsities[level]->add(dof_indices_child[i],
dof_indices_parent[j]);
};
{
const unsigned int icomp = fe.system_to_component_index(i).first;
const unsigned int jcomp = fe.system_to_component_index(j).first;
- if ((icomp==jcomp) && selected[mg_target_component[icomp]])
+ if ((icomp==jcomp) && mg_selected[mg_target_component[icomp]])
prolongation_matrices[level]->set(dof_indices_child[i],
dof_indices_parent[j],
prolongation(i,j));
{
unsigned int ncomp = mg_dof.get_fe().n_components();
- selected_component = select;
- std::vector<bool> s(ncomp, false);
- s[mg_select] = true;
-//TODO:[GK] Assert that select and mg_select access the same component
-// or figure out how to use different components
target_component = t_component;
mg_target_component = mg_t_component;
+ selected_component = select;
+ mg_selected_component = mg_select;
+ selected.resize(ncomp, false);
+ selected[select] = true;
+ // If components are renumbered,
+ // find the first original
+ // component corresponding to the
+ // target component.
+ for (unsigned int i=0;i<target_component.size();++i)
+ {
+ if (target_component[i] == select)
+ {
+ selected_component = i;
+ break;
+ }
+ }
+
+ std::vector<bool> s(ncomp, false);
+ s[mg_select] = true;
+
MGTransferBlockBase::build_matrices (mg_dof, s);
}
template
-void MGTransferPrebuilt<float>::build_matrices<deal_II_dimension>
+void MGTransferPrebuilt<Vector<float> >::build_matrices<deal_II_dimension>
(const MGDoFHandler<deal_II_dimension> &mg_dof);
template
-void MGTransferPrebuilt<double>::build_matrices<deal_II_dimension>
+void MGTransferPrebuilt<Vector<double> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template
+void MGTransferPrebuilt<BlockVector<float> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template
+void MGTransferPrebuilt<BlockVector<double> >::build_matrices<deal_II_dimension>
(const MGDoFHandler<deal_II_dimension> &mg_dof);
template void
-MGTransferPrebuilt<float>::copy_to_mg (
+MGTransferPrebuilt<Vector<float> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<Vector<float> >&,
const Vector<double>&) const;
template void
-MGTransferPrebuilt<float>::copy_to_mg (
+MGTransferPrebuilt<Vector<float> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<Vector<float> >&,
const BlockVector<double>&) const;
template void
-MGTransferPrebuilt<float>::copy_to_mg (
+MGTransferPrebuilt<Vector<float> >::copy_from_mg (
const MGDoFHandler<deal_II_dimension>&,
- MGLevelObject<Vector<float> >&,
- const Vector<float>&) const;
+ Vector<double>&,
+ const MGLevelObject<Vector<float> >&) const;
template void
-MGTransferPrebuilt<float>::copy_to_mg (
+MGTransferPrebuilt<Vector<float> >::copy_from_mg (
const MGDoFHandler<deal_II_dimension>&,
- MGLevelObject<Vector<float> >&,
- const BlockVector<float>&) const;
+ BlockVector<double>&,
+ const MGLevelObject<Vector<float> >&) const;
template void
-MGTransferPrebuilt<float>::copy_from_mg (
+MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
const MGDoFHandler<deal_II_dimension>&,
Vector<double>&,
const MGLevelObject<Vector<float> >&) const;
template void
-MGTransferPrebuilt<float>::copy_from_mg (
+MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
const MGDoFHandler<deal_II_dimension>&,
BlockVector<double>&,
const MGLevelObject<Vector<float> >&) const;
+
template void
-MGTransferPrebuilt<float>::copy_from_mg (
+MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
- Vector<float>&,
- const MGLevelObject<Vector<float> >&) const;
+ MGLevelObject<BlockVector<float> >&,
+ const Vector<double>&) const;
template void
-MGTransferPrebuilt<float>::copy_from_mg (
+MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
- BlockVector<float>&,
- const MGLevelObject<Vector<float> >&) const;
+ MGLevelObject<BlockVector<float> >&,
+ const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ Vector<double>&,
+ const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ BlockVector<double>&,
+ const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
+ const MGDoFHandler<deal_II_dimension>&,
+ Vector<double>&,
+ const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
+ const MGDoFHandler<deal_II_dimension>&,
+ BlockVector<double>&,
+ const MGLevelObject<BlockVector<float> >&) const;
template void
-MGTransferPrebuilt<double>::copy_to_mg (
+MGTransferPrebuilt<Vector<double> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<Vector<double> >&,
const Vector<double>&) const;
template void
-MGTransferPrebuilt<double>::copy_to_mg (
+MGTransferPrebuilt<Vector<double> >::copy_to_mg (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<Vector<double> >&,
const BlockVector<double>&) const;
template void
-MGTransferPrebuilt<double>::copy_from_mg (
+MGTransferPrebuilt<Vector<double> >::copy_from_mg (
const MGDoFHandler<deal_II_dimension>&,
Vector<double>&,
const MGLevelObject<Vector<double> >&) const;
template void
-MGTransferPrebuilt<double>::copy_from_mg (
+MGTransferPrebuilt<Vector<double> >::copy_from_mg (
const MGDoFHandler<deal_II_dimension>&,
BlockVector<double>&,
const MGLevelObject<Vector<double> >&) const;
-
template void
-MGTransferPrebuilt<double>::copy_from_mg_add (
+MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
const MGDoFHandler<deal_II_dimension>&,
Vector<double>&,
const MGLevelObject<Vector<double> >&) const;
template void
-MGTransferPrebuilt<double>::copy_from_mg_add (
+MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
const MGDoFHandler<deal_II_dimension>&,
BlockVector<double>&,
const MGLevelObject<Vector<double> >&) const;
+
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ MGLevelObject<BlockVector<double> >&,
+ const Vector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ MGLevelObject<BlockVector<double> >&,
+ const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ Vector<double>&,
+ const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
+ const MGDoFHandler<deal_II_dimension>&,
+ BlockVector<double>&,
+ const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
+ const MGDoFHandler<deal_II_dimension>&,
+ Vector<double>&,
+ const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
+ const MGDoFHandler<deal_II_dimension>&,
+ BlockVector<double>&,
+ const MGLevelObject<BlockVector<double> >&) const;
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
-template <typename number>
-MGTransferPrebuilt<number>::~MGTransferPrebuilt ()
+template <class VECTOR>
+MGTransferPrebuilt<VECTOR>::~MGTransferPrebuilt ()
{}
-template <typename number>
-void MGTransferPrebuilt<number>::prolongate (
- const unsigned int to_level,
- Vector<number> &dst,
- const Vector<number> &src) const
+template <class VECTOR>
+void MGTransferPrebuilt<VECTOR>::prolongate (
+ const unsigned int to_level,
+ VECTOR& dst,
+ const VECTOR& src) const
{
Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
}
-template <typename number>
-void MGTransferPrebuilt<number>::restrict_and_add (
+template <class VECTOR>
+void MGTransferPrebuilt<VECTOR>::restrict_and_add (
const unsigned int from_level,
- Vector<number> &dst,
- const Vector<number> &src) const
+ VECTOR &dst,
+ const VECTOR &src) const
{
Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
- prolongation_matrices[to_level-1]->block(selected_component,
- selected_component)
+ prolongation_matrices[to_level-1]->block(mg_selected_component,
+ mg_selected_component)
.vmult (dst, src);
}
Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
- prolongation_matrices[from_level-1]->block(selected_component,
- selected_component)
+ prolongation_matrices[from_level-1]->block(mg_selected_component,
+ mg_selected_component)
.Tvmult_add (dst, src);
}
template class Multigrid<BlockVector<float> >;
template class Multigrid<BlockVector<double> >;
-template class MGTransferPrebuilt<float>;
-template class MGTransferPrebuilt<double>;
+template class MGTransferPrebuilt<Vector<float> >;
+template class MGTransferPrebuilt<BlockVector<float> >;
+template class MGTransferPrebuilt<Vector<double> >;
+template class MGTransferPrebuilt<BlockVector<double> >;
template class MGTransferBlock<float>;
template class MGTransferBlock<double>;
template class MGTransferSelect<float>;
// transfer.cc,v 1.4 2003/04/09 15:49:55 wolf Exp
// Version:
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
MGDoFHandler<dim> dof(tr);
dof.distribute_dofs(finel);
- MGTransferPrebuilt<double> transfer;
+ MGTransferPrebuilt<Vector<double> > transfer;
transfer.build_matrices(dof);
unsigned int n_coarse = dof.n_dofs(level-1);
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <iomanip>
#include <algorithm>
+using namespace std;
template <int dim>
void check_simple(const FiniteElement<dim>& fe)
MGDoFHandler<dim> mgdof(tr);
mgdof.distribute_dofs(fe);
- MGTransferPrebuilt<double> transfer;
+ MGTransferPrebuilt<Vector<double> > transfer;
transfer.build_matrices(mgdof);
Vector<double> u2(mgdof.n_dofs(2));
template <int dim>
void check_select(const FiniteElement<dim>& fe,
unsigned int selected,
+ unsigned int mg_selected,
std::vector<unsigned int> target_component,
std::vector<unsigned int> mg_target_component)
+{
+ deallog << fe.get_name()
+ << " select " << selected
+ << " (global) and " << mg_selected
+ << " (mg)" << std::endl;
+
+ Triangulation<dim> tr;
+ GridGenerator::hyper_cube(tr);
+ tr.refine_global(2);
+
+ MGDoFHandler<dim> mgdof(tr);
+ mgdof.distribute_dofs(fe);
+ DoFRenumbering::component_wise(mgdof, target_component);
+ vector<unsigned int> ndofs(fe.n_components());
+ DoFTools::count_dofs_per_component(mgdof, ndofs, target_component);
+
+ for (unsigned int l=0;l<tr.n_levels();++l)
+ DoFRenumbering::component_wise(mgdof, l, mg_target_component);
+ std::vector<std::vector<unsigned int> > mg_ndofs(mgdof.get_tria().n_levels()); MGTools::count_dofs_per_component(mgdof, mg_ndofs, mg_target_component);
+
+ deallog << "Global dofs:";
+ for (unsigned int i=0;i<ndofs.size();++i)
+ deallog << ' ' << ndofs[i];
+ deallog << std::endl;
+ for (unsigned int l=0;l<mg_ndofs.size();++l)
+ {
+ deallog << "Level " << l << " dofs:";
+ for (unsigned int i=0;i<mg_ndofs[l].size();++i)
+ deallog << ' ' << mg_ndofs[l][i];
+ deallog << std::endl;
+ }
+
+
+ MGTransferSelect<double> transfer;
+ transfer.build_matrices(mgdof, selected, mg_selected,
+ target_component, mg_target_component);
+
+ Vector<double> u2(mg_ndofs[2][mg_selected]);
+ Vector<double> u1(mg_ndofs[1][mg_selected]);
+ Vector<double> u0(mg_ndofs[0][mg_selected]);
+
+ u0 = 1;
+ transfer.prolongate(1,u1,u0);
+ transfer.prolongate(2,u2,u1);
+ deallog << "u0 " << u0*u0
+ << "\tu1 " << u1*u1
+ << "\tu2 " << u2*u2;
+ u1 = 0.;
+ u0 = 0.;
+ transfer.restrict_and_add(2,u1,u2);
+ transfer.restrict_and_add(1,u0,u1);
+ deallog << "\tu1 " << u1*u1
+ << "\tu0 " << u0*u0
+ << std::endl;
+
+ // Check copy to mg and back
+ BlockVector<double> u;
+ u.reinit (ndofs);
+ for (unsigned int i=0;i<u.size();++i)
+ u(i) = i;
+
+ MGLevelObject<Vector<double> > v;
+ v.resize(2,2);
+ v[2].reinit(mg_ndofs[2][mg_selected]);
+
+ transfer.copy_to_mg(mgdof, v, u);
+ for (unsigned int i=0; i<v[2].size();++i)
+ deallog << ' ' << (int) v[2](i);
+ deallog << std::endl;
+}
+
+template <int dim>
+void check_block(const FiniteElement<dim>& fe,
+ const vector<bool>& selected,
+ const vector<bool>& mg_selected,
+ std::vector<unsigned int> target_component,
+ std::vector<unsigned int> mg_target_component)
{
deallog << fe.get_name() << std::endl;
}
- MGTransferSelect<double> transfer;
- transfer.build_matrices(mgdof, selected, selected,
+ MGTransferBlock<double> transfer;
+ transfer.build_matrices(mgdof, selected, mg_selected,
target_component, mg_target_component);
- Vector<double> u2(mg_ndofs[2][0]);
- Vector<double> u1(mg_ndofs[1][0]);
- Vector<double> u0(mg_ndofs[0][0]);
+ BlockVector<double> u2(mg_ndofs[2]);
+ BlockVector<double> u1(mg_ndofs[1]);
+ BlockVector<double> u0(mg_ndofs[0]);
u0 = 1;
transfer.prolongate(1,u1,u0);
transfer.prolongate(2,u2,u1);
- deallog << "u0 " << u0.l2_norm()
- << "\tu1 " << u1.l2_norm()
- << "\tu2 " << u2.l2_norm();
+ deallog << "u0 " << u0*u0
+ << "\tu1 " << u1*u1
+ << "\tu2 " << u2*u2;
u1 = 0.;
u0 = 0.;
transfer.restrict_and_add(2,u1,u2);
transfer.restrict_and_add(1,u0,u1);
- deallog << "\tu1 " << u1.l2_norm()
- << "\tu0 " << u0.l2_norm()
+ deallog << "\tu1 " << u1*u1
+ << "\tu0 " << u0*u0
<< std::endl;
// Check copy to mg and back
MGLevelObject<Vector<double> > v;
v.resize(2,2);
- v[2].reinit(mg_ndofs[2][selected]);
+ v[2].reinit(mg_ndofs[2][mg_selected]);
transfer.copy_to_mg(mgdof, v, u);
for (unsigned int i=0; i<v[2].size();++i)
std::ofstream logfile("transfer.output");
logfile.precision(3);
deallog.attach(logfile);
- deallog.depth_console(0);
+ deallog.depth_console(10);
// check_simple (FE_DGP<2>(0));
// check_simple (FE_DGP<2>(1));
// check_simple (FE_Q<2>(1));
// check_simple (FE_Q<2>(2));
+ std::cerr << "Select" << std::endl;
+
std::vector<unsigned int> v1(4);
std::vector<unsigned int> v2(4);
std::vector<unsigned int> v3(4);
{
v1[i] = i;
v2[i] = 0;
- v3[i] = i/2;
+ v3[i] = i;
}
-
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 0, v1, v1);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 1, v1, v1);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 0, v2, v2);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 0, v3, v3);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 1, v3, v3);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 0, v1, v3);
- check_select (FESystem<2>(FE_DGQ<2>(1), 4), 1, v1, v3);
-}
+ v3[0] = 0;
+ v3[1] = 1;
+ v3[2] = 1;
+ v3[3] = 2;
+ FESystem<2> fe1(FE_DGQ<2>(1), 4);
+
+ check_select (fe1, 0, 0, v1, v1);
+ check_select (fe1, 1, 1, v1, v1);
+ check_select (fe1, 1, 2, v1, v1);
+ check_select (fe1, 2, 1, v1, v1);
+ check_select (fe1, 0, 0, v2, v2);
+ check_select (fe1, 0, 0, v3, v3);
+ check_select (fe1, 1, 1, v3, v3);
+ check_select (fe1, 0, 0, v1, v3);
+ check_select (fe1, 1, 1, v1, v3);
+ check_select (fe1, 2, 1, v1, v3);
+ check_select (fe1, 0, 1, v1, v3);
+ check_select (fe1, 0, 0, v1, v2);
+// vector<bool> s1(4, true);
+// check_block(fe1, s1, s1, v1, v1);
+}