SemiDiscreteOT 1.0
Semi-Discrete Optimal Transport Library
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim > Class Template Reference

A class for computing power diagrams using deal.II. More...

#include <PowerDiagram.h>

Inheritance diagram for PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >:
Inheritance graph
[legend]
Collaboration diagram for PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >:
Collaboration graph
[legend]

Public Member Functions

 DealIIPowerDiagram (const Triangulation< dim, spacedim > &source_mesh)
 Constructor for the DealIIPowerDiagram class.
 
void set_generators (const std::vector< Point< spacedim > > &points, const Vector< double > &potentials) override
 Sets the generator points and their potentials.
 
void set_distance_function (const std::function< double(const Point< spacedim > &, const Point< spacedim > &)> &dist)
 Sets the distance function to be used.
 
double power_distance (const Point< spacedim > &point, const unsigned int generator_idx) const
 Computes the power distance between a point and a generator.
 
void compute_power_diagram () override
 Computes the power diagram.
 
void output_vtu (const std::string &filename) const override
 Outputs the power diagram to a VTU file.
 
unsigned int get_cell_assignment (const unsigned int cell_index) const
 Returns the assignment of a cell to a generator.
 
const std::vector< unsigned int > & get_cell_assignments () const
 Returns the assignments of all cells to generators.
 
void compute_cell_centroids () override
 Computes the centroids of the power cells.
 
void save_centroids_to_file (const std::string &filename) const override
 Saves the centroids of the power cells to a file.
 
const std::vector< Point< spacedim > > & get_cell_centroids () const override
 Returns the centroids of the power cells.
 
- Public Member Functions inherited from PowerDiagramSpace::PowerDiagramBase< dim, spacedim >
virtual ~PowerDiagramBase ()=default
 

Private Attributes

const Triangulation< dim, spacedim > * source_triangulation
 The source triangulation.
 
std::vector< unsigned int > cell_assignments
 The assignments of cells to generators.
 
std::function< double(const Point< spacedim > &, const Point< spacedim > &)> distance_function
 The distance function.
 

Additional Inherited Members

- Protected Attributes inherited from PowerDiagramSpace::PowerDiagramBase< dim, spacedim >
std::vector< Point< spacedim > > generator_points
 The generator points.
 
std::vector< double > generator_potentials
 The potentials of the generator points.
 
std::vector< Point< spacedim > > cell_centroids
 The centroids of the power cells.
 

Detailed Description

template<int dim, int spacedim = dim>
class PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >

A class for computing power diagrams using deal.II.

Template Parameters
dimThe dimension of the mesh.
spacedimThe dimension of the space the mesh is embedded in.

Definition at line 90 of file PowerDiagram.h.

Constructor & Destructor Documentation

◆ DealIIPowerDiagram()

template<int dim, int spacedim>
PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::DealIIPowerDiagram ( const Triangulation< dim, spacedim > &  source_mesh)

Constructor for the DealIIPowerDiagram class.

Parameters
source_meshThe source mesh.

Definition at line 8 of file PowerDiagramDealII.cc.

Member Function Documentation

◆ set_generators()

template<int dim, int spacedim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::set_generators ( const std::vector< Point< spacedim > > &  points,
const Vector< double > &  potentials 
)
overridevirtual

Sets the generator points and their potentials.

Parameters
pointsThe generator points.
potentialsThe potentials of the generator points.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 14 of file PowerDiagramDealII.cc.

◆ set_distance_function()

template<int dim, int spacedim = dim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::set_distance_function ( const std::function< double(const Point< spacedim > &, const Point< spacedim > &)> &  dist)
inline

Sets the distance function to be used.

Parameters
distThe distance function.

Definition at line 110 of file PowerDiagram.h.

◆ power_distance()

template<int dim, int spacedim>
double PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::power_distance ( const Point< spacedim > &  point,
const unsigned int  generator_idx 
) const

Computes the power distance between a point and a generator.

Parameters
pointThe point.
generator_idxThe index of the generator.
Returns
The power distance.

Definition at line 26 of file PowerDiagramDealII.cc.

◆ compute_power_diagram()

template<int dim, int spacedim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::compute_power_diagram ( )
overridevirtual

Computes the power diagram.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 37 of file PowerDiagramDealII.cc.

◆ output_vtu()

template<int dim, int spacedim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::output_vtu ( const std::string &  filename) const
overridevirtual

Outputs the power diagram to a VTU file.

Parameters
filenameThe name of the output file.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 63 of file PowerDiagramDealII.cc.

Here is the call graph for this function:

◆ get_cell_assignment()

template<int dim, int spacedim>
unsigned int PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::get_cell_assignment ( const unsigned int  cell_index) const

Returns the assignment of a cell to a generator.

Parameters
cell_indexThe index of the cell.
Returns
The index of the generator.

Definition at line 77 of file PowerDiagramDealII.cc.

◆ get_cell_assignments()

template<int dim, int spacedim>
const std::vector< unsigned int > & PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::get_cell_assignments ( ) const

Returns the assignments of all cells to generators.

Definition at line 85 of file PowerDiagramDealII.cc.

◆ compute_cell_centroids()

template<int dim, int spacedim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::compute_cell_centroids ( )
overridevirtual

Computes the centroids of the power cells.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 91 of file PowerDiagramDealII.cc.

◆ save_centroids_to_file()

template<int dim, int spacedim>
void PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::save_centroids_to_file ( const std::string &  filename) const
overridevirtual

Saves the centroids of the power cells to a file.

Parameters
filenameThe name of the output file.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 129 of file PowerDiagramDealII.cc.

Here is the call graph for this function:

◆ get_cell_centroids()

template<int dim, int spacedim>
const std::vector< Point< spacedim > > & PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::get_cell_centroids ( ) const
overridevirtual

Returns the centroids of the power cells.

Implements PowerDiagramSpace::PowerDiagramBase< dim, spacedim >.

Definition at line 139 of file PowerDiagramDealII.cc.

Member Data Documentation

◆ source_triangulation

template<int dim, int spacedim = dim>
const Triangulation<dim, spacedim>* PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::source_triangulation
private

The source triangulation.

Definition at line 162 of file PowerDiagram.h.

◆ cell_assignments

template<int dim, int spacedim = dim>
std::vector<unsigned int> PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::cell_assignments
private

The assignments of cells to generators.

Definition at line 163 of file PowerDiagram.h.

◆ distance_function

template<int dim, int spacedim = dim>
std::function<double(const Point<spacedim>&, const Point<spacedim>&)> PowerDiagramSpace::DealIIPowerDiagram< dim, spacedim >::distance_function
private

The distance function.

Definition at line 164 of file PowerDiagram.h.


The documentation for this class was generated from the following files: