33 template<
class TSparseSpace,
class TDenseSpace>
34 inline void UpdateInterfaceWithoutArgs(Mapper<TSparseSpace, TDenseSpace>&
dummy)
37 double dummy_search_radius = -1.0f;
38 dummy.UpdateInterface(dummy_flags, dummy_search_radius);
41 template<
class TSparseSpace,
class TDenseSpace>
42 inline void UpdateInterfaceWithOptions(Mapper<TSparseSpace, TDenseSpace>&
dummy,
Kratos::Flags options)
44 double dummy_search_radius = -1.0f;
45 dummy.UpdateInterface(options, dummy_search_radius);
48 template<
class TSparseSpace,
class TDenseSpace>
49 inline void UpdateInterfaceWithSearchRadius(Mapper<TSparseSpace, TDenseSpace>&
dummy,
double search_radius)
52 dummy.UpdateInterface(dummy_flags, search_radius);
56 template<
class TSparseSpace,
class TDenseSpace>
57 inline void MapWithoutOptionsScalar(Mapper<TSparseSpace, TDenseSpace>&
dummy,
58 const Variable<double>& origin_variable,
59 const Variable<double>& destination_variable)
62 dummy.Map(origin_variable, destination_variable, dummy_flags);
65 template<
class TSparseSpace,
class TDenseSpace>
66 inline void MapWithoutOptionsVector(Mapper<TSparseSpace, TDenseSpace>&
dummy,
67 const Variable< array_1d<double, 3> >& origin_variable,
68 const Variable< array_1d<double, 3> >& destination_variable)
71 dummy.Map(origin_variable, destination_variable, dummy_flags);
74 template<
class TSparseSpace,
class TDenseSpace>
75 inline void InverseMapWithoutOptionsScalar(Mapper<TSparseSpace, TDenseSpace>&
dummy,
76 const Variable<double>& origin_variable,
77 const Variable<double>& destination_variable)
80 dummy.InverseMap(origin_variable, destination_variable, dummy_flags);
83 template<
class TSparseSpace,
class TDenseSpace>
84 inline void InverseMapWithoutOptionsVector(Mapper<TSparseSpace, TDenseSpace>&
dummy,
85 const Variable< array_1d<double, 3> >& origin_variable,
86 const Variable< array_1d<double, 3> >& destination_variable)
89 dummy.InverseMap(origin_variable, destination_variable, dummy_flags);
93 template<
class TSparseSpace,
class TDenseSpace>
94 inline void MapWithOptionsScalar(Mapper<TSparseSpace, TDenseSpace>&
dummy,
95 const Variable<double>& origin_variable,
96 const Variable<double>& destination_variable,
99 dummy.Map(origin_variable, destination_variable, MappingOptions);
102 template<
class TSparseSpace,
class TDenseSpace>
103 inline void MapWithOptionsVector(Mapper<TSparseSpace, TDenseSpace>&
dummy,
104 const Variable< array_1d<double, 3> >& origin_variable,
105 const Variable< array_1d<double, 3> >& destination_variable,
108 dummy.Map(origin_variable, destination_variable, MappingOptions);
111 template<
class TSparseSpace,
class TDenseSpace>
112 inline void InverseMapWithOptionsScalar(Mapper<TSparseSpace, TDenseSpace>&
dummy,
113 const Variable<double>& origin_variable,
114 const Variable<double>& destination_variable,
117 dummy.InverseMap(origin_variable, destination_variable, MappingOptions);
120 template<
class TSparseSpace,
class TDenseSpace>
121 inline void InverseMapWithOptionsVector(Mapper<TSparseSpace, TDenseSpace>&
dummy,
122 const Variable< array_1d<double, 3> >& origin_variable,
123 const Variable< array_1d<double, 3> >& destination_variable,
126 dummy.InverseMap(origin_variable, destination_variable, MappingOptions);
130 template<
class TSparseSpace,
class TDenseSpace>
133 namespace py = pybind11;
135 const std::string mapper_name = TSparseSpace::IsDistributed() ?
"MPIMapper" :
"Mapper";
136 typedef Mapper<TSparseSpace, TDenseSpace> MapperType;
138 = py::class_< MapperType, typename MapperType::Pointer >(
m, mapper_name.c_str())
139 .def(
"UpdateInterface", UpdateInterfaceWithoutArgs<TSparseSpace, TDenseSpace>)
140 .def(
"UpdateInterface", UpdateInterfaceWithOptions<TSparseSpace, TDenseSpace>)
141 .def(
"UpdateInterface", UpdateInterfaceWithSearchRadius<TSparseSpace, TDenseSpace>)
142 .def(
"UpdateInterface", &MapperType::UpdateInterface)
144 .def(
"Map", MapWithoutOptionsScalar<TSparseSpace, TDenseSpace>)
145 .def(
"Map", MapWithoutOptionsVector<TSparseSpace, TDenseSpace>)
146 .def(
"Map", MapWithOptionsScalar<TSparseSpace, TDenseSpace>)
147 .def(
"Map", MapWithOptionsVector<TSparseSpace, TDenseSpace>)
149 .def(
"InverseMap", InverseMapWithoutOptionsScalar<TSparseSpace, TDenseSpace>)
150 .def(
"InverseMap", InverseMapWithoutOptionsVector<TSparseSpace, TDenseSpace>)
151 .def(
"InverseMap", InverseMapWithOptionsScalar<TSparseSpace, TDenseSpace>)
152 .def(
"InverseMap", InverseMapWithOptionsVector<TSparseSpace, TDenseSpace>)
154 .def(
"GetMappingMatrix", &MapperType::GetMappingMatrix, py::return_value_policy::reference_internal)
155 .def(
"GetInterfaceModelPartOrigin", &MapperType::GetInterfaceModelPartOrigin, py::return_value_policy::reference_internal)
156 .def(
"GetInterfaceModelPartDestination", &MapperType::GetInterfaceModelPartDestination, py::return_value_policy::reference_internal)
158 .def(
"AreMeshesConforming", &MapperType::AreMeshesConforming)
160 .def(
"__str__", PrintObject<MapperType>)
164 mapper.attr(
"SWAP_SIGN") = MapperFlags::SWAP_SIGN;
165 mapper.attr(
"ADD_VALUES") = MapperFlags::ADD_VALUES;
166 mapper.attr(
"REMESHED") = MapperFlags::REMESHED;
167 mapper.attr(
"USE_TRANSPOSE") = MapperFlags::USE_TRANSPOSE;
168 mapper.attr(
"TO_NON_HISTORICAL") = MapperFlags::TO_NON_HISTORICAL;
169 mapper.attr(
"FROM_NON_HISTORICAL") = MapperFlags::FROM_NON_HISTORICAL;
174 template<
class TSparseSpace,
class TDenseSpace>
177 ExposeMapperToPython<TSparseSpace, TDenseSpace>(
m);
180 const std::string mapper_factory_name = TSparseSpace::IsDistributed() ?
"MPIMapperFactory" :
"MapperFactory";
182 pybind11::class_<MapperFactoryType, typename MapperFactoryType::Pointer>(
m, mapper_factory_name.c_str())
184 .def_static(
"HasMapper", &MapperFactoryType::HasMapper)
185 .def_static(
"GetRegisteredMapperNames", &MapperFactoryType::GetRegisteredMapperNames)
Python Interface of the MappingApplication.
Definition: mapper_factory.h:45
static void module(const array_1d< double, 3 > &Vector, double &distance)
Definition: GeometryFunctions.h:127
Definition: add_distributed_sparse_matrices_to_python.cpp:28
void AddMappingToPython(pybind11::module &m)
Definition: add_mapper_to_python.h:175
void AddMapperToPython(pybind11::module &m)
Definition: add_mapper_to_python.cpp:22
def CreateMapper(model_part_origin, model_part_destination, mapper_settings)
Definition: python_mapper_factory.py:34
int m
Definition: run_marine_rain_substepping.py:8
dummy
Definition: script.py:194