* class to see which characters
* are valid and which are not.
*/
- template <class VECTOR>
+ template <class VECTOR>
void add_data_vector (const VECTOR &data,
const std::vector<std::string> &names,
const DataVectorType type = type_automatic);
* underscore and the number of
* each component to @p{name}
*/
- template <class VECTOR>
+ template <class VECTOR>
void add_data_vector (const VECTOR &data,
const std::string &name,
const DataVectorType type = type_automatic);
*/
void clear_input_data_references ();
+ /**
+ * This function can be used to
+ * merge the patches that were
+ * created using the
+ * @p{build_patches} function of
+ * the object given as argument
+ * into the list of patches
+ * created by this object. This
+ * is sometimes handy if one has,
+ * for example, a domain
+ * decomposition algorithm where
+ * each block is represented by a
+ * @ref{DoFHandler} of its own,
+ * but one wants to output the
+ * solution on all the blocks at
+ * the same time.
+ *
+ * For this to work, the given
+ * argument and this object need
+ * to have the same number of
+ * output vectors, and they need
+ * to use the same number of
+ * subdivisions per patch. The
+ * output will probably look
+ * rather funny if patches in
+ * both objects overlap in space.
+ *
+ * If you call
+ * @ref{build_patches} for this
+ * object after merging in
+ * patches, the previous state is
+ * overwritten, and the merged-in
+ * patches are lost.
+ *
+ * This function will fail if
+ * either this or the other
+ * object did not yet set up any
+ * patches.
+ */
+ void merge_patches (const DataOut_DoFData &source);
+
/**
* Release the pointers to the
* data vectors and the DoF
<< "You have to give one name per component in your "
<< "data vector. The number you gave was " << arg1
<< ", but the number of components is " << arg2);
-
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNoPatches);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcIncompatibleDatasetNames);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcIncompatiblePatchLists);
+
protected:
/**
* Declare an entry in the list of
template <int dof_handler_dim, int patch_dim, int patch_space_dim>
void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear_input_data_references ()
+DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+clear_input_data_references ()
{
for (unsigned int i=0; i<dof_data.size(); ++i)
{
+template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+void
+DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+merge_patches (const DataOut_DoFData &source)
+{
+ const std::vector<Patch> source_patches = source.get_patches ();
+ Assert (patches.size () != 0, ExcNoPatches ());
+ Assert (source_patches.size () != 0, ExcNoPatches ());
+ // check equality of component
+ // names
+ Assert (get_dataset_names() == source.get_dataset_names(),
+ ExcIncompatibleDatasetNames());
+ // make sure patches are compatible
+ Assert (patches[0].n_subdivisions == source_patches[0].n_subdivisions,
+ ExcIncompatiblePatchLists());
+ Assert (patches[0].data.n_rows() == source_patches[0].data.n_rows(),
+ ExcIncompatiblePatchLists());
+ Assert (patches[0].data.n_cols() == source_patches[0].data.n_cols(),
+ ExcIncompatiblePatchLists());
+
+ // merge patches. store old number
+ // of elements, since we need to
+ // adjust patch numbers, etc
+ // afterwards
+ const unsigned int old_n_patches = patches.size();
+ patches.insert (patches.end(),
+ source_patches.begin(),
+ source_patches.end());
+ // adjust patch numbers
+ for (unsigned int i=old_n_patches; i<patches.size(); ++i)
+ patches[i].patch_index += old_n_patches;
+ // adjust patch neighbors
+ for (unsigned int i=old_n_patches; i<patches.size(); ++i)
+ for (unsigned int n=0; n<GeometryInfo<patch_dim>::faces_per_cell; ++n)
+ if (patches[i].neighbors[n] != Patch::no_neighbor)
+ patches[i].neighbors[n] += old_n_patches;
+}
+
+
+
template <int dof_handler_dim, int patch_dim, int patch_space_dim>
void
DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear ()