{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/62322221","id":62322221,"diff_hunk":"@@ -0,0 +1,808 @@\n+// ---------------------------------------------------------------------\n+//\n+// Copyright (C) 2016 by the deal.II authors\n+//\n+// This file is part of the deal.II library.\n+//\n+// The deal.II library is free software; you can use it, redistribute\n+// it, and/or modify it under the terms of the GNU Lesser General\n+// Public License as published by the Free Software Foundation; either\n+// version 2.1 of the License, or (at your option) any later version.\n+// The full text of the license can be found in the file LICENSE at\n+// the top level of the deal.II distribution.\n+//\n+// ---------------------------------------------------------------------\n+\n+#ifndef dealii__quadrature_point_data_h\n+#define dealii__quadrature_point_data_h\n+\n+#ifdef DEAL_II_WITH_CXX11\n+\n+#include <deal.II/base/quadrature.h>\n+#include <deal.II/base/config.h>\n+#include <deal.II/base/subscriptor.h>\n+#include <deal.II/grid/tria.h>\n+#include <deal.II/grid/tria_accessor.h>\n+#include <deal.II/distributed/tria.h>\n+#include <deal.II/fe/fe_tools.h>\n+#include <deal.II/fe/fe.h>\n+#include <deal.II/lac/vector.h>\n+\n+#include <vector>\n+#include <map>\n+#include <typeinfo>\n+\n+DEAL_II_NAMESPACE_OPEN\n+\n+/*!@addtogroup Quadrature */\n+/*@{*/\n+\n+/**\n+ * A class for storing at each cell @p CellIteratorType a vector of data @p DataType .\n+ * The underlying structure and the initialize() method of this class is designed\n+ * in such a way that one could use different child classes derived from the\n+ * base DataType class to store data on a given cell. This implies the usage of pointers,\n+ * in our case -- std::shared_ptr().\n+ *\n+ * @note Note that the data type stored on each cell can be different.\n+ * However, within the cell this class stores a vector of objects of a single data type.\n+ * For this reason, this class may not be sufficiently flexible when, for example,\n+ * adopting a level-set approach to describe material behavior.\n+ *\n+ * @author Denis Davydov, Jean-Paul Pelteret, 2016\n+ */\n+template <typename CellIteratorType, typename DataType>\n+class CellDataStorage\n+{\n+public:\n+  /**\n+   * A typedef for a vector of shared pointers with arbitrary data type @p T .\n+   */\n+  template <typename T> using CellVector = std::vector<std::shared_ptr<T> >;\n+\n+  /**\n+   * Default constructor.\n+   */\n+  CellDataStorage();\n+\n+  /**\n+   * Default virtual destructor.\n+   */\n+  virtual ~CellDataStorage();\n+\n+  /**\n+   * Initialize data on the @p cell to store @p number_of_data_points of objects of type @p T .\n+   * The typename @p T is possibly another class which is derived from the\n+   * base @p DataType class. In order to initialize the vector of objects\n+   * we have to assume that the class @p T has a default constructor.\n+   * This function has to be called on every cell where data is to be stored.\n+   *\n+   * After the data is initialized, it can be modified using the get_data()\n+   * function.\n+   *\n+   * @note Subsequent calls of this function with the same @p cell will not\n+   * alter the objects associated with it. In order to remove the stored data,\n+   * use the erase() function.\n+   *\n+   * @note It is possible to use different types @p T for different cells which\n+   * may reflect, for example, different constitutive models of continuum mechanics\n+   * in different parts of the domain.\n+   */\n+  template<typename T=DataType>\n+  void initialize(const CellIteratorType &cell,\n+                  const unsigned int number_of_data_points);\n+\n+  /**\n+   * Same as above but for a range of iterators starting at @p cell_start\n+   * until, but not including, @p cell_end for all locally owned cells, i.e.\n+   * for which `is_locally_owned()==true`\n+   */\n+  template<typename T=DataType>\n+  void initialize(const CellIteratorType &cell_start,\n+                  const CellIteratorType &cell_end,\n+                  const unsigned int number);\n+\n+  /**\n+   * Removes data stored at the @p cell. Returns true if the data was removed.\n+   * If no data is attached to the @p cell, this function will not do anything\n+   * and returns false.\n+   *\n+   * @note In debug mode, this function will also check that the are no\n+   * outstanding references to the data stored on this cell. That is to say,\n+   * that the only references to the stored data are that made by this class.\n+   */\n+  bool erase(const CellIteratorType &cell);\n+\n+  /**\n+   * Clear all the data stored in this object.\n+   */\n+  void clear();\n+\n+  /**\n+   * Get a vector of the data located at @p cell .\n+   * A possible additional typename @p T is the class to which the base class\n+   * DataType could be cast. Since @p DataType is stored as shared pointers,\n+   * there is minimal overhead in returning a vector by value instead of by reference.\n+   * This allows flexibility if class @p T is not the same as @p DataType on a\n+   * cell-by-cell basis.\n+   */\n+  template<typename T=DataType>\n+  CellVector<T> get_data(const CellIteratorType &cell);\n+\n+  /**\n+   * Get a vector of constant pointers to data located at @p cell .\n+   * A possible additional typename @p T is the class to which the base class\n+   * DataType could be cast. Since @p DataType is stored as shared pointers,\n+   * there is minimal overhead in returning a vector by value instead of by reference.\n+   * This allows flexibility if class @p T is not the same as @p DataType on a\n+   * cell-by-cell basis.\n+   */\n+  template<typename T=DataType>\n+  CellVector<const T> get_data(const CellIteratorType &cell) const;\n+\n+private:\n+  /**\n+   * A map to store a vector of data on a cell.\n+   */\n+  std::map<CellIteratorType, CellVector<DataType> > map;\n+\n+};\n+\n+\n+/**\n+ * An abstract class which specifies requirements for data on\n+ * a single quadrature point to be transferable during refinement.\n+ * One possible implementation is via the restriction/prolongation matrices\n+ * as implemented in ContinuousQuadratureDataTransfer class.\n+ *\n+ * @author Denis Davydov, Jean-Paul Pelteret, 2016\n+ */\n+class TransferableQuadraturePointData\n+{\n+public:\n+  /**\n+   * Default constructor.\n+   */\n+  TransferableQuadraturePointData();\n+\n+  /**\n+   * Default virtual destructor.\n+   */\n+  virtual ~TransferableQuadraturePointData();\n+\n+  /**\n+   * Returns the total number of values which will be\n+   * packed/unpacked from the user's DataType class. Consequently it is also\n+   * the size of the vectors in pack_values() and unpack_values() .\n+   */\n+  virtual unsigned int number_of_values() const = 0;\n+\n+  /**\n+   * Pack all data stored in this class into a vector @p values .\n+   * This vector will contain all scalar and/or Tensorial data local to each\n+   * quadrature point.\n+   *\n+   * @p values will be resized to number_of_values() .\n+   */\n+  virtual void pack_values(std::vector<double> &values) const = 0;\n+\n+  /**\n+   * The opposite of the above, namely\n+   * unpack a vector @p values into the data stored in this class.\n+   *\n+   * @p values will be resized to number_of_values() .\n+   */\n+  virtual void unpack_values(const std::vector<double> &values) = 0;\n+};\n+\n+\n+#ifdef DEAL_II_WITH_P4EST\n+namespace distributed","path":"include/deal.II/base/quadrature_point_data.h","position":221,"original_position":200,"commit_id":"1538cfb7f77c837d9c9812b768fb75c65cbf2c72","original_commit_id":"d574a3a7c9396028dde5fd3425d66b5ed49a18e9","user":{"login":"davydden","id":8023934,"avatar_url":"https://avatars.githubusercontent.com/u/8023934?v=3","gravatar_id":"","url":"https://api.github.com/users/davydden","html_url":"https://github.com/davydden","followers_url":"https://api.github.com/users/davydden/followers","following_url":"https://api.github.com/users/davydden/following{/other_user}","gists_url":"https://api.github.com/users/davydden/gists{/gist_id}","starred_url":"https://api.github.com/users/davydden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davydden/subscriptions","organizations_url":"https://api.github.com/users/davydden/orgs","repos_url":"https://api.github.com/users/davydden/repos","events_url":"https://api.github.com/users/davydden/events{/privacy}","received_events_url":"https://api.github.com/users/davydden/received_events","type":"User","site_admin":false},"body":"correct. Since I envision to have similar algorithms for shared triangulation, i though to enclose this class in `distributed`. Supposedly at some point there will be `distributed::DiscontinuousDataTransfer` and then the same for `shared` namespace.","created_at":"2016-05-06T12:16:29Z","updated_at":"2016-05-06T12:16:29Z","html_url":"https://github.com/dealii/dealii/pull/2552#discussion_r62322221","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/2552","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/62322221"},"html":{"href":"https://github.com/dealii/dealii/pull/2552#discussion_r62322221"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/2552"}}},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/2552","id":67646492,"html_url":"https://github.com/dealii/dealii/pull/2552","diff_url":"https://github.com/dealii/dealii/pull/2552.diff","patch_url":"https://github.com/dealii/dealii/pull/2552.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/2552","number":2552,"state":"open","locked":false,"title":"Quadrature point data manager","user":{"login":"davydden","id":8023934,"avatar_url":"https://avatars.githubusercontent.com/u/8023934?v=3","gravatar_id":"","url":"https://api.github.com/users/davydden","html_url":"https://github.com/davydden","followers_url":"https://api.github.com/users/davydden/followers","following_url":"https://api.github.com/users/davydden/following{/other_user}","gists_url":"https://api.github.com/users/davydden/gists{/gist_id}","starred_url":"https://api.github.com/users/davydden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davydden/subscriptions","organizations_url":"https://api.github.com/users/davydden/orgs","repos_url":"https://api.github.com/users/davydden/repos","events_url":"https://api.github.com/users/davydden/events{/privacy}","received_events_url":"https://api.github.com/users/davydden/received_events","type":"User","site_admin":false},"body":"a class to manage quadrature point data including interpolation to child cells and transferring data in case of p::d::Tria.\r\n\r\nUser's DATA class has has to implement only very few simple functions:\r\n```\r\nstruct MyQData : public QPData\r\n{\r\n  double value1;\r\n  double value2;\r\n\r\n  virtual void pack_scalars(std::vector<double> &scalars) const\r\n  {\r\n    Assert (scalars.size()==2, ExcInternalError());\r\n    scalars[0] = value1;\r\n    scalars[1] = value2;\r\n  }\r\n\r\n  virtual void unpack_scalars(const std::vector<double> &scalars)\r\n  {\r\n    Assert (scalars.size() ==2, ExcInternalError());\r\n    value1 = scalars[0];\r\n    value2 = scalars[1];\r\n  }\r\n};\r\n```\r\n~~I still need to make refinement in both unit tests more interesting, so it's WIP. But I consider it be a good start for a discussion, thus this PR.~~\r\n\r\n@jppelteret have a look. That is what we have discussed and should be extendable to shared tria with hp::DoFHandler later on.\r\n\r\nThe base class is flexible enough to support later hp::DoFHandler when one might have different data stored in different cells based on material (e.g. fluilds/solids) or constitutive law (elasticity/plasticity/etc).\r\n\r\n\r\n~~p.s. i will squash later.~~\r\n\r\n**TODO**\r\n- [x] check that consequently called `initialize` does not erase the data\r\n- [x] add `initialize(start,end,number)` with a disclaimer that we have to hit `end`\r\n- [x] add `erase(cell)` and `clear()` ","created_at":"2016-04-24T19:05:20Z","updated_at":"2016-05-06T12:16:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf0828ec929325f64f6d9677559238ebaceb04e2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/2552/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/2552/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/2552/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/1538cfb7f77c837d9c9812b768fb75c65cbf2c72","head":{"label":"davydden:qph_data","ref":"qph_data","sha":"1538cfb7f77c837d9c9812b768fb75c65cbf2c72","user":{"login":"davydden","id":8023934,"avatar_url":"https://avatars.githubusercontent.com/u/8023934?v=3","gravatar_id":"","url":"https://api.github.com/users/davydden","html_url":"https://github.com/davydden","followers_url":"https://api.github.com/users/davydden/followers","following_url":"https://api.github.com/users/davydden/following{/other_user}","gists_url":"https://api.github.com/users/davydden/gists{/gist_id}","starred_url":"https://api.github.com/users/davydden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davydden/subscriptions","organizations_url":"https://api.github.com/users/davydden/orgs","repos_url":"https://api.github.com/users/davydden/repos","events_url":"https://api.github.com/users/davydden/events{/privacy}","received_events_url":"https://api.github.com/users/davydden/received_events","type":"User","site_admin":false},"repo":{"id":22635610,"name":"dealii","full_name":"davydden/dealii","owner":{"login":"davydden","id":8023934,"avatar_url":"https://avatars.githubusercontent.com/u/8023934?v=3","gravatar_id":"","url":"https://api.github.com/users/davydden","html_url":"https://github.com/davydden","followers_url":"https://api.github.com/users/davydden/followers","following_url":"https://api.github.com/users/davydden/following{/other_user}","gists_url":"https://api.github.com/users/davydden/gists{/gist_id}","starred_url":"https://api.github.com/users/davydden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davydden/subscriptions","organizations_url":"https://api.github.com/users/davydden/orgs","repos_url":"https://api.github.com/users/davydden/repos","events_url":"https://api.github.com/users/davydden/events{/privacy}","received_events_url":"https://api.github.com/users/davydden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davydden/dealii","description":"The development repository for the deal.II finite element library.","fork":true,"url":"https://api.github.com/repos/davydden/dealii","forks_url":"https://api.github.com/repos/davydden/dealii/forks","keys_url":"https://api.github.com/repos/davydden/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davydden/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davydden/dealii/teams","hooks_url":"https://api.github.com/repos/davydden/dealii/hooks","issue_events_url":"https://api.github.com/repos/davydden/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/davydden/dealii/events","assignees_url":"https://api.github.com/repos/davydden/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/davydden/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/davydden/dealii/tags","blobs_url":"https://api.github.com/repos/davydden/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davydden/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davydden/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/davydden/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davydden/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/davydden/dealii/languages","stargazers_url":"https://api.github.com/repos/davydden/dealii/stargazers","contributors_url":"https://api.github.com/repos/davydden/dealii/contributors","subscribers_url":"https://api.github.com/repos/davydden/dealii/subscribers","subscription_url":"https://api.github.com/repos/davydden/dealii/subscription","commits_url":"https://api.github.com/repos/davydden/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/davydden/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/davydden/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/davydden/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/davydden/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/davydden/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davydden/dealii/merges","archive_url":"https://api.github.com/repos/davydden/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davydden/dealii/downloads","issues_url":"https://api.github.com/repos/davydden/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/davydden/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/davydden/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/davydden/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davydden/dealii/labels{/name}","releases_url":"https://api.github.com/repos/davydden/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/davydden/dealii/deployments","created_at":"2014-08-05T08:06:18Z","updated_at":"2015-01-10T19:48:48Z","pushed_at":"2016-05-06T12:03:43Z","git_url":"git://github.com/davydden/dealii.git","ssh_url":"git@github.com:davydden/dealii.git","clone_url":"https://github.com/davydden/dealii.git","svn_url":"https://github.com/davydden/dealii","homepage":"http://www.dealii.org/","size":139881,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dealii:master","ref":"master","sha":"427db348221bedad0952dc819f37889c6e1b0c30","user":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=3","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"repo":{"id":21943980,"name":"dealii","full_name":"dealii/dealii","owner":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=3","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dealii/dealii","description":"The development repository for the deal.II finite element library.","fork":false,"url":"https://api.github.com/repos/dealii/dealii","forks_url":"https://api.github.com/repos/dealii/dealii/forks","keys_url":"https://api.github.com/repos/dealii/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dealii/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dealii/dealii/teams","hooks_url":"https://api.github.com/repos/dealii/dealii/hooks","issue_events_url":"https://api.github.com/repos/dealii/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/dealii/dealii/events","assignees_url":"https://api.github.com/repos/dealii/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/dealii/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/dealii/dealii/tags","blobs_url":"https://api.github.com/repos/dealii/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dealii/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dealii/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/dealii/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/dealii/dealii/languages","stargazers_url":"https://api.github.com/repos/dealii/dealii/stargazers","contributors_url":"https://api.github.com/repos/dealii/dealii/contributors","subscribers_url":"https://api.github.com/repos/dealii/dealii/subscribers","subscription_url":"https://api.github.com/repos/dealii/dealii/subscription","commits_url":"https://api.github.com/repos/dealii/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/dealii/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/dealii/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/dealii/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/dealii/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/dealii/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dealii/dealii/merges","archive_url":"https://api.github.com/repos/dealii/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dealii/dealii/downloads","issues_url":"https://api.github.com/repos/dealii/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/dealii/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/dealii/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/dealii/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dealii/dealii/labels{/name}","releases_url":"https://api.github.com/repos/dealii/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/dealii/dealii/deployments","created_at":"2014-07-17T14:00:26Z","updated_at":"2016-04-22T01:51:51Z","pushed_at":"2016-05-06T12:03:44Z","git_url":"git://github.com/dealii/dealii.git","ssh_url":"git@github.com:dealii/dealii.git","clone_url":"https://github.com/dealii/dealii.git","svn_url":"https://github.com/dealii/dealii","homepage":"http://www.dealii.org/","size":159685,"stargazers_count":145,"watchers_count":145,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":166,"mirror_url":null,"open_issues_count":176,"forks":166,"open_issues":176,"watchers":145,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/2552"},"html":{"href":"https://github.com/dealii/dealii/pull/2552"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/2552"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/2552/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/2552/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/2552/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/1538cfb7f77c837d9c9812b768fb75c65cbf2c72"}}}}