Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
a5264b2d
Commit
a5264b2d
authored
3 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation to 'Quadrature'.
parent
5e7efa2a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Quadrature.py
+63
-0
63 additions, 0 deletions
Quadrature.py
with
63 additions
and
0 deletions
Quadrature.py
+
63
−
0
View file @
a5264b2d
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment