{"action":"created","comment":{"url":"https://api.github.com/repos/idaholab/moose/pulls/comments/33986500","id":33986500,"diff_hunk":"@@ -15,49 +15,144 @@\n #ifndef DEPENDENCYRESOLVERINTERFACE_H\n #define DEPENDENCYRESOLVERINTERFACE_H\n \n+/// STL includes\n #include <string>\n #include <set>\n #include <iostream>\n #include <algorithm>\n \n+// MOOSE incluces\n+#include \"InputParameters.h\"\n #include \"DependencyResolver.h\"\n+#include \"MooseUtils.h\"\n \n+class DependencyResolverInterface;\n+\n+template<>\n+InputParameters validParams<DependencyResolverInterface>();\n+\n+/**\n+ * A class for sorting objects based on inter dependencies\n+ */\n class DependencyResolverInterface\n {\n public:\n-  DependencyResolverInterface() {}\n+  DependencyResolverInterface(){}\n \n+  /**\n+   * Return a list of items being requested by an object\n+   */\n   virtual const std::set<std::string> & getRequestedItems() = 0;\n+\n+  /**\n+   * Return a list of items that are owned by an object\n+   */\n   virtual const std::set<std::string> & getSuppliedItems() = 0;\n \n+  /**\n+   * Return a list of items that are iterable\n+   *\n+   * Iterable items are allowed to have cyclic dependencies, see the Material object\n+   * and test/tests/materials/recompute/recompute.i to see how this is utilized.\n+   */\n+  virtual const std::set<std::string> & getIterativeItems(){ return _empty_set; }\n+\n   template<typename Iter>\n   static\n-  void sort(Iter start, Iter end)\n+  void sort(Iter start, Iter end, bool iterative_warning = true, bool debug = false)\n   {\n     DependencyResolver<DependencyResolverInterface *> resolver;\n \n+    // Loop over each item to be sorted\n     for (Iter iter = start; iter != end ; ++iter)\n     {\n+\n+      // Extract the requested, supplied, and iterable items from the first object\n       const std::set<std::string> & requested_items = (*iter)->getRequestedItems();\n+      const std::set<std::string> & supplied_items = (*iter)->getSuppliedItems();\n+      const std::set<std::string> & iterative_items = (*iter)->getIterativeItems(); // see Materail.h\n \n+      // Loop over the objects again to allow all objects to be compared against each other\n       for (Iter iter2 = start; iter2 != end; ++iter2)\n       {\n+        // Do not compare the object to itself\n         if (iter == iter2) continue;\n-        const std::set<std::string> & supplied_items = (*iter2)->getSuppliedItems();\n \n+        // Extract the supplied and iterative items\n+        const std::set<std::string> & supplied_items2 = (*iter2)->getSuppliedItems();\n+        const std::set<std::string> & iterative_items2 = (*iter2)->getIterativeItems();\n+\n+        // Compute the intersection of the supplied from object 2 and requested items of object 1\n         std::set<std::string> intersect;\n-        std::set_intersection(requested_items.begin(), requested_items.end(), supplied_items.begin(),\n-                              supplied_items.end(), std::inserter(intersect, intersect.end()));\n+        std::set_intersection(requested_items.begin(), requested_items.end(), supplied_items2.begin(), supplied_items2.end(),\n+                              std::inserter(intersect, intersect.end()));\n+\n+        if (debug)\n+        {\n+          const std::set<std::string> & requested_items2 = (*iter)->getRequestedItems();\n+          Moose::out << COLOR_BLUE << (*iter)->name() << COLOR_DEFAULT << \" -> \" << COLOR_RED << (*iter2)->name() << COLOR_DEFAULT << std::endl;\n+          Moose::out << COLOR_BLUE << (*iter)->name() << '\\n';\n+          Moose::out << \"  supplied:\" << MooseUtils::dump(supplied_items) << '\\n';\n+          Moose::out << \" requested:\" << MooseUtils::dump(requested_items) << '\\n';\n+          Moose::out << \" iterative:\" << MooseUtils::dump(iterative_items) << \"\\n\";\n+          Moose::out << COLOR_RED << (*iter2)->name() << '\\n';\n+          Moose::out << \"  supplied:\" << MooseUtils::dump(supplied_items2) << '\\n';\n+          Moose::out << \" requested:\" << MooseUtils::dump(requested_items2) << '\\n';\n+          Moose::out << \" iterative:\" << MooseUtils::dump(iterative_items2) << COLOR_DEFAULT << \"\\n\\n\";\n+        }\n \n-        // If the intersection isn't empty then there is a dependency here\n+        // If the intersection is NOT empty then there is a dependency between the objects\n         if (!intersect.empty())\n-          resolver.insertDependency(*iter, *iter2);\n+        {\n+\n+          // Compute the intersection between the supplied from object 1 and the iterative items from object 2\n+          std::set<std::string> iterative_intersect;\n+          std::set_intersection(supplied_items.begin(), supplied_items.end(), iterative_items2.begin(), iterative_items2.end(),\n+                                std::inserter(iterative_intersect, iterative_intersect.begin()));\n+\n+          // There is an allowable dependency if the intersection with iterative items contains values\n+          if (!iterative_intersect.empty())\n+          {\n+\n+            // Compute difference between the supplied items and the items that are marked as iterable on the other object\n+            std::set<std::string> iterative_diff;","path":"framework/include/base/DependencyResolverInterface.h","position":111,"original_position":111,"commit_id":"ce07e901b9058d08590841eef0f6229bc0bcef54","original_commit_id":"ce07e901b9058d08590841eef0f6229bc0bcef54","user":{"login":"permcody","id":3036960,"avatar_url":"https://avatars.githubusercontent.com/u/3036960?v=3","gravatar_id":"","url":"https://api.github.com/users/permcody","html_url":"https://github.com/permcody","followers_url":"https://api.github.com/users/permcody/followers","following_url":"https://api.github.com/users/permcody/following{/other_user}","gists_url":"https://api.github.com/users/permcody/gists{/gist_id}","starred_url":"https://api.github.com/users/permcody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/permcody/subscriptions","organizations_url":"https://api.github.com/users/permcody/orgs","repos_url":"https://api.github.com/users/permcody/repos","events_url":"https://api.github.com/users/permcody/events{/privacy}","received_events_url":"https://api.github.com/users/permcody/received_events","type":"User","site_admin":false},"body":"You could check the flag before building the difference.","created_at":"2015-07-06T21:47:31Z","updated_at":"2015-07-06T21:47:31Z","html_url":"https://github.com/idaholab/moose/pull/5226#discussion_r33986500","pull_request_url":"https://api.github.com/repos/idaholab/moose/pulls/5226","_links":{"self":{"href":"https://api.github.com/repos/idaholab/moose/pulls/comments/33986500"},"html":{"href":"https://github.com/idaholab/moose/pull/5226#discussion_r33986500"},"pull_request":{"href":"https://api.github.com/repos/idaholab/moose/pulls/5226"}}},"pull_request":{"url":"https://api.github.com/repos/idaholab/moose/pulls/5226","id":37412594,"html_url":"https://github.com/idaholab/moose/pull/5226","diff_url":"https://github.com/idaholab/moose/pull/5226.diff","patch_url":"https://github.com/idaholab/moose/pull/5226.patch","issue_url":"https://api.github.com/repos/idaholab/moose/issues/5226","number":5226,"state":"open","locked":false,"title":"Adds ability to iterate material properties","user":{"login":"aeslaughter","id":341333,"avatar_url":"https://avatars.githubusercontent.com/u/341333?v=3","gravatar_id":"","url":"https://api.github.com/users/aeslaughter","html_url":"https://github.com/aeslaughter","followers_url":"https://api.github.com/users/aeslaughter/followers","following_url":"https://api.github.com/users/aeslaughter/following{/other_user}","gists_url":"https://api.github.com/users/aeslaughter/gists{/gist_id}","starred_url":"https://api.github.com/users/aeslaughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeslaughter/subscriptions","organizations_url":"https://api.github.com/users/aeslaughter/orgs","repos_url":"https://api.github.com/users/aeslaughter/repos","events_url":"https://api.github.com/users/aeslaughter/events{/privacy}","received_events_url":"https://api.github.com/users/aeslaughter/received_events","type":"User","site_admin":false},"body":"(closes #5166)","created_at":"2015-06-10T22:41:18Z","updated_at":"2015-07-06T21:47:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be09fc0d25053b307e305701f74f52a5c23cf800","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/idaholab/moose/pulls/5226/commits","review_comments_url":"https://api.github.com/repos/idaholab/moose/pulls/5226/comments","review_comment_url":"https://api.github.com/repos/idaholab/moose/pulls/comments{/number}","comments_url":"https://api.github.com/repos/idaholab/moose/issues/5226/comments","statuses_url":"https://api.github.com/repos/idaholab/moose/statuses/ce07e901b9058d08590841eef0f6229bc0bcef54","head":{"label":"aeslaughter:recompute-5166","ref":"recompute-5166","sha":"ce07e901b9058d08590841eef0f6229bc0bcef54","user":{"login":"aeslaughter","id":341333,"avatar_url":"https://avatars.githubusercontent.com/u/341333?v=3","gravatar_id":"","url":"https://api.github.com/users/aeslaughter","html_url":"https://github.com/aeslaughter","followers_url":"https://api.github.com/users/aeslaughter/followers","following_url":"https://api.github.com/users/aeslaughter/following{/other_user}","gists_url":"https://api.github.com/users/aeslaughter/gists{/gist_id}","starred_url":"https://api.github.com/users/aeslaughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeslaughter/subscriptions","organizations_url":"https://api.github.com/users/aeslaughter/orgs","repos_url":"https://api.github.com/users/aeslaughter/repos","events_url":"https://api.github.com/users/aeslaughter/events{/privacy}","received_events_url":"https://api.github.com/users/aeslaughter/received_events","type":"User","site_admin":false},"repo":{"id":17844840,"name":"moose","full_name":"aeslaughter/moose","owner":{"login":"aeslaughter","id":341333,"avatar_url":"https://avatars.githubusercontent.com/u/341333?v=3","gravatar_id":"","url":"https://api.github.com/users/aeslaughter","html_url":"https://github.com/aeslaughter","followers_url":"https://api.github.com/users/aeslaughter/followers","following_url":"https://api.github.com/users/aeslaughter/following{/other_user}","gists_url":"https://api.github.com/users/aeslaughter/gists{/gist_id}","starred_url":"https://api.github.com/users/aeslaughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeslaughter/subscriptions","organizations_url":"https://api.github.com/users/aeslaughter/orgs","repos_url":"https://api.github.com/users/aeslaughter/repos","events_url":"https://api.github.com/users/aeslaughter/events{/privacy}","received_events_url":"https://api.github.com/users/aeslaughter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aeslaughter/moose","description":"Multiphysics Object Oriented Simulation Environment","fork":true,"url":"https://api.github.com/repos/aeslaughter/moose","forks_url":"https://api.github.com/repos/aeslaughter/moose/forks","keys_url":"https://api.github.com/repos/aeslaughter/moose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aeslaughter/moose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aeslaughter/moose/teams","hooks_url":"https://api.github.com/repos/aeslaughter/moose/hooks","issue_events_url":"https://api.github.com/repos/aeslaughter/moose/issues/events{/number}","events_url":"https://api.github.com/repos/aeslaughter/moose/events","assignees_url":"https://api.github.com/repos/aeslaughter/moose/assignees{/user}","branches_url":"https://api.github.com/repos/aeslaughter/moose/branches{/branch}","tags_url":"https://api.github.com/repos/aeslaughter/moose/tags","blobs_url":"https://api.github.com/repos/aeslaughter/moose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aeslaughter/moose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aeslaughter/moose/git/refs{/sha}","trees_url":"https://api.github.com/repos/aeslaughter/moose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aeslaughter/moose/statuses/{sha}","languages_url":"https://api.github.com/repos/aeslaughter/moose/languages","stargazers_url":"https://api.github.com/repos/aeslaughter/moose/stargazers","contributors_url":"https://api.github.com/repos/aeslaughter/moose/contributors","subscribers_url":"https://api.github.com/repos/aeslaughter/moose/subscribers","subscription_url":"https://api.github.com/repos/aeslaughter/moose/subscription","commits_url":"https://api.github.com/repos/aeslaughter/moose/commits{/sha}","git_commits_url":"https://api.github.com/repos/aeslaughter/moose/git/commits{/sha}","comments_url":"https://api.github.com/repos/aeslaughter/moose/comments{/number}","issue_comment_url":"https://api.github.com/repos/aeslaughter/moose/issues/comments{/number}","contents_url":"https://api.github.com/repos/aeslaughter/moose/contents/{+path}","compare_url":"https://api.github.com/repos/aeslaughter/moose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aeslaughter/moose/merges","archive_url":"https://api.github.com/repos/aeslaughter/moose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aeslaughter/moose/downloads","issues_url":"https://api.github.com/repos/aeslaughter/moose/issues{/number}","pulls_url":"https://api.github.com/repos/aeslaughter/moose/pulls{/number}","milestones_url":"https://api.github.com/repos/aeslaughter/moose/milestones{/number}","notifications_url":"https://api.github.com/repos/aeslaughter/moose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aeslaughter/moose/labels{/name}","releases_url":"https://api.github.com/repos/aeslaughter/moose/releases{/id}","created_at":"2014-03-17T21:59:32Z","updated_at":"2015-05-06T17:04:39Z","pushed_at":"2015-07-06T20:38:13Z","git_url":"git://github.com/aeslaughter/moose.git","ssh_url":"git@github.com:aeslaughter/moose.git","clone_url":"https://github.com/aeslaughter/moose.git","svn_url":"https://github.com/aeslaughter/moose","homepage":null,"size":116500,"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":"devel"}},"base":{"label":"idaholab:devel","ref":"devel","sha":"49ae899c639b47ef6f6ff7cd27e46945480e2252","user":{"login":"idaholab","id":3855370,"avatar_url":"https://avatars.githubusercontent.com/u/3855370?v=3","gravatar_id":"","url":"https://api.github.com/users/idaholab","html_url":"https://github.com/idaholab","followers_url":"https://api.github.com/users/idaholab/followers","following_url":"https://api.github.com/users/idaholab/following{/other_user}","gists_url":"https://api.github.com/users/idaholab/gists{/gist_id}","starred_url":"https://api.github.com/users/idaholab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idaholab/subscriptions","organizations_url":"https://api.github.com/users/idaholab/orgs","repos_url":"https://api.github.com/users/idaholab/repos","events_url":"https://api.github.com/users/idaholab/events{/privacy}","received_events_url":"https://api.github.com/users/idaholab/received_events","type":"Organization","site_admin":false},"repo":{"id":16851223,"name":"moose","full_name":"idaholab/moose","owner":{"login":"idaholab","id":3855370,"avatar_url":"https://avatars.githubusercontent.com/u/3855370?v=3","gravatar_id":"","url":"https://api.github.com/users/idaholab","html_url":"https://github.com/idaholab","followers_url":"https://api.github.com/users/idaholab/followers","following_url":"https://api.github.com/users/idaholab/following{/other_user}","gists_url":"https://api.github.com/users/idaholab/gists{/gist_id}","starred_url":"https://api.github.com/users/idaholab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idaholab/subscriptions","organizations_url":"https://api.github.com/users/idaholab/orgs","repos_url":"https://api.github.com/users/idaholab/repos","events_url":"https://api.github.com/users/idaholab/events{/privacy}","received_events_url":"https://api.github.com/users/idaholab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/idaholab/moose","description":"Multiphysics Object Oriented Simulation Environment","fork":false,"url":"https://api.github.com/repos/idaholab/moose","forks_url":"https://api.github.com/repos/idaholab/moose/forks","keys_url":"https://api.github.com/repos/idaholab/moose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idaholab/moose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idaholab/moose/teams","hooks_url":"https://api.github.com/repos/idaholab/moose/hooks","issue_events_url":"https://api.github.com/repos/idaholab/moose/issues/events{/number}","events_url":"https://api.github.com/repos/idaholab/moose/events","assignees_url":"https://api.github.com/repos/idaholab/moose/assignees{/user}","branches_url":"https://api.github.com/repos/idaholab/moose/branches{/branch}","tags_url":"https://api.github.com/repos/idaholab/moose/tags","blobs_url":"https://api.github.com/repos/idaholab/moose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idaholab/moose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idaholab/moose/git/refs{/sha}","trees_url":"https://api.github.com/repos/idaholab/moose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idaholab/moose/statuses/{sha}","languages_url":"https://api.github.com/repos/idaholab/moose/languages","stargazers_url":"https://api.github.com/repos/idaholab/moose/stargazers","contributors_url":"https://api.github.com/repos/idaholab/moose/contributors","subscribers_url":"https://api.github.com/repos/idaholab/moose/subscribers","subscription_url":"https://api.github.com/repos/idaholab/moose/subscription","commits_url":"https://api.github.com/repos/idaholab/moose/commits{/sha}","git_commits_url":"https://api.github.com/repos/idaholab/moose/git/commits{/sha}","comments_url":"https://api.github.com/repos/idaholab/moose/comments{/number}","issue_comment_url":"https://api.github.com/repos/idaholab/moose/issues/comments{/number}","contents_url":"https://api.github.com/repos/idaholab/moose/contents/{+path}","compare_url":"https://api.github.com/repos/idaholab/moose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idaholab/moose/merges","archive_url":"https://api.github.com/repos/idaholab/moose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idaholab/moose/downloads","issues_url":"https://api.github.com/repos/idaholab/moose/issues{/number}","pulls_url":"https://api.github.com/repos/idaholab/moose/pulls{/number}","milestones_url":"https://api.github.com/repos/idaholab/moose/milestones{/number}","notifications_url":"https://api.github.com/repos/idaholab/moose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idaholab/moose/labels{/name}","releases_url":"https://api.github.com/repos/idaholab/moose/releases{/id}","created_at":"2014-02-14T22:26:15Z","updated_at":"2015-07-04T23:08:59Z","pushed_at":"2015-07-06T20:52:58Z","git_url":"git://github.com/idaholab/moose.git","ssh_url":"git@github.com:idaholab/moose.git","clone_url":"https://github.com/idaholab/moose.git","svn_url":"https://github.com/idaholab/moose","homepage":"http://www.mooseframework.org","size":128746,"stargazers_count":88,"watchers_count":88,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":142,"mirror_url":null,"open_issues_count":478,"forks":142,"open_issues":478,"watchers":88,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/idaholab/moose/pulls/5226"},"html":{"href":"https://github.com/idaholab/moose/pull/5226"},"issue":{"href":"https://api.github.com/repos/idaholab/moose/issues/5226"},"comments":{"href":"https://api.github.com/repos/idaholab/moose/issues/5226/comments"},"review_comments":{"href":"https://api.github.com/repos/idaholab/moose/pulls/5226/comments"},"review_comment":{"href":"https://api.github.com/repos/idaholab/moose/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/idaholab/moose/pulls/5226/commits"},"statuses":{"href":"https://api.github.com/repos/idaholab/moose/statuses/ce07e901b9058d08590841eef0f6229bc0bcef54"}}}}