Skip to content
Snippets Groups Projects
Commit 55c6358d authored by dedner's avatar dedner
Browse files

migrated dune-alugrid from corepy to here

parent 0d17b6fb
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ list(APPEND CMAKE_MODULE_PATH ${dune-grid_MODULE_PATH}
#include the dune macros
include(DuneMacros)
include(GridType)
include(GridType)
# start a dune project with information from dune.module
dune_project()
......@@ -43,5 +43,7 @@ add_subdirectory(lib)
add_subdirectory(examples EXCLUDE_FROM_ALL)
add_subdirectory(utils)
add_subdirectory(python)
# finalize the dune project, e.g., generate config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
......@@ -3,3 +3,4 @@ Version: 3.0.0
Maintainer: alugrid@mathematik.uni-freiburg.de
Whitespace-Hook: Yes
Depends: dune-grid (>= 2.4)
Suggests: dune-corepy
add_subdirectory(dune)
configure_file(setup.py.in setup.py)
add_subdirectory(alugrid)
add_python_targets(dune
__init__
)
__import__('pkg_resources').declare_namespace(__name__)
add_python_targets(alugrid
__init__
_create
_grids
)
from ._grids import *
from ._grids import *
registry = dict()
registry["grid"] = {
"ALU" : aluGrid,
"ALUConform" : aluConformGrid,
"ALUCube" : aluCubeGrid,
"ALUSimplex" : aluSimplexGrid,
}
from __future__ import absolute_import, division, print_function, unicode_literals
def aluGrid(constructor, dimgrid, dimworld=None, elementType=None, **parameters):
from dune.grid.grid_generator import module
if dimworld is None:
dimworld = dimgrid
if elementType is None:
elementType = parameters.pop("type")
refinement = parameters["refinement"]
if refinement == "conforming":
refinement="Dune::conforming"
elif refinement == "nonconforming":
refinement="Dune::nonconforming"
if not (2 <= dimworld and dimworld <= 3):
raise KeyError("Parameter error in ALUGrid with dimworld=" + str(dimworld) + ": dimworld has to be either 2 or 3")
if not (2 <= dimgrid and dimgrid <= dimworld):
raise KeyError("Parameter error in ALUGrid with dimgrid=" + str(dimgrid) + ": dimgrid has to be either 2 or 3")
if refinement=="Dune::conforming" and elementType=="Dune::cube":
raise KeyError("Parameter error in ALUGrid with refinement=" + refinement + " and type=" + elementType + ": conforming refinement is only available with simplex element type")
typeName = "Dune::ALUGrid< " + str(dimgrid) + ", " + str(dimworld) + ", " + elementType + ", " + refinement + " >"
includes = ["dune/alugrid/grid.hh", "dune/alugrid/dgf.hh"]
gridModule = module(includes, typeName)
return gridModule.LeafGrid(gridModule.reader(constructor))
def aluConformGrid(constructor, dimgrid, dimworld=None, **parameters):
return aluGrid(constructor, dimgrid, dimworld, elementType="Dune::simplex", refinement="Dune::conforming")
def aluCubeGrid(constructor, dimgrid, dimworld=None, **parameters):
return aluGrid(constructor, dimgrid, dimworld, elementType="Dune::cube", refinement="Dune::nonconforming")
def aluSimplexGrid(constructor, dimgrid, dimworld=None):
return aluGrid(constructor, dimgrid, dimworld, elementType="Dune::simplex", refinement="Dune::nonconforming")
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
from setuptools import setup, find_packages
setup(name="dune.alugrid",
namespace_packages=['dune'],
description="Python lib for dune: dune-alugrid library",
version="2.4",
author="Andreas Dedner and Martin Nolte",
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']}
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment