Skip to content
Snippets Groups Projects
Commit a5264b2d authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Added documentation to 'Quadrature'.

parent 5e7efa2a
Branches
No related tags found
No related merge requests found
......@@ -7,29 +7,91 @@ import numpy.polynomial.legendre as leg
class Quadrature(object):
"""Class for quadrature.
A quadrature is used to determine the approximation of a definite integral of a function.
Attributes
----------
num_eval_points : int
Number of evaluation points per cell used for approximation.
eval_points : np.array
Evaluation points per cell used for approximation.
weights : np.array
Weights used for approximation calculation.
Methods
-------
get_name()
Returns string of class name.
get_num_points()
Returns number of evaluation points.
get_eval_points()
Returns evaluation points.
get_weights()
Returns evaluation weights.
"""
def __init__(self, config):
self._reset(config)
def _reset(self, config):
"""Resets instance variables.
Parameters
----------
config : dict
Additional parameters for quadrature.
"""
self._num_eval_points = None
self._eval_points = None
self._weights = None
def get_name(self):
"""Returns string of class name."""
return self.__class__.__name__
def get_num_points(self):
"""Returns number of evaluation points."""
return self._num_eval_points
def get_eval_points(self):
"""Returns evaluation points."""
return self._eval_points
def get_weights(self):
"""Returns evaluation weights."""
return self._weights
class Gauss(Quadrature):
"""Class for Gaussian quadrature.
Attributes
----------
num_eval_points : int
Number of evaluation points per cell used for approximation.
eval_points : np.array
Evaluation points per cell used for approximation.
weights : np.array
Weights used for approximation calculation.
Methods
-------
get_name()
Returns string of class name.
"""
def _reset(self, config):
"""Resets instance variables.
Parameters
----------
config : dict
Additional parameters for quadrature.
"""
super()._reset(config)
# Unpack necessary configurations
......@@ -38,4 +100,5 @@ class Gauss(Quadrature):
self._eval_points, self._weights = leg.leggauss(self._num_eval_points)
def get_name(self):
"""Returns string of class name concatenated with the number of evaluation points."""
return self.__class__.__name__ + str(self._num_eval_points)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment