Package sfc :: Package quadrature :: Module QuadRule
[hide private]
[frames] | no frames]

Source Code for Module sfc.quadrature.QuadRule

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  """ 
 4  This module contains a class for representing quadrature rules. 
 5  """ 
 6   
 7  # Copyright (C) 2007 Martin Sandve Alnes and Simula Resarch Laboratory 
 8  # 
 9  # This file is part of SyFi. 
10  # 
11  # SyFi is free software: you can redistribute it and/or modify 
12  # it under the terms of the GNU General Public License as published by 
13  # the Free Software Foundation, either version 2 of the License, or 
14  # (at your option) any later version. 
15  # 
16  # SyFi is distributed in the hope that it will be useful, 
17  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
18  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
19  # GNU General Public License for more details. 
20  # 
21  # You should have received a copy of the GNU General Public License 
22  # along with SyFi. If not, see <http://www.gnu.org/licenses/>. 
23  # 
24  # First added:  November 29th 2007 
25  # Last changed: November 29th 2007 
26   
27 -class QuadRule:
28 """This class represents a specific quadrature rule over a polygon."""
29 - def __init__(self, polygon, nsd, order, points, weights, comment):
30 assert len(points) == len(weights) 31 self.polygon = polygon 32 self.nsd = nsd 33 self.num_points = len(points) 34 self.points = points 35 self.weights = weights 36 self.comment = comment 37 self.order = order
38
39 - def __str__(self):
40 s = "Quadrature rule:\n" 41 s += " comment: %s\n" % self.comment 42 s += " polygon = %s\n" % self.polygon 43 s += " nsd = %d\n" % self.nsd 44 s += " num_points = %d\n" % self.num_points 45 s += " points = %s\n" % self.points 46 s += " weights = %s\n" % self.weights 47 s += " order = %d\n" % self.order 48 return s
49 50 51 if __name__ == '__main__': 52 print "No test here." 53