{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/45735615","id":45735615,"diff_hunk":"@@ -0,0 +1,529 @@\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+#include <deal.II/lac/trilinos_epetra_vector.h>\n+\n+#ifdef DEAL_II_WITH_TRILINOS\n+#ifdef DEAL_II_WITH_MPI\n+\n+#include <deal.II/base/index_set.h>\n+#include \"Epetra_Import.h\"\n+#include \"Epetra_Map.h\"\n+#include \"Epetra_MpiComm.h\"\n+\n+\n+DEAL_II_NAMESPACE_OPEN\n+\n+namespace LinearAlgebra\n+{\n+  namespace EpetraWrappers\n+  {\n+    Vector::Vector()\n+      :\n+      vector(new Epetra_FEVector(Epetra_Map(0,1,0,Epetra_MpiComm(MPI_COMM_SELF))))\n+    {}\n+\n+\n+\n+    Vector::Vector(const Vector &V)\n+      :\n+      vector(new Epetra_FEVector(V.trilinos_vector()))\n+    {}\n+\n+\n+\n+    Vector::Vector(const IndexSet &parallel_partitioner,\n+                   const MPI_Comm &communicator)\n+      :\n+      vector(new Epetra_FEVector(parallel_partitioner.make_trilinos_map(communicator,false)))\n+    {}\n+\n+\n+\n+    void Vector::reinit(const IndexSet &parallel_partitioner,\n+                        const MPI_Comm &communicator,\n+                        const bool      omit_zeroing_entries)\n+    {\n+      Epetra_Map input_map = parallel_partitioner.make_trilinos_map(communicator,false);\n+      if (vector->Map().SameAs(input_map)==false)\n+        vector.reset(new Epetra_FEVector(input_map));\n+      else if (omit_zeroing_entries==false)\n+        {\n+          const int ierr = vector->PutScalar(0.);\n+          (void) ierr;\n+          Assert(ierr==0, ExcTrilinosError(ierr));\n+        }\n+    }\n+\n+\n+\n+    Vector &Vector::operator= (const Vector &V)\n+    {\n+      // Distinguish three cases:\n+      //  - First case: both vectors have the same layout.\n+      //  - Second case: both vectors have the same size but different layout.\n+      //  - Third case: the vectors have different size.\n+      if (vector->Map().SameAs(V.trilinos_vector().Map()))\n+        *vector = V.trilinos_vector();\n+      else\n+        {\n+          if (size()==V.size())\n+            {\n+              Epetra_Import data_exchange(vector->Map(), V.trilinos_vector().Map());\n+\n+              const int ierr = vector->Import(V.trilinos_vector(), data_exchange, Insert);\n+              Assert(ierr==0, ExcTrilinosError(ierr));\n+            }\n+          else\n+            vector.reset(new Epetra_FEVector(V.trilinos_vector()));\n+        }\n+\n+      return *this;\n+    }\n+\n+\n+\n+    Vector &Vector::operator= (const ::dealii::LinearAlgebra::ReadWriteVector<double> &V)\n+    {\n+      IndexSet elements_to_write(V.get_stored_elements());\n+      IndexSet locally_owned_elements(this->locally_owned_elements());\n+      IndexSet off_proc_elements(elements_to_write);\n+      off_proc_elements.subtract_set(locally_owned_elements);\n+      IndexSet on_proc_elements(elements_to_write);\n+      on_proc_elements.subtract_set(off_proc_elements);\n+\n+      // Write the elements that locally owned.\n+      IndexSet::ElementIterator elem = on_proc_elements.begin(),\n+                                elem_end = on_proc_elements.end();\n+      for (; elem!=elem_end; ++elem)\n+        {\n+          const TrilinosWrappers::types::int_type local_index =\n+            vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(*elem));\n+          (*vector)[0][local_index] = V[*elem];\n+        }\n+\n+\n+      // Write the elements off-processor. Cannot use Import function of Trilinos","path":"source/lac/trilinos_epetra_vector.cc","position":118,"original_position":118,"commit_id":"ab57f929fbca2a5f459033bc7278efefe66db529","original_commit_id":"ab57f929fbca2a5f459033bc7278efefe66db529","user":{"login":"tjhei","id":1531285,"avatar_url":"https://avatars.githubusercontent.com/u/1531285?v=3","gravatar_id":"","url":"https://api.github.com/users/tjhei","html_url":"https://github.com/tjhei","followers_url":"https://api.github.com/users/tjhei/followers","following_url":"https://api.github.com/users/tjhei/following{/other_user}","gists_url":"https://api.github.com/users/tjhei/gists{/gist_id}","starred_url":"https://api.github.com/users/tjhei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjhei/subscriptions","organizations_url":"https://api.github.com/users/tjhei/orgs","repos_url":"https://api.github.com/users/tjhei/repos","events_url":"https://api.github.com/users/tjhei/events{/privacy}","received_events_url":"https://api.github.com/users/tjhei/received_events","type":"User","site_admin":false},"body":"I am sorry, when is this function used? If this is the code that gets executed after a normal assembly, we should try harder to make it scale. Is there functionality inside Trilinos we can use? How about you construct a Trilinos vector and copy the stuff from V into it before letting Trilinos do the communication?","created_at":"2015-11-24T13:39:25Z","updated_at":"2015-11-24T13:39:25Z","html_url":"https://github.com/dealii/dealii/pull/1901#discussion_r45735615","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/1901","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/45735615"},"html":{"href":"https://github.com/dealii/dealii/pull/1901#discussion_r45735615"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1901"}}},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/1901","id":51589235,"html_url":"https://github.com/dealii/dealii/pull/1901","diff_url":"https://github.com/dealii/dealii/pull/1901.diff","patch_url":"https://github.com/dealii/dealii/pull/1901.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/1901","number":1901,"state":"open","locked":false,"title":"Add EpetraWrappers::Vector.","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 commit adds the new Trilinos vector interface, it's derived from ```VectorSpaceVector```. It's in ```LinearAlgebra::EpetraWrappers::Vector``` because I will add Tpetra later on. Most functions are taken from the current implementation of ```TrilinosWrappers::MPI::Vector```. The most important new functions are ```EpetraWrappers::Vector operator= (ReadWriteVector)``` and ```ReadWriteVector operator= (EpetraWrappers::Vector)```.","created_at":"2015-11-23T22:21:26Z","updated_at":"2015-11-24T13:39:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4acc3fa0a9a2f3765e8d740c778d4877df6e780a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/1901/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/1901/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/1901/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/ab57f929fbca2a5f459033bc7278efefe66db529","head":{"label":"Rombur:epetra","ref":"epetra","sha":"ab57f929fbca2a5f459033bc7278efefe66db529","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-11-23T22:11:04Z","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":127638,"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":"5a6e373534ee6ae941ddbfd5415401152e8ea420","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-11-23T17:52:58Z","pushed_at":"2015-11-24T12:54:09Z","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":135045,"stargazers_count":106,"watchers_count":106,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":130,"mirror_url":null,"open_issues_count":141,"forks":130,"open_issues":141,"watchers":106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1901"},"html":{"href":"https://github.com/dealii/dealii/pull/1901"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/1901"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/1901/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1901/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1901/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/ab57f929fbca2a5f459033bc7278efefe66db529"}}}}