{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/38826748","id":38826748,"diff_hunk":"@@ -0,0 +1,709 @@\n+// ---------------------------------------------------------------------\n+//\n+// Copyright (C) 2015 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__read_write_vector_h\n+#define dealii__read_write_vector_h\n+\n+#include <deal.II/base/config.h>\n+#include <deal.II/base/index_set.h>\n+#include <deal.II/base/mpi.h>\n+#include <deal.II/base/template_constraints.h>\n+#include <deal.II/base/types.h>\n+#include <deal.II/base/utilities.h>\n+#include <deal.II/base/memory_consumption.h>\n+#include <deal.II/base/thread_management.h>\n+#include <deal.II/lac/vector_view.h>\n+\n+#include <cstring>\n+#include <iomanip>\n+\n+\n+DEAL_II_NAMESPACE_OPEN\n+\n+#ifdef DEAL_II_WITH_PETSC\n+namespace PETScWrappers\n+{\n+  namespace MPI\n+  {\n+    class Vector;\n+  }\n+}\n+#endif\n+\n+#ifdef DEAL_II_WITH_TRILINOS\n+namespace TrilinosWrappers\n+{\n+  namespace MPI\n+  {\n+    class Vector;\n+  }\n+}\n+#endif\n+\n+namespace LinearAlgebra\n+{\n+  /*! @addtogroup Vectors\n+   *@{\n+   */\n+\n+  /**\n+   * ReadWriteVector stores a subset of all elements. It allows to access\n+   * individual elements to read or to write. However, it does not allow global\n+   * operations such as taking the norm. ReadWriteVector can be used to read and\n+   * write elements in vector derived from VectorSparceVector such as\n+   * TrilinosWrappers::MPI::Vector and PETScWrappers::MPI::Vector.\n+   *\n+   * @author Bruno Turcksin, Wolfgang Bangerth, 2015.\n+   */\n+  template <typename Number>\n+  class ReadWriteVector : public Subscriptor\n+  {\n+  public:\n+    /**\n+     * Declare standard types used in all containers. These types parallel\n+     * those in the <tt>C++</tt> standard libraries <tt>vector<...></tt>\n+     * class.\n+     */\n+    typedef Number                                            value_type;\n+    typedef value_type                                       *pointer;\n+    typedef const value_type                                 *const_pointer;\n+    typedef value_type                                       *iterator;\n+    typedef const value_type                                 *const_iterator;\n+    typedef value_type                                       &reference;\n+    typedef const value_type                                 &const_reference;\n+    typedef types::global_dof_index                           size_type;\n+    typedef typename numbers::NumberTraits<Number>::real_type real_type;\n+\n+    /**\n+     * @name 1: Basic Object-handling\n+     */\n+    //@{\n+    /**\n+     * Empty constructor.\n+     */\n+    ReadWriteVector ();\n+\n+    /**\n+     * Copy constructor.\n+     */\n+    ReadWriteVector (const ReadWriteVector<Number> &in_vector);\n+\n+    /**\n+     * Constructs a vector given the size, the stored elements have their index\n+     * in [0,size).\n+     */\n+    ReadWriteVector (const size_type size);\n+\n+    /**\n+     * Constructs a vector whose stored elements indices are given by an\n+     * IndexSet.\n+     */\n+    ReadWriteVector (const IndexSet &local_range);\n+\n+    /**\n+     * Destructor.\n+     */\n+    ~ReadWriteVector ();\n+\n+    /**\n+     * Sets the global size of the vector to @p size. The stored elements have\n+     * their index in [0,size).\n+     */\n+    void reinit (const size_type size,\n+                 const bool      fast = false);\n+\n+    /**\n+     * Uses the same IndexSet as the one of the input vector @p in_vector and\n+     * allocates memory for this vector.\n+     *\n+     * If the flag @p fast is set to false, the memory will be initialized\n+     * with zero, otherwise the memory will be untouched (and the user must\n+     * make sure to fill it with reasonable data before using it).\n+     */\n+    template <typename Number2>\n+    void reinit(const ReadWriteVector<Number2> &in_vector,\n+                const bool             fast = false);\n+\n+    /**\n+     * Initializes the vector. The indices are specified by @p local_range,\n+     */\n+    void reinit (const IndexSet &local_range);\n+\n+    /**\n+     * Swap the contents of this vector and the other vector @p v. One could\n+     * do this operation with a temporary variable and copying over the data\n+     * elements, but this function is significantly more efficient since it\n+     * only swaps the pointers to the data of the two vectors and therefore\n+     * does not need to allocate temporary storage and move data around.\n+     *\n+     * This function is analog to the the @p swap function of all C++\n+     * standard containers. Also, there is a global function\n+     * <tt>swap(u,v)</tt> that simply calls <tt>u.swap(v)</tt>, again in\n+     * analogy to standard functions.\n+     *\n+     * This function is virtual in order to allow for derived classes to\n+     * handle memory separately.\n+     */\n+    void swap (ReadWriteVector<Number> &v);\n+\n+    /**\n+     * Copies the data and the IndexSet of the input vector @p in_vector.\n+     */\n+    ReadWriteVector<Number> &\n+    operator = (const ReadWriteVector<Number> &in_vector);\n+\n+    /**\n+     * Copies the data and the IndexSet of the input vector @p in_vector.\n+     */\n+    template <typename Number2>\n+    ReadWriteVector<Number> &\n+    operator = (const ReadWriteVector<Number2> &in_vector);\n+\n+#ifdef DEAL_II_WITH_PETSC\n+    /**\n+     * Imports all the elements present in the vector's IndexSet from the input\n+     * vector @p petsc_vec.\n+     */\n+    ReadWriteVector<Number> &\n+    operator = (const PETScWrappers::MPI::Vector &petsc_vec);\n+#endif\n+\n+#ifdef DEAL_II_WITH_TRILINOS\n+    /**\n+     * Imports all the elements present in the vector's IndexSet from the input\n+     * vector @p trilinos_vec.\n+     */\n+    ReadWriteVector<Number> &\n+    operator = (const TrilinosWrappers::MPI::Vector &trilinos_vec);\n+#endif\n+\n+    /**\n+     * Sets all elements of the vector to the scalar @p s.\n+     */\n+    ReadWriteVector<Number> &operator = (const Number s);\n+\n+    /**\n+     * Returns the global size of the vector, equal to number of elements in\n+     * the vector.\n+     */\n+    size_type size () const;","path":"include/deal.II/lac/read_write_vector.h","position":201,"original_position":201,"commit_id":"e8ad4c4a52284cd23a67324ec47d1a37660df312","original_commit_id":"e8ad4c4a52284cd23a67324ec47d1a37660df312","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":"The comment should be clarified to make clear that it's not the elements that we store here, but the size of the index space.","created_at":"2015-09-06T22:09:58Z","updated_at":"2015-09-06T22:09:58Z","html_url":"https://github.com/dealii/dealii/pull/1514#discussion_r38826748","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/1514","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/38826748"},"html":{"href":"https://github.com/dealii/dealii/pull/1514#discussion_r38826748"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1514"}}},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/1514","id":44032494,"html_url":"https://github.com/dealii/dealii/pull/1514","diff_url":"https://github.com/dealii/dealii/pull/1514.diff","patch_url":"https://github.com/dealii/dealii/pull/1514.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/1514","number":1514,"state":"open","locked":false,"title":"New vector interfaces","user":{"login":"Rombur","id":368538,"avatar_url":"https://avatars.githubusercontent.com/u/368538?v=3","gravatar_id":"","url":"https://api.github.com/users/Rombur","html_url":"https://github.com/Rombur","followers_url":"https://api.github.com/users/Rombur/followers","following_url":"https://api.github.com/users/Rombur/following{/other_user}","gists_url":"https://api.github.com/users/Rombur/gists{/gist_id}","starred_url":"https://api.github.com/users/Rombur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rombur/subscriptions","organizations_url":"https://api.github.com/users/Rombur/orgs","repos_url":"https://api.github.com/users/Rombur/repos","events_url":"https://api.github.com/users/Rombur/events{/privacy}","received_events_url":"https://api.github.com/users/Rombur/received_events","type":"User","site_admin":false},"body":"This is a work-in-progress on #745. This code compiles but I would like people's opinion on the interface before continuing (don't look at the implementation for now). Do you like the name? Is the interface missing something important? This vector is not distributed so it will be a mess if someone tries to print the vector in parallel, is it OK? For performance reason, I have added a function that reorder the ranges in the IndexSet so that the largest range is first. This way, it is easier to work with local index instead of global index.","created_at":"2015-09-02T19:32:02Z","updated_at":"2015-09-06T22:09:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a894991e0852160d8c3ef1239b5f2c9dfeb92538","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/1514/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/1514/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/1514/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/e8ad4c4a52284cd23a67324ec47d1a37660df312","head":{"label":"Rombur:new-vector-interfaces","ref":"new-vector-interfaces","sha":"e8ad4c4a52284cd23a67324ec47d1a37660df312","user":{"login":"Rombur","id":368538,"avatar_url":"https://avatars.githubusercontent.com/u/368538?v=3","gravatar_id":"","url":"https://api.github.com/users/Rombur","html_url":"https://github.com/Rombur","followers_url":"https://api.github.com/users/Rombur/followers","following_url":"https://api.github.com/users/Rombur/following{/other_user}","gists_url":"https://api.github.com/users/Rombur/gists{/gist_id}","starred_url":"https://api.github.com/users/Rombur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rombur/subscriptions","organizations_url":"https://api.github.com/users/Rombur/orgs","repos_url":"https://api.github.com/users/Rombur/repos","events_url":"https://api.github.com/users/Rombur/events{/privacy}","received_events_url":"https://api.github.com/users/Rombur/received_events","type":"User","site_admin":false},"repo":{"id":22514795,"name":"dealii","full_name":"Rombur/dealii","owner":{"login":"Rombur","id":368538,"avatar_url":"https://avatars.githubusercontent.com/u/368538?v=3","gravatar_id":"","url":"https://api.github.com/users/Rombur","html_url":"https://github.com/Rombur","followers_url":"https://api.github.com/users/Rombur/followers","following_url":"https://api.github.com/users/Rombur/following{/other_user}","gists_url":"https://api.github.com/users/Rombur/gists{/gist_id}","starred_url":"https://api.github.com/users/Rombur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rombur/subscriptions","organizations_url":"https://api.github.com/users/Rombur/orgs","repos_url":"https://api.github.com/users/Rombur/repos","events_url":"https://api.github.com/users/Rombur/events{/privacy}","received_events_url":"https://api.github.com/users/Rombur/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rombur/dealii","description":"The development repository for the deal.II finite element library.","fork":true,"url":"https://api.github.com/repos/Rombur/dealii","forks_url":"https://api.github.com/repos/Rombur/dealii/forks","keys_url":"https://api.github.com/repos/Rombur/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rombur/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rombur/dealii/teams","hooks_url":"https://api.github.com/repos/Rombur/dealii/hooks","issue_events_url":"https://api.github.com/repos/Rombur/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/Rombur/dealii/events","assignees_url":"https://api.github.com/repos/Rombur/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/Rombur/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/Rombur/dealii/tags","blobs_url":"https://api.github.com/repos/Rombur/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rombur/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rombur/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rombur/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rombur/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/Rombur/dealii/languages","stargazers_url":"https://api.github.com/repos/Rombur/dealii/stargazers","contributors_url":"https://api.github.com/repos/Rombur/dealii/contributors","subscribers_url":"https://api.github.com/repos/Rombur/dealii/subscribers","subscription_url":"https://api.github.com/repos/Rombur/dealii/subscription","commits_url":"https://api.github.com/repos/Rombur/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rombur/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rombur/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rombur/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rombur/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/Rombur/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rombur/dealii/merges","archive_url":"https://api.github.com/repos/Rombur/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rombur/dealii/downloads","issues_url":"https://api.github.com/repos/Rombur/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/Rombur/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/Rombur/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/Rombur/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rombur/dealii/labels{/name}","releases_url":"https://api.github.com/repos/Rombur/dealii/releases{/id}","created_at":"2014-08-01T15:06:41Z","updated_at":"2015-05-05T18:58:09Z","pushed_at":"2015-09-03T23:35:07Z","git_url":"git://github.com/Rombur/dealii.git","ssh_url":"git@github.com:Rombur/dealii.git","clone_url":"https://github.com/Rombur/dealii.git","svn_url":"https://github.com/Rombur/dealii","homepage":"http://www.dealii.org/","size":124673,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":0,"forks":3,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dealii:master","ref":"master","sha":"cf03234963bd499b01936e3fbbcd57fb16fdbaaf","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}","created_at":"2014-07-17T14:00:26Z","updated_at":"2015-09-02T19:23:15Z","pushed_at":"2015-09-06T21:55:16Z","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":159726,"stargazers_count":82,"watchers_count":82,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":120,"forks":117,"open_issues":120,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1514"},"html":{"href":"https://github.com/dealii/dealii/pull/1514"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/1514"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/1514/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1514/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1514/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/e8ad4c4a52284cd23a67324ec47d1a37660df312"}}}}