Skip to content
Snippets Groups Projects
Unverified Commit 2117ed10 authored by René Fritze's avatar René Fritze
Browse files

[visualization] add functor for partition type

parent e6930b15
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ struct ElementVisualization ...@@ -54,7 +54,7 @@ struct ElementVisualization
std::vector<double> values(mapper.size()); std::vector<double> values(mapper.size());
for (auto&& entity : elements(gridView)) { for (auto&& entity : elements(gridView)) {
values[mapper.map(entity)] = f(entity); values[mapper.index(entity)] = f(entity);
} }
Dune::VTKWriter<typename Grid::LeafGridView> vtkwriter(gridView); Dune::VTKWriter<typename Grid::LeafGridView> vtkwriter(gridView);
...@@ -208,6 +208,23 @@ struct ElementVisualization ...@@ -208,6 +208,23 @@ struct ElementVisualization
} }
}; };
class PartitionTypeFunctor : public FunctorBase
{
public:
PartitionTypeFunctor(const std::string fname, const std::string dname)
: FunctorBase(fname, dname)
{}
template <class Entity>
double operator()(const Entity& ent) const
{
const typename Entity::Geometry& geo = ent.geometry();
const int type{static_cast<int>(ent.partitionType())};
DXTC_LOG_ERROR << "TYPE " << type << std::endl;
return static_cast<double>(type);
}
};
//! supply functor //! supply functor
template <class Grid> template <class Grid>
static void all(const Grid& grid, const std::string outputDir = "visualisation") static void all(const Grid& grid, const std::string outputDir = "visualisation")
...@@ -218,6 +235,7 @@ struct ElementVisualization ...@@ -218,6 +235,7 @@ struct ElementVisualization
GeometryFunctor geometryFunctor("geometryFunctor", outputDir); GeometryFunctor geometryFunctor("geometryFunctor", outputDir);
ProcessIdFunctor processIdFunctor("ProcessIdFunctor", outputDir); ProcessIdFunctor processIdFunctor("ProcessIdFunctor", outputDir);
VolumeFunctor volumeFunctor("volumeFunctor", outputDir); VolumeFunctor volumeFunctor("volumeFunctor", outputDir);
PartitionTypeFunctor partitionTypeFunctor("partitionTypeFunctor", outputDir);
// call the visualization functions // call the visualization functions
elementdata(grid, boundaryFunctor); elementdata(grid, boundaryFunctor);
...@@ -225,6 +243,7 @@ struct ElementVisualization ...@@ -225,6 +243,7 @@ struct ElementVisualization
elementdata(grid, geometryFunctor); elementdata(grid, geometryFunctor);
elementdata(grid, processIdFunctor); elementdata(grid, processIdFunctor);
elementdata(grid, volumeFunctor); elementdata(grid, volumeFunctor);
elementdata(grid, partitionTypeFunctor);
} }
}; };
......
// This file is part of the dune-xt-grid project:
// https://github.com/dune-community/dune-xt-grid
// Copyright 2009-2018 dune-xt-grid developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Rene Milk (2018)
#include <dune/xt/common/test/main.hxx>
#include <dune/xt/grid/gridprovider/eoc.hh>
#include <dune/xt/grid/grids.hh>
#include <dune/xt/grid/output/entity_visualization.hh>
#include <dune/grid/uggrid.hh>
{% for name, type in config.all_grids %}
GTEST_TEST(GridProvider_{{name}}, layers)
{
using ProviderFactory = Dune::XT::Grid::GridProviderFactory<{{type}}>;
const auto type = ProviderFactory::available()[0];
const auto config = ProviderFactory::default_config(type);
auto global_provider = ProviderFactory::create(config, Dune::MPIHelper::getCommunicator());
auto& global_grid = global_provider.grid();
Dune::XT::Grid::ElementVisualization::all(global_grid, boost::filesystem::temp_directory_path().string());
}
{% endfor %}
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