From: richter Date: Fri, 11 Feb 2000 13:28:51 +0000 (+0000) Subject: implementation of multithread support X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd9daac58d6f82a5b349bde078af48dc3d50cd40;p=dealii-svn.git implementation of multithread support git-svn-id: https://svn.dealii.org/trunk@2389 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/data_out.h b/deal.II/deal.II/include/numerics/data_out.h index f4e3cb57a2..0fbe8386aa 100644 --- a/deal.II/deal.II/include/numerics/data_out.h +++ b/deal.II/deal.II/include/numerics/data_out.h @@ -383,10 +383,14 @@ class DataOut : public DataOut_DoFData * functions of the base class. See the * general documentation of this class * for further information. + * + * The functions supports multithreading. */ - virtual void build_patches (const unsigned int n_subdivisions = 1); + virtual void build_patches (const unsigned int n_subdivisions = 1, + const unsigned int n_threads_ = 1); + - /** + /** * Return the first cell which we * want output for. The default * implementation returns the first @@ -408,6 +412,7 @@ class DataOut : public DataOut_DoFData * active cell, but you might want * to return other cells in a derived * class. Note that the default + * implementation assumes that * the given #cell# is active, which * is guaranteed as long as #first_cell# @@ -418,6 +423,37 @@ class DataOut : public DataOut_DoFData */ virtual typename DoFHandler::cell_iterator next_cell (const typename DoFHandler::cell_iterator &cell); + + private: + /** + * All data needed in one thread + * is gathered in the struct + * Data. + * The data is handled globally + * to avoid allocation of memory + * in the threads. + */ + struct Data + { + unsigned int n_threads; + unsigned int this_thread; + unsigned int n_components; + unsigned int n_datasets; + unsigned int n_subdivisions; + vector patch_values; + vector > patch_values_system; + Data () + {} + }; + /** + * Builds every #n_threads's# + * patch. This function may be + * called parallel. + * If multithreading is not + * used, the function is called + * once and generates all patches. + */ + void * DataOut::build_some_patches (Data data); };