* access to the DoF data.
*/
TriaIterator<dim,DoFObjectAccessor<celldim, DH> > child (const unsigned int) const;
-
- /**
- * Distribute a local (cell
- * based) vector to a global one
- * by mapping the local numbering
- * of the degrees of freedom to
- * the global one and entering
- * the local values into the
- * global vector.
- *
- * The elements are
- * <em>added</em> up to the
- * elements in the global vector,
- * rather than just set, since
- * this is usually what one
- * wants.
- */
- template <typename number, typename OutputVector>
- void
- distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const;
-
- /**
- * This function does much the same as
- * the
- * <tt>distribute_local_to_global(Vector,Vector)</tt>
- * function, but operates on matrices
- * instead of vectors. The sparse matrix
- * is supposed to have non-zero entry
- * slots where required.
- */
- template <typename number, typename OutputMatrix>
- void
- distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const;
/**
* Implement the copy operator needed
* access to the DoF data.
*/
TriaIterator<DH::dimension,DoFObjectAccessor<1,DH> > child (const unsigned int) const;
-
- /**
- * Distribute a local (cell based) vector
- * to a global one by mapping the local
- * numbering of the degrees of freedom to
- * the global one and entering the local
- * values into the global vector.
- *
- * The elements are
- * <em>added</em> up to the
- * elements in the global vector,
- * rather than just set, since
- * this is usually what one
- * wants.
- */
- template <typename number, typename OutputVector>
- void
- distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const;
-
- /**
- * This function does much the same as
- * the
- * <tt>distribute_local_to_global(Vector,Vector)</tt>
- * function, but operates on matrices
- * instead of vectors. The sparse matrix
- * is supposed to have non-zero entry
- * slots where required.
- */
- template <typename number, typename OutputMatrix>
- void
- distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const;
/**
* Implement the copy operator needed
*/
TriaIterator<DH::dimension,DoFObjectAccessor<2, DH> >
child (const unsigned int) const;
-
- /**
- * Distribute a local (cell based) vector
- * to a global one by mapping the local
- * numbering of the degrees of freedom to
- * the global one and entering the local
- * values into the global vector.
- *
- * The elements are
- * <em>added</em> up to the
- * elements in the global vector,
- * rather than just set, since
- * this is usually what one
- * wants.
- */
- template <typename number, typename OutputVector>
- void
- distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const;
-
- /**
- * This function does much the same as
- * the
- * <tt>distribute_local_to_global(Vector,Vector)</tt>
- * function, but operates on matrices
- * instead of vectors. The sparse matrix
- * is supposed to have non-zero entry
- * slots where required.
- */
- template <typename number, typename OutputMatrix>
- void
- distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const;
/**
* Implement the copy operator needed
* access to the DoF data.
*/
TriaIterator<DH::dimension,DoFObjectAccessor<3, DH> > child (const unsigned int) const;
-
- /**
- * Distribute a local (cell
- * based) vector to a global one
- * by mapping the local numbering
- * of the degrees of freedom to
- * the global one and entering
- * the local values into the
- * global vector.
- *
- * The elements are
- * <em>added</em> up to the
- * elements in the global vector,
- * rather than just set, since
- * this is usually what one
- * wants.
- */
- template <typename number, typename OutputVector>
- void
- distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const;
-
- /**
- * This function does much the same as
- * the
- * <tt>distribute_local_to_global(Vector,Vector)</tt>
- * function, but operates on matrices
- * instead of vectors. The sparse matrix
- * is supposed to have non-zero entry
- * slots where required.
- */
- template <typename number, typename OutputMatrix>
- void
- distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const;
/**
* Implement the copy operator needed
* with them at all.
*/
void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
+
+ /**
+ * Distribute a local (cell
+ * based) vector to a global one
+ * by mapping the local numbering
+ * of the degrees of freedom to
+ * the global one and entering
+ * the local values into the
+ * global vector.
+ *
+ * The elements are
+ * <em>added</em> up to the
+ * elements in the global vector,
+ * rather than just set, since
+ * this is usually what one
+ * wants.
+ */
+ template <typename number, typename OutputVector>
+ void
+ distribute_local_to_global (const Vector<number> &local_source,
+ OutputVector &global_destination) const;
+
+ /**
+ * This function does much the
+ * same as the
+ * <tt>distribute_local_to_global(Vector,Vector)</tt>
+ * function, but operates on
+ * matrices instead of
+ * vectors. If the matrix type is
+ * a sparse matrix then it is
+ * supposed to have non-zero
+ * entry slots where required.
+ */
+ template <typename number, typename OutputMatrix>
+ void
+ distribute_local_to_global (const FullMatrix<number> &local_source,
+ OutputMatrix &global_destination) const;
private:
/**
-template <class DH>
-template <typename number, typename OutputVector>
-inline
-void
-DoFObjectAccessor<1,DH>::
-distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.size() == (2*this->get_fe().dofs_per_vertex +
- this->get_fe().dofs_per_line),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.size(),
- typename BaseClass::ExcVectorDoesNotMatch());
-
- const unsigned int n_dofs = local_source.size();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell vector
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination(dofs[j]) += local_source(j);
-}
-
-
-
-template <class DH>
-template <typename number, typename OutputMatrix>
-inline
-void
-DoFObjectAccessor<1,DH>::
-distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.m() == (2*this->get_fe().dofs_per_vertex +
- this->get_fe().dofs_per_line),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (local_source.m() == local_source.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.m(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (global_destination.m() == global_destination.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
-
- const unsigned int n_dofs = local_source.m();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell matrix
- for (unsigned int i=0; i<n_dofs; ++i)
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination.add(dofs[i], dofs[j], local_source(i,j));
-}
-
-
-
template <class DH>
inline
void
-template <class DH>
-template <typename number, typename OutputVector>
-inline
-void
-DoFObjectAccessor<2,DH>::
-distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.size() == (4*this->dof_handler->get_fe().dofs_per_vertex +
- 4*this->dof_handler->get_fe().dofs_per_line +
- this->dof_handler->get_fe().dofs_per_quad),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.size(),
- typename BaseClass::ExcVectorDoesNotMatch());
-
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("DoFHandler not initialized"));
-
- const unsigned int n_dofs = local_source.size();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell vector
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination(dofs[j]) += local_source(j);
-}
-
-
-
-template <class DH>
-template <typename number, typename OutputMatrix>
-inline
-void
-DoFObjectAccessor<2,DH>::
-distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.m() == (4*this->dof_handler->get_fe().dofs_per_vertex +
- 4*this->dof_handler->get_fe().dofs_per_line +
- this->dof_handler->get_fe().dofs_per_quad),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (local_source.m() == local_source.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.m(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (global_destination.m() == global_destination.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("DoFHandler not initialized"));
-
- const unsigned int n_dofs = local_source.m();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell matrix
- for (unsigned int i=0; i<n_dofs; ++i)
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination.add(dofs[i], dofs[j], local_source(i,j));
-}
-
-
-
template <class DH>
inline
void
-template <class DH>
-template <typename number, typename OutputVector>
-inline
-void
-DoFObjectAccessor<3,DH>::
-distribute_local_to_global (const Vector<number> &local_source,
- OutputVector &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.size() == (8*this->get_fe().dofs_per_vertex +
- 12*this->get_fe().dofs_per_line +
- 6*this->get_fe().dofs_per_quad +
- this->get_fe().dofs_per_hex),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.size(),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("DoFHandler not initialized"));
-
- const unsigned int n_dofs = local_source.size();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell vector
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination(dofs[j]) += local_source(j);
-}
-
-
-
-template <class DH>
-template <typename number, typename OutputMatrix>
-inline
-void
-DoFObjectAccessor<3,DH>::
-distribute_local_to_global (const FullMatrix<number> &local_source,
- OutputMatrix &global_destination) const
-{
- // since the exception classes are
- // from a template dependent base
- // class, we have to fully qualify
- // them. to work around more
- // trouble, typedef the template
- // dependent base class to a
- // non-template dependent name and
- // use that to specify the
- // qualified exception names
- typedef DoFAccessor<DH> BaseClass;
-
- Assert (this->dof_handler != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (&this->get_fe() != 0,
- typename BaseClass::ExcInvalidObject());
- Assert (local_source.m() == (8*this->get_fe().dofs_per_vertex +
- 12*this->get_fe().dofs_per_line +
- 6*this->get_fe().dofs_per_quad +
- this->get_fe().dofs_per_hex),
- typename BaseClass::ExcVectorDoesNotMatch());
- Assert (local_source.m() == local_source.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (this->dof_handler->n_dofs() == global_destination.m(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (global_destination.m() == global_destination.n(),
- typename BaseClass::ExcMatrixDoesNotMatch());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
- ExcMessage ("DoFHandler not initialized"));
-
- const unsigned int n_dofs = local_source.m();
-
-//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
-
- // get indices of dofs
- std::vector<unsigned int> dofs (n_dofs);
- get_dof_indices (dofs);
-
- // distribute cell matrix
- for (unsigned int i=0; i<n_dofs; ++i)
- for (unsigned int j=0; j<n_dofs; ++j)
- global_destination.add(dofs[i], dofs[j], local_source(i,j));
-}
-
-
-
template <class DH>
void DoFObjectAccessor<3,DH>::copy_from (const DoFObjectAccessor<3,DH> &a)
{
}
+
+template <class DH>
+template <typename number, typename OutputVector>
+inline
+void
+DoFCellAccessor<DH>::
+distribute_local_to_global (const Vector<number> &local_source,
+ OutputVector &global_destination) const
+{
+ // since the exception classes are
+ // from a template dependent base
+ // class, we have to fully qualify
+ // them. to work around more
+ // trouble, typedef the template
+ // dependent base class to a
+ // non-template dependent name and
+ // use that to specify the
+ // qualified exception names
+ typedef DoFAccessor<DH> BaseClass;
+
+ Assert (this->dof_handler != 0,
+ typename BaseClass::ExcInvalidObject());
+ Assert (&this->get_fe() != 0,
+ typename BaseClass::ExcInvalidObject());
+ Assert (local_source.size() == (2*this->get_fe().dofs_per_vertex +
+ this->get_fe().dofs_per_line),
+ typename BaseClass::ExcVectorDoesNotMatch());
+ Assert (this->dof_handler->n_dofs() == global_destination.size(),
+ typename BaseClass::ExcVectorDoesNotMatch());
+
+ const unsigned int n_dofs = local_source.size();
+
+//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
+
+ // get indices of dofs
+ std::vector<unsigned int> dofs (n_dofs);
+ this->get_dof_indices (dofs);
+
+ // distribute cell vector
+ for (unsigned int j=0; j<n_dofs; ++j)
+ global_destination(dofs[j]) += local_source(j);
+}
+
+
+
+template <class DH>
+template <typename number, typename OutputMatrix>
+inline
+void
+DoFCellAccessor<DH>::
+distribute_local_to_global (const FullMatrix<number> &local_source,
+ OutputMatrix &global_destination) const
+{
+ // since the exception classes are
+ // from a template dependent base
+ // class, we have to fully qualify
+ // them. to work around more
+ // trouble, typedef the template
+ // dependent base class to a
+ // non-template dependent name and
+ // use that to specify the
+ // qualified exception names
+ typedef DoFAccessor<DH> BaseClass;
+
+ Assert (this->dof_handler != 0,
+ typename BaseClass::ExcInvalidObject());
+ Assert (&this->get_fe() != 0,
+ typename BaseClass::ExcInvalidObject());
+ Assert (local_source.m() == (2*this->get_fe().dofs_per_vertex +
+ this->get_fe().dofs_per_line),
+ typename BaseClass::ExcVectorDoesNotMatch());
+ Assert (local_source.m() == local_source.n(),
+ typename BaseClass::ExcMatrixDoesNotMatch());
+ Assert (this->dof_handler->n_dofs() == global_destination.m(),
+ typename BaseClass::ExcMatrixDoesNotMatch());
+ Assert (global_destination.m() == global_destination.n(),
+ typename BaseClass::ExcMatrixDoesNotMatch());
+
+ const unsigned int n_dofs = local_source.m();
+
+//TODO[WB]: This function could me made more efficient. First, it allocates memory, which could be avoided by passing in another argument as a scratch array. second, the elementwise access is really slow if we use PETSc vectors/matrices. This should be fixed eventually
+
+ // get indices of dofs
+ std::vector<unsigned int> dofs (n_dofs);
+ this->get_dof_indices (dofs);
+
+ // distribute cell matrix
+ for (unsigned int i=0; i<n_dofs; ++i)
+ for (unsigned int j=0; j<n_dofs; ++j)
+ global_destination.add(dofs[i], dofs[j], local_source(i,j));
+}
+
+
+
#endif