OGS
BaseLib::UniformSubdivision Class Reference

Detailed Description

Uniform subdivision operator

Definition at line 33 of file Subdivision.h.

#include <Subdivision.h>

Inheritance diagram for BaseLib::UniformSubdivision:
[legend]
Collaboration diagram for BaseLib::UniformSubdivision:
[legend]

Public Member Functions

 UniformSubdivision (double length, std::size_t n_subdivision)
 
std::vector< double > operator() () const override
 Returns a vector of subdivided points.
 
- Public Member Functions inherited from BaseLib::ISubdivision
virtual ~ISubdivision ()=default
 

Private Attributes

const double length_
 
const std::size_t n_subdivision_
 

Constructor & Destructor Documentation

◆ UniformSubdivision()

BaseLib::UniformSubdivision::UniformSubdivision ( double length,
std::size_t n_subdivision )
inline

Configuration

Parameters
lengthtotal length to be subdivided
n_subdivisionthe number of subdivision

Definition at line 41 of file Subdivision.h.

42 : length_(length), n_subdivision_(n_subdivision)
43 {
44 }
const std::size_t n_subdivision_
Definition Subdivision.h:61

Member Function Documentation

◆ operator()()

std::vector< double > BaseLib::UniformSubdivision::operator() ( ) const
inlineoverridevirtual

Returns a vector of subdivided points.

Implements BaseLib::ISubdivision.

Definition at line 47 of file Subdivision.h.

48 {
49 std::vector<double> x;
50 x.reserve(n_subdivision_ + 1);
51 const double dL = length_ / static_cast<double>(n_subdivision_);
52 for (std::size_t i = 0; i < n_subdivision_ + 1; i++)
53 {
54 x.push_back(i * dL);
55 }
56 return x;
57 }

References length_, and n_subdivision_.

Member Data Documentation

◆ length_

const double BaseLib::UniformSubdivision::length_
private

Definition at line 60 of file Subdivision.h.

Referenced by operator()().

◆ n_subdivision_

const std::size_t BaseLib::UniformSubdivision::n_subdivision_
private

Definition at line 61 of file Subdivision.h.

Referenced by operator()().


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