Commit 0cffdd69 authored by Lukas Riedel's avatar Lukas Riedel

Apply slight improvements

* Use InvalidStateException in 'verify_cache'
* Add warning to GridMapper for not load-balancing the grid manually
* Improve docstrings of parameterization test
* Use faster operator[] in FlowParameters::bind
parent 0c1c236e
......@@ -84,7 +84,8 @@ private:
void verify_cache () const
{
if (not std::get<std::shared_ptr<Parameterization>>(_cache)) {
DUNE_THROW(Dune::Exception, "No parameterization cached. "
DUNE_THROW(Dune::InvalidStateException,
"No parameterization cached. "
<< "Call 'bind' before accessing the parameterization.");
}
}
......@@ -133,7 +134,7 @@ public:
entity = entity.father();
}
const auto index = _mapper.index(entity);
_cache = _param.at(index);
_cache = _param[index];
}
/// Return a scaled version of the Conductivity function
......
......@@ -9,7 +9,7 @@ namespace Dune {
namespace Dorie {
/// A class for managing local grid mappings and data load balancing.
/**
/** \warning Do not load-balance the grid manually when using this mapper!
* \tparam Grid Type of the grid
*/
template<typename Grid>
......@@ -207,7 +207,7 @@ private:
auto size = id_map.size();
comm.broadcast(&size, 1, 0);
// build two vectors from keys and valuses and fill them
// build two vectors from keys and values and fill them
std::vector<IdType> ids;
std::vector<int> values;
for (auto&& [id, value] : id_map) {
......
......@@ -43,11 +43,10 @@ bool compare_maps (const MapA& map_a, const MapB& map_b)
return true;
}
/// A test for comparing the new paramter data structure with the old one.
/** The test relies on the data being read in by the old parameterization
* structures, and transferred to the new ones. This currently happens in the
* Simulation. The test compares queries the paramterization at random points
* on the grid and compares the result.
/// A test for verifying results of the new paramter data structure.
/** This checks if certain values of the parameterization functions coincide
* with the parameters inserted, checks the parameters itself, and verifies
* parameter manipulation.
*/
template <typename Traits>
class ParameterizationTest :
......@@ -73,6 +72,11 @@ public:
_helper)
{ }
/// Test the parameters and parameterization functions
/** The standard parameters for Sand and Silt are hardcoded here.
* We check the actual values and then the return values of the
* parameterization fuctions.
*/
void test_new_parameters ()
{
// define parameter sets to check against
......@@ -120,6 +124,10 @@ public:
}
}
/// Check if parameters can be manipulated
/** Manipulate parameters using the `parameters()` map or
* a dynamic cast to the derived class.
*/
void test_parameter_manipulation ()
{
auto par = std::get<std::shared_ptr<RP>>(this->fparam->cache());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment