Skip to content
Snippets Groups Projects
Commit d648e04f authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

New method HasStateBlocks::perturb()

parent eefbe5d6
No related branches found
No related tags found
1 merge request!345Resolve "StateBlock perturbation helper function for gtests"
This commit is part of merge request !345. Comments created here will be created in the context of that merge request.
......@@ -68,6 +68,10 @@ class HasStateBlocks
unsigned int getSize() const;
unsigned int getLocalSize() const;
// Perturb state
void perturb(double amplitude = 0.01);
private:
std::string structure_;
std::unordered_map<std::string, StateBlockPtr> state_block_map_;
......@@ -251,6 +255,5 @@ inline unsigned int HasStateBlocks::getLocalSize() const
return size;
}
} // namespace wolf
#endif /* STATE_BLOCK_HAS_STATE_BLOCKS_H_ */
......@@ -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);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment