瀏覽代碼

Separated the main solver from the HDPG discretization method.

Snow 8 年之前
父節點
當前提交
8d912d94d2
共有 3 個文件被更改,包括 37 次插入21 次删除
  1. 8 3
      hdpg1d/coefficients.py
  2. 0 18
      hdpg1d/menu.py
  3. 29 0
      setup.py

+ 8 - 3
hdpg1d/coefficients.py

@@ -1,19 +1,24 @@
 class coefficients:
-    def __init__(self, diff, conv, flux):
+    def __init__(self, diff, conv, flux, porder, nele):
         self.diffusion = diff
         self.covection = conv
         self.flux = flux
+        self.porder = porder
+        self.nele = nele
 
     @classmethod
     def from_input(cls):
         while True:
             try:
-                diff = float(input("Diffusion coefficient "))
+                print("Please provide the following coefficients.")
+                diff = float(input("Diffusion coefficient: "))
                 conv = float(input("Covection coefficient: "))
                 flux = float(input("Flux: "))
+                porder = int(input("Order of polynomials: "))
+                nele = int(input("Number of elements: "))
             except ValueError:
                 print("Sorry, wrong data type.")
                 continue
             else:
                 break
-        return cls(diff, conv, flux)
+        return cls(diff, conv, flux, porder, nele)

+ 0 - 18
hdpg1d/menu.py

@@ -1,18 +0,0 @@
-menu = {}
-menu['1'] = "Solve with HDG."
-menu['2'] = "Solve with HDPG."
-menu['3'] = "Exit."
-
-options = menu.keys()
-for entry in options:
-    print(entry, menu[entry])
-    
-selection = input("Please Select:")
-if selection == '1':
-    print("test" )
-elif selection == '2':
-    print("test")
-elif selection == '3':
-    print("test")
-else:
-    print("Unknown Option Selected!")

+ 29 - 0
setup.py

@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+import codecs
+import os
+
+here = os.path.abspath(os.path.dirname(__file__))
+
+
+# def read(*parts):
+#     # intentionally *not* adding an encoding option to open
+#     return codecs.open(os.path.join(here, *parts), 'r').read()
+
+# long_description = read('README.rst')
+
+setup(name='hdpg1d',
+      version='1.0',
+      description='An 1D finite element solver using hybridizable discontinuous\
+      Petrov-Galerkin method',
+      author='Keyi Ni',
+      author_email='[email protected]',
+      url='test',
+      license='MIT',
+      packages=['hdpg1d'],
+      requires=[
+          'numpy',
+          'matplotlib',
+          'scipy'
+      ],)