Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
d648e04f
Commit
d648e04f
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
New method HasStateBlocks::perturb()
parent
eefbe5d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!345
Resolve "StateBlock perturbation helper function for gtests"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/state_block/has_state_blocks.h
+4
-1
4 additions, 1 deletion
include/core/state_block/has_state_blocks.h
src/state_block/has_state_blocks.cpp
+9
-0
9 additions, 0 deletions
src/state_block/has_state_blocks.cpp
with
13 additions
and
1 deletion
include/core/state_block/has_state_blocks.h
+
4
−
1
View file @
d648e04f
...
@@ -68,6 +68,10 @@ class HasStateBlocks
...
@@ -68,6 +68,10 @@ class HasStateBlocks
unsigned
int
getSize
()
const
;
unsigned
int
getSize
()
const
;
unsigned
int
getLocalSize
()
const
;
unsigned
int
getLocalSize
()
const
;
// Perturb state
void
perturb
(
double
amplitude
=
0.01
);
private
:
private
:
std
::
string
structure_
;
std
::
string
structure_
;
std
::
unordered_map
<
std
::
string
,
StateBlockPtr
>
state_block_map_
;
std
::
unordered_map
<
std
::
string
,
StateBlockPtr
>
state_block_map_
;
...
@@ -251,6 +255,5 @@ inline unsigned int HasStateBlocks::getLocalSize() const
...
@@ -251,6 +255,5 @@ inline unsigned int HasStateBlocks::getLocalSize() const
return
size
;
return
size
;
}
}
}
// namespace wolf
}
// namespace wolf
#endif
/* STATE_BLOCK_HAS_STATE_BLOCKS_H_ */
#endif
/* STATE_BLOCK_HAS_STATE_BLOCKS_H_ */
This diff is collapsed.
Click to expand it.
src/state_block/has_state_blocks.cpp
+
9
−
0
View file @
d648e04f
...
@@ -44,5 +44,14 @@ void HasStateBlocks::removeStateBlocks(ProblemPtr _problem)
...
@@ -44,5 +44,14 @@ void HasStateBlocks::removeStateBlocks(ProblemPtr _problem)
}
}
}
}
void
HasStateBlocks
::
perturb
(
double
amplitude
)
{
for
(
const
auto
&
pair_key_sb
:
state_block_map_
)
{
auto
&
sb
=
pair_key_sb
.
second
;
if
(
!
sb
->
isFixed
())
sb
->
perturb
(
amplitude
);
}
}
}
}
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