Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
1cfee3b1
Commit
1cfee3b1
authored
4 years ago
by
Christoph Kampmeyer
Browse files
Options
Downloads
Patches
Plain Diff
wip #107: Some notes on implementation options
parent
df24f301
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/src/StatusAggregator.cc
+25
-12
25 additions, 12 deletions
Modules/src/StatusAggregator.cc
with
25 additions
and
12 deletions
Modules/src/StatusAggregator.cc
+
25
−
12
View file @
1cfee3b1
...
@@ -23,6 +23,7 @@ namespace ChimeraTK {
...
@@ -23,6 +23,7 @@ namespace ChimeraTK {
std
::
list
<
Module
*>
allSubmodules
;
std
::
list
<
Module
*>
allSubmodules
;
if
(
pathWithoutAppAndLeafNode
==
getName
())
{
if
(
pathWithoutAppAndLeafNode
==
getName
())
{
// Path to this module, the parent is the Application
// Path to this module, the parent is the Application
//FIXME Not using getAccessorListRecursive here, yet, because it crashes
allAccessors
=
virtualisedApplication
.
getAccessorList
();
allAccessors
=
virtualisedApplication
.
getAccessorList
();
allSubmodules
=
virtualisedApplication
.
getSubmoduleList
();
allSubmodules
=
virtualisedApplication
.
getSubmoduleList
();
}
}
...
@@ -32,29 +33,40 @@ namespace ChimeraTK {
...
@@ -32,29 +33,40 @@ namespace ChimeraTK {
virtualParent
.
dump
();
virtualParent
.
dump
();
allAccessors
=
virtualParent
.
getAccessorList
();
allAccessors
=
virtualParent
.
getAccessorList
Recursive
();
allSubmodules
=
virtualParent
.
getSubmoduleList
();
allSubmodules
=
virtualParent
.
getSubmoduleList
();
}
}
std
::
cout
<<
" Size of allAccessors: "
<<
allAccessors
.
size
()
<<
std
::
endl
;
std
::
cout
<<
" Size of allAccessors: "
<<
allAccessors
.
size
()
<<
std
::
endl
;
std
::
cout
<<
" Size of allSubmodules: "
<<
allSubmodules
.
size
()
<<
std
::
endl
;
std
::
cout
<<
" Size of allSubmodules: "
<<
allSubmodules
.
size
()
<<
std
::
endl
;
//
Two a
pproaches to get the modules of interest to feed to scanAndPopulateFromHierarchyLeve:
//
A
pproaches to get the modules of interest to feed to scanAndPopulateFromHierarchyLeve:
// 1. directly call getSubmoduleList on each level: gives VirtualModules and the dynamic_casts below fail
// 1. directly call getSubmoduleList on each level: gives VirtualModules and the dynamic_casts below fail
// 2.use getAccessorList and call getOwningModule() on each Accessor (as done below): Does not find the status outputs right now
// 2.use getAccessorList and call getOwningModule() on each Accessor (as done below): Does not find the status outputs right now
// Also, this means more effort to detect and recurse into ModuleGroups
// because Also, this means more effort to detect and recurse into ModuleGroups
//for(auto acc : allAccessors) {
// 3. Use getAccessorListRecursive to get all underlying accessors and call getOwningModule() on those (see commented code below).
//if(acc.getDirection().dir == VariableDirection::feeding) {
// Works, but makes level-per-level processing harder, e.g, where to stop if we found another aggregator on a branch below
//std::cout << " -- Accessor: " << acc.getName() << " of module: " << acc.getOwningModule()->getName()
// for(auto acc : virtualisedApplication.getAccessorListRecursive()) {
//<< std::endl;
// if(acc.getDirection().dir == VariableDirection::feeding) {
//}
// std::cout << " -- Accessor: " << acc.getName() << " of module: " << acc.getOwningModule()->getName()
// << std::endl;
// }
// }
// 4. Combine 1. and 2. to get the non-virtual modules per virtual level, see below:
// for(auto module : allSubmodules) {
// auto accessors = module->getAccessorList();
// for(auto acc : accessors)
// if(acc.getDirection().dir == VariableDirection::feeding) {
// std::cout << " -- Accessor: " << acc.getName() << " of module: " << acc.getOwningModule()->getName()
// << std::endl;
// }
// }
scanAndPopulateFromHierarchyLevel
(
allAccessors
);
scanAndPopulateFromHierarchyLevel
(
allAccessors
);
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
}
// poplateStatusInput()*/
}
// poplateStatusInput()*/
void
StatusAggregator
::
scanAndPopulateFromHierarchyLevel
(
std
::
list
<
VariableNetworkNode
>
nodes
)
{
void
StatusAggregator
::
scanAndPopulateFromHierarchyLevel
(
std
::
list
<
VariableNetworkNode
>
nodes
)
{
if
(
nodes
.
empty
())
{
if
(
nodes
.
empty
())
{
return
;
return
;
...
@@ -69,19 +81,18 @@ namespace ChimeraTK {
...
@@ -69,19 +81,18 @@ namespace ChimeraTK {
// 2. Iterate over instancesToBeAggregated and add to statusInput
// 2. Iterate over instancesToBeAggregated and add to statusInput
for
(
auto
node
:
nodes
)
{
for
(
auto
node
:
nodes
)
{
// Only check feeding nodes to test each Module only once on the status output
// Only check feeding nodes to test each Module only once on the status output
if
(
node
.
getDirection
().
dir
!=
VariableDirection
::
feeding
){
if
(
node
.
getDirection
().
dir
!=
VariableDirection
::
feeding
)
{
continue
;
continue
;
}
}
auto
module
{
node
.
getOwningModule
()};
auto
module
{
node
.
getOwningModule
()};
std
::
cout
<<
"Scanning Module "
<<
module
->
getName
()
<<
std
::
endl
;
std
::
cout
<<
"Scanning Module "
<<
module
->
getName
()
<<
std
::
endl
;
if
(
dynamic_cast
<
StatusMonitor
*>
(
module
))
{
if
(
dynamic_cast
<
StatusMonitor
*>
(
module
))
{
std
::
cout
<<
" Found Monitor "
<<
module
->
getName
()
<<
std
::
endl
;
std
::
cout
<<
" Found Monitor "
<<
module
->
getName
()
<<
std
::
endl
;
}
}
else
if
(
dynamic_cast
<
StatusAggregator
*>
(
module
))
{
else
if
(
dynamic_cast
<
StatusAggregator
*>
(
module
))
{
std
::
string
moduleName
=
module
->
getName
();
std
::
string
moduleName
=
module
->
getName
();
if
(
statusAggregatorFound
){
if
(
statusAggregatorFound
)
{
throw
ChimeraTK
::
logic_error
(
"StatusAggregator: A second instance was found on the same hierarchy level."
);
throw
ChimeraTK
::
logic_error
(
"StatusAggregator: A second instance was found on the same hierarchy level."
);
}
}
statusAggregatorFound
=
true
;
statusAggregatorFound
=
true
;
...
@@ -96,6 +107,8 @@ namespace ChimeraTK {
...
@@ -96,6 +107,8 @@ namespace ChimeraTK {
scanAndPopulateFromHierarchyLevel
(
module
->
getAccessorList
());
scanAndPopulateFromHierarchyLevel
(
module
->
getAccessorList
());
}
}
else
{
else
{
//FIXME (wip) Some warning if a module could not be properly classified
std
::
cout
<<
"StatusAggregator WARNING: Module"
<<
module
->
getName
()
<<
" was not detected."
<<
std
::
endl
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment