14#ifndef PLASK__FILTER__BASE_H
15#define PLASK__FILTER__BASE_H
20#include "../solver.hpp"
21#include "../provider/providerfor.hpp"
26template <
typename PropertyT, PropertyType propertyType,
typename OutputSpaceType,
typename VariadicTemplateTypesHolder>
28 static_assert(propertyType !=
SINGLE_VALUE_PROPERTY,
"space change filter data sources can't be use with single value properties (it can be use only with fields properties)");
85 template <
typename T,
template <std::size_t...>
class I, std::size_t...
Indices>
87 return this->operator()(dst_mesh, std::get<Indices>(std::forward<T>(t))..., method);
141 virtual size_t size()
const = 0;
149 template <
typename T,
template <std::size_t...>
class I, std::size_t...
Indices>
151 return this->operator()(dst_mesh, std::get<Indices>(std::forward<T>(t))..., method);
154 template <
typename T,
template <std::size_t...>
class I, std::size_t...
Indices>
156 return this->operator()(num, dst_mesh, std::get<Indices>(std::forward<T>(t))..., method);
161template <
typename PropertyT,
typename OutputSpaceType>
177template <
typename PropertyT,
typename OutputSpaceType,
typename InputSpaceType = OutputSpaceType,
typename OutputGeomObj = OutputSpaceType,
typename InputGeomObj = InputSpaceType>
192 in.providerValueChanged.connect(
241template <
typename PropertyT,
typename OutputSpaceType,
typename InputSpaceType = OutputSpaceType,
typename OutputGeomObj = OutputSpaceType,
typename InputGeomObj = InputSpaceType>
264 if (r.inGeomBB.contains(p))
return &r;
269 for (std::size_t i = 0; i <
regions.size(); ++i)
270 if (
regions[i].inGeomBB.contains(p))
return i;
277 template <
typename Predicate>
280 if (r.inGeomBB.contains(p) &&
pred(r))
285 template <
typename Predicate>
287 for (std::size_t i = 0; i <
regions.size(); ++i)
297 throw plask::Exception(
"filter error: the place of some source geometry inside a destination geometry can't be described by translation.\nThis can be caused by flip or mirror on the path from the source to the destination.");
300 for (std::size_t i = 0; i < pos.size(); ++i)
301 regions.emplace_back(bb[i], pos[i]);
326template <
typename PropertyT,
typename OutputSpaceType,
typename InputSpaceType = OutputSpaceType,
typename OutputGeomObj = OutputSpaceType,
typename InputGeomObj = InputSpaceType>
332 std::vector<Vec<InputGeomObj::DIM, double>> pos = this->
inputObj->getObjectPositions(*this->
outputObj, this->
getPath());
333 if (pos.size() != 1)
throw Exception(
"inner output geometry object has not unambiguous position in outer input geometry object.");
340template <
typename PropertyT, PropertyType propertyType,
typename OutputSpaceType,
typename VariadicTemplateTypesHolder>
343 "filter data sources can't be used with value properties (it can be used only with field properties)");
348 :
public DataSource<PropertyT, OutputSpaceType> {
360 return [=](std::size_t) {
return value; };
367 :
public DataSource<PropertyT, OutputSpaceType> {
379 return [=](std::size_t) {
return value; };
382 size_t size()
const override {
return 1; }
385template <
typename PropertyT,
typename OutputSpaceType>