Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_DependencySheet.cpp
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
11
12
13namespace Teuchos{
14
15
17 name_("DEP_ANONYMOUS")
18{}
19
20DependencySheet::DependencySheet(const std::string &name):
21 name_(name)
22{}
23
26 for(
27 Dependency::ConstParameterEntryList::iterator it = dependees.begin();
28 it != dependees.end();
29 ++it)
30 {
31 dependenciesMap_[*it].insert(dependency);
32 }
33 dependencies_.insert(dependency);
34}
35
38 for(
39 Dependency::ConstParameterEntryList::iterator it = dependees.begin();
40 it != dependees.end();
41 ++it)
42 {
43 dependenciesMap_[*it].erase(dependency);
44 }
45 dependencies_.erase(dependency);
46}
47
49 RCP<const ParameterEntry> dependee) const
50{
51 if(dependenciesMap_.find(dependee) != dependenciesMap_.end()){
52 return rcpFromRef(dependenciesMap_.find(dependee)->second);
53 }
54 return null;
55}
56
57void DependencySheet::printDeps(std::ostream& out) const {
58 out << "Dependency Sheet: " << name_ << std::endl << std::endl;
59 for(DepSet::const_iterator it = depBegin(); it != depEnd(); ++it){
60 (*it)->print(out);
61 }
62}
63
65 for(
66 DepSet::iterator it = otherSheet->depBegin();
67 it != otherSheet->depEnd();
68 ++it
69 )
70 {
72 }
73}
74
75
76} //namespace Teuchos
77
DataStructure keeping track of dependencies.
RCP< const DepSet > getDependenciesForParameter(RCP< const ParameterEntry > dependee) const
Returns a set of all the dependencies associated with a particular dependee. If no dependencies with ...
void printDeps(std::ostream &out) const
Prints out a list of the dependencies in the DependencySheet.
void addDependency(RCP< Dependency > dependency)
Adds a dependency to the sheet.
void removeDependency(RCP< Dependency > dependency)
Removes a particular dependency between two parameters.
DepSet::iterator depBegin()
Returns an iterator to the beginning of all the dependees in the sheet.
void addDependencies(RCP< DependencySheet > otherSheet)
Adds a dependencies from another she to this sheet.
DependencySheet()
Constructs an empty DependencySheet with the name DEP_ANONYMOUS.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
Smart reference counting pointer class for automatic garbage collection.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...