{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/62410112","id":62410112,"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\n+{\n+  /**\n+   * A class for the transfer of continuous data stored at quadrature points when\n+   * performing h-adaptive refinement of parallel::distributed::Triangulation .\n+   *\n+   * <h3>Implementation details</h3>\n+   *\n+   * This class implements the transfer of the quadrature point data between\n+   * cells in case of adaptive refinement. That also includes automatic shipping of\n+   * information between different processors.\n+   *\n+   * To that end, the constructor of the class is provided with three main objects:\n+   * scalar FiniteElement @projection_fe, @p mass_quadrature and @p data_quadrature\n+   * Quadrature rules.\n+   * First, the data located at @p data_quadrature of each cell is L2-projected\n+   * to the continuous space defined by a single FiniteElement @projection_fe .\n+   * In  doing so the mass matrix of this element is required, which will be calculated\n+   * with the @p mass_quadrature rule . Should the cell now belong to another processor,\n+   * the data is then sent to this processor. The class makes use of a feature of p4est\n+   * (and parallel::distributed::Triangulation) that allows one to attach information\n+   * to cells during mesh refinement and rebalancing.\n+   * On receiving information on the target cell, the data is projected back to the\n+   * quadrature points. In the case that local refinement is performed, we have to first\n+   * project local DoF values of the parent element to each child.\n+   *\n+   * This class is templated by @p DataType type, however the user's @p DataType class\n+   * has to be derived from the TransferableQuadraturePointData class. In practice\n+   * that amounts to implementing the following three functions shown below for a\n+   * quadrature point data with 2 scalars :\n+   * <code>\n+   * class MyQData : public TransferableQuadraturePointData\n+   * {\n+   * public:\n+   *   unsigned int number_of_values() const\n+   *   {\n+   *      return 2;\n+   *   }\n+   *\n+   *   // a function to pack scalars into a vector\n+   *   void pack_values(std::vector<double> &values) const\n+   *   {\n+   *     Assert (scalars.size()==2, ExcInternalError());\n+   *     scalars[0] = value1;\n+   *     scalars[1] = value2;\n+   *   }\n+   *\n+   *   void unpack_values(const std::vector<double> &values)\n+   *   {\n+   *     Assert (scalars.size() ==2, ExcInternalError());\n+   *     value1 = scalars[0];\n+   *     value2 = scalars[1];\n+   *   }\n+   * };\n+   * </code>\n+   * Note that the order of packing and unpacking has to be the same.\n+   *\n+   * This class can then be use with CellDataStorage in the following way:\n+   * <code>\n+   * CellDataStorage<typename Triangulation<dim,dim>::cell_iterator,MyQData> data_storage;\n+   * distributed::ContinuousQuadratureDataTransfer<dim,MyQData> data_transfer(FE_Q<dim>(2),QGauss<dim>(3),QGauss<dim>(4));\n+   * //...populate data for all active cells in data_storage\n+   * //...mark cells for refinement...\n+   * data_transfer.prepare_for_coarsening_and_refinement(triangulation,&data_storage);\n+   * triangulation.execute_coarsening_and_refinement();\n+   * //...initialize quadrature point data on new cells by calling CellDataStorage::reinit()\n+   * data_transfer.interpolate();\n+   * </code>\n+   * This approach can be extended to quadrature point data with Tensors of\n+   * arbitrary order, although with a little bit more work in packing and\n+   * unpacking of data inside MyQData class.\n+   *\n+   * @note Currently coarsening is not supported.\n+   *\n+   * @note During mesh balancing, children of a single cell can be attributed\n+   * to different processors. As a corollary, their parent cells can simultaneously\n+   * exist on multiple processors.\n+   *\n+   * @note The functionality provided by this class can alternatively be achieved\n+   * using parallel::distributed::SolutionTransfer . However, that would require\n+   * the following steps: (i) create an auxiliary DoFHandler with a (discontinuous Galerkin)\n+   * FiniteElement which has enough components to represent all data stored at the\n+   * quadrature points; (ii) project the data to the FiniteElement space\n+   * and thereby store results in global vectors; (iii) use parallel::distributed::SolutionTransfer\n+   * to project FE vectors to the new mesh; and (iv) finally project the\n+   * data back to the quadrature points on the new mesh via FEValues class.\n+   * The ContinuousQuadratureDataTransfer class aims at simplifying the whole\n+   * process by only requiring that the quadrature point data class is derived\n+   * from the TransferableQuadraturePointData. Everything else will be done automatically.\n+   *\n+   * @note This class is not well suited for the transfer of discontinuous\n+   * quadrature point data. For example for the elasto-plastic constitutive model\n+   * on a cell only some quadrature points may be in the plastic state whereas\n+   * others remain elastic. In this scenario using this class to transfer\n+   * plastic strain at quadrature points does not make much sense as this field\n+   * is discontinuous, whereas cell-based L2-projection performed by this class\n+   * will smooth this discontinuity across all child elements.\n+   *\n+   * @author Denis Davydov, Jean-Paul Pelteret, 2016\n+   */\n+  template <int dim, typename DataType>\n+  class ContinuousQuadratureDataTransfer\n+  {\n+  public:\n+    static_assert(std::is_base_of<TransferableQuadraturePointData, DataType>::value,\n+                  \"User's DataType class should be derived from QPData\");\n+\n+    /**\n+     * A typedef for a cell.\n+     */\n+    typedef typename parallel::distributed::Triangulation<dim>::cell_iterator CellIteratorType;\n+\n+    /**\n+     * Constructor which takes the FiniteElement @p projection_fe , the quadrature\n+     * rule @p mass_quadrature used to integrate its local mass matrix and\n+     * finally the quadrature rule @p data_quadrature which is used to store @p DataType .\n+     */\n+    ContinuousQuadratureDataTransfer(const FiniteElement<dim> &projection_fe,\n+                                     const Quadrature<dim> &mass_quadrature,\n+                                     const Quadrature<dim> &data_quadrature);\n+\n+    /**\n+     * Virtual destructor.\n+     */\n+    ~ContinuousQuadratureDataTransfer();\n+\n+    /**\n+     * Prepares for coarsening and refinement of a triangulation @p tria .\n+     * @p data_storage represents the cell data which should be transfered and\n+     * it should be initialized for each locally owned active cell.\n+     *\n+     * @note Although CellDataStorage class allows storing on different cells\n+     * different objects derived from the base class, here we assume that\n+     * @p data_storage contains objects of the same type, more specifically\n+     * they pack/unpack the same data.\n+     */\n+    void prepare_for_coarsening_and_refinement (parallel::distributed::Triangulation<dim> &tria,\n+                                                CellDataStorage<CellIteratorType,DataType> *data_storage);\n+\n+    /**\n+     * Interpolate the data previously stored in this object before the mesh\n+     * was refined or coarsened onto the quadrature points of the currently active\n+     * set of cells.\n+     *\n+     * @note Before calling this function the user is expected to populate the\n+     * data stored in the @p data_storage object provided to prepare_for_coarsening_and_refinement()\n+     * at new cells using CellDataStorage::initialize(). If that is not the case,\n+     * an exception will be thrown in debug mode.\n+     */\n+    void interpolate ();\n+\n+  private:\n+    /**\n+     * A callback function used to pack the data on the current mesh into\n+     * objects that can later be retrieved after refinement, coarsening and\n+     * repartitioning.\n+     */\n+    void pack_function(const typename parallel::distributed::Triangulation<dim,dim>::cell_iterator &cell,\n+                       const typename parallel::distributed::Triangulation<dim,dim>::CellStatus status,\n+                       void *data);\n+\n+    /**\n+     * A callback function used to unpack the data on the current mesh that\n+     * has been packed up previously on the mesh before refinement,\n+     * coarsening and repartitioning.\n+     */\n+    void unpack_function (const typename parallel::distributed::Triangulation<dim,dim>::cell_iterator &cell,\n+                          const typename parallel::distributed::Triangulation<dim,dim>::CellStatus status,\n+                          const void *data);\n+\n+    /**\n+     * FiniteElement used to project data from and to quadrature points.\n+     */\n+    const std::shared_ptr<const FiniteElement<dim> > projection_fe;\n+\n+    /**\n+     * Number of DoFs per cell of the projection_fe\n+     */\n+    const unsigned int dofs_per_cell;\n+\n+    /**\n+     * The size of the data that will be sent, which depends on the DataType class.\n+     */\n+    size_t size;\n+\n+    /**\n+     * Number of quadrature points at which DataType is stored.\n+     */\n+    const unsigned int n_q_points;\n+\n+    /**\n+     * Projection matrix from the quadrature points to local DoFs for a single\n+     * scalar.\n+     */\n+    FullMatrix<double> project_to_fe_matrix;\n+\n+    /**\n+     * Projection matrix from the local DoFs to quadrature points for a single\n+     * scalar.\n+     */\n+    FullMatrix<double> project_to_qp_matrix;\n+\n+    /**\n+     * Auxiliary matrix which represents projection of each internal value stored\n+     * at the quadrature point (second index) to the local DoFs of the @p projection_fe\n+     * (first index).\n+     */\n+    FullMatrix<double> matrix_dofs;\n+\n+    /**\n+     * Projection of @p matrix_dofs to each child cell in case of adaptive refinement.\n+     */\n+    FullMatrix<double> matrix_dofs_child;\n+\n+    /**\n+     * Auxiliary matrix which represents data (second index) stored at each\n+     * quadrature point (first index).\n+     */\n+    FullMatrix<double> matrix_quadrature;\n+\n+    /**\n+     * The offset that the Triangulation has assigned to this object\n+     * starting at which we are allowed to read.\n+     */\n+    unsigned int offset;\n+\n+    /**\n+     * A pointer to the CellDataStorage class whose data will be transfered.\n+     */\n+    CellDataStorage<CellIteratorType,DataType> *data_storage;\n+\n+    /**\n+     * A pointer to the distributed triangulation to which cell data is attached.\n+     */\n+    parallel::distributed::Triangulation<dim> *tr;\n+  };\n+\n+} // distributed\n+\n+#endif\n+\n+/*@}*/\n+\n+#ifndef DOXYGEN\n+\n+// -------------------  inline and template functions ----------------\n+\n+//--------------------------------------------------------------------\n+//                         TransferableQuadraturePointData\n+//--------------------------------------------------------------------\n+TransferableQuadraturePointData::TransferableQuadraturePointData()\n+{};\n+\n+TransferableQuadraturePointData::~TransferableQuadraturePointData()\n+{};\n+\n+//--------------------------------------------------------------------\n+//                         CellDataStorage\n+//--------------------------------------------------------------------\n+\n+template <typename CellIteratorType, typename DataType>\n+CellDataStorage<CellIteratorType,DataType>::\n+CellDataStorage()\n+{};\n+\n+template <typename CellIteratorType, typename DataType>\n+CellDataStorage<CellIteratorType,DataType>::\n+~CellDataStorage()\n+{};\n+\n+template <typename CellIteratorType, typename DataType>\n+template<typename T>\n+void CellDataStorage<CellIteratorType,DataType>::initialize(const CellIteratorType &cell,\n+                                                            const unsigned int n_q_points)\n+{\n+  static_assert(std::is_base_of<DataType, T>::value,\n+                \"User's T class should be derived from user's DataType class\");\n+  static_assert(std::is_default_constructible<T>::value,\n+                \"Class T requires default-constructible elements\");\n+\n+  if (map.find(cell) == map.end())\n+    {\n+      map[cell] = std::vector<std::shared_ptr<DataType> >(n_q_points);\n+      // we need to initialise one-by-one as the std::vector<>(q, T())\n+      // will end with a single same T object stored in each element of the vector:\n+      typename std::map<CellIteratorType,CellVector<DataType> >::iterator it = map.find(cell);\n+      for (unsigned int q=0; q < n_q_points; q++)\n+        it->second[q] = std::make_shared<T>();\n+    }\n+}\n+\n+template <typename CellIteratorType, typename DataType>\n+template<typename T>\n+void CellDataStorage<CellIteratorType,DataType>::initialize(const CellIteratorType &cell_start,\n+                                                            const CellIteratorType &cell_end,\n+                                                            const unsigned int number)\n+{\n+  for (CellIteratorType it = cell_start; it != cell_end; it++)\n+    if (it->is_locally_owned())\n+      initialize<T>(it,number);\n+}\n+\n+\n+\n+template <typename CellIteratorType, typename DataType>\n+bool CellDataStorage<CellIteratorType,DataType>::erase(const CellIteratorType &cell)\n+{\n+  const typename std::map<CellIteratorType,CellVector<DataType> >::const_iterator it = map.find(cell);\n+  for (unsigned int i = 0; i < it->second.size(); i++)\n+    {\n+      Assert(it->second[i].unique(),\n+             ExcMessage(\"Can not erase the cell data multiple objects reference its data.\"));\n+    }\n+\n+  return (map.erase(cell)==1);\n+}\n+\n+template <typename CellIteratorType, typename DataType>\n+void CellDataStorage<CellIteratorType,DataType>::clear()\n+{\n+  // Do not call\n+  // map.clear();\n+  // as we want to be sure no one uses the stored objects. Loop manually:\n+  typename std::map<CellIteratorType,CellVector<DataType> >::iterator it = map.begin();\n+  while (it != map.end())\n+    {\n+      // loop over all objects and see if noone is using them\n+      for (unsigned int i = 0; i < it->second.size(); i++)\n+        {\n+          Assert(it->second[i].unique(),\n+                 ExcMessage(\"Can not erase the cell data multiple objects reference its data.\"));\n+        }\n+      it = map.erase(it);\n+    }\n+}\n+\n+template <typename CellIteratorType, typename DataType>\n+template <typename T>\n+CellDataStorage<CellIteratorType,DataType>::CellVector<T>\n+CellDataStorage<CellIteratorType,DataType>::get_data(const CellIteratorType &cell)\n+{\n+  static_assert(std::is_base_of<DataType, T>::value,\n+                \"User's T class should be derived from user's DataType class\");\n+\n+  typename std::map<CellIteratorType,CellVector<DataType> >::iterator it = map.find(cell);\n+  Assert(it != map.end(), ExcMessage(\"Could not find data for the cell\"));\n+\n+  // It would be nice to have a specilized version of this function for T==DataType.\n+  // However explicit (i.e full) specialization of a member template is only allowed\n+  // when the enclosing class is also explicitly (i.e fully) specialized.\n+  // Thus, stick with copying of shared pointers even when the T==DataType:\n+  CellVector<T> res (it->second.size());\n+  for (unsigned int q = 0; q < res.size(); q++)\n+    res[q] = std::dynamic_pointer_cast<T>(it->second[q]);\n+  return res;\n+}\n+\n+template <typename CellIteratorType, typename DataType>\n+template <typename T>\n+CellDataStorage<CellIteratorType,DataType>::CellVector<const T>\n+CellDataStorage<CellIteratorType,DataType>::get_data(const CellIteratorType &cell) const\n+{\n+  static_assert(std::is_base_of<DataType, T>::value,\n+                \"User's T class should be derived from user's DataType class\");\n+\n+  const typename std::map<CellIteratorType,CellVector<DataType> >::const_iterator it = map.find(cell);\n+  Assert(it != map.end(), ExcMessage(\"Could not find QP data for the cell\"));\n+\n+  // Cast base class to the desired class. This has to be done irrespectively of\n+  // T==DataType as we need to return shapred_ptr<const T> to make sure the user\n+  // does not modify the content of QP objects\n+  CellVector<const T> res (it->second.size());\n+  for (unsigned int q = 0; q < res.size(); q++)\n+    res[q] = std::dynamic_pointer_cast<const T>(it->second[q]);\n+  return res;\n+}\n+\n+//--------------------------------------------------------------------\n+//                    ContinuousQuadratureDataTransfer\n+//--------------------------------------------------------------------\n+\n+\n+/**\n+ * Pack cell data of type @p DataType stored using @p data_storage in @p cell\n+ * at each quadrature point to @p matrix_data. Here @p matrix_data is a matrix\n+ * whose first index corresponds to different quadrature points on the cell\n+ * whereas the second index represents different values stored at each\n+ * quadrature point in the DataType class.\n+ */\n+template<typename CellIteratorType, typename DataType>\n+void pack_cell_data\n+(const CellIteratorType &cell,\n+ CellDataStorage<CellIteratorType,DataType> *data_storage,\n+ FullMatrix<double> &matrix_data)","path":"include/deal.II/base/quadrature_point_data.h","position":621,"original_position":593,"commit_id":"d06430a1226092e62643768e53eeceb4b8a734eb","original_commit_id":"d574a3a7c9396028dde5fd3425d66b5ed49a18e9","user":{"login":"bangerth","id":7504421,"avatar_url":"https://avatars.githubusercontent.com/u/7504421?v=3","gravatar_id":"","url":"https://api.github.com/users/bangerth","html_url":"https://github.com/bangerth","followers_url":"https://api.github.com/users/bangerth/followers","following_url":"https://api.github.com/users/bangerth/following{/other_user}","gists_url":"https://api.github.com/users/bangerth/gists{/gist_id}","starred_url":"https://api.github.com/users/bangerth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangerth/subscriptions","organizations_url":"https://api.github.com/users/bangerth/orgs","repos_url":"https://api.github.com/users/bangerth/repos","events_url":"https://api.github.com/users/bangerth/events{/privacy}","received_events_url":"https://api.github.com/users/bangerth/received_events","type":"User","site_admin":false},"body":"Since you're using C++11 with move constructors and move assignment operators, why not simply return the `FullMatrix` object from the function?","created_at":"2016-05-07T02:36:02Z","updated_at":"2016-05-07T02:36:02Z","html_url":"https://github.com/dealii/dealii/pull/2552#discussion_r62410112","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/2552","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/62410112"},"html":{"href":"https://github.com/dealii/dealii/pull/2552#discussion_r62410112"},"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-07T02:36:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de2b8cc73313eeed2d1a36ae4eff8811dd3f9e5c","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/d06430a1226092e62643768e53eeceb4b8a734eb","head":{"label":"davydden:qph_data","ref":"qph_data","sha":"d06430a1226092e62643768e53eeceb4b8a734eb","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-06T18:02:34Z","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":139889,"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-06T18:02:35Z","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/d06430a1226092e62643768e53eeceb4b8a734eb"}}}}