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

add dune python support

parent 5fce56a7
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__
alu
alusimplex
alucube
aluconform
)
from __future__ import absolute_import, division, print_function, unicode_literals
__metaclass__ = type
from dune.grid.grid_generator import register
register( ALU = "dune.alugrid.alu",
ALUConform = "dune.alugrid.aluconform",
ALUCube = "dune.alugrid.alucube",
ALUSimplex = "dune.alugrid.alusimplex" )
from __future__ import absolute_import, division, print_function, unicode_literals
from dune.grid.grid_generator import module
def create(constructor, dimgrid, dimworld=None, elementType=None, **parameters):
if not dimworld:
dimworld = dimgrid
if not elementType:
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<=3):
raise KeyError(\
"Parameter error in ALUGrid with "+
"dimgrid=" + str(dimgrid) + ": " +\
"dimgrid has to be either 2 or 3")
if not (dimgrid==dimworld or dimgrid+1==dimworld):
raise KeyError(\
"Parameter error in ALUGrid with "+
"dimworld=" + str(dimworld) + " and dimgrid=" + str(dimgrid) + ": " +\
"dimworld has to be either equal to dimgrid or "+
"dimworld has to be equal to dimgrid+1")
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) )
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
from __future__ import absolute_import, division, print_function, unicode_literals
from dune.grid.grid_generator import module
from . import alu
def create(constructor, dimgrid, dimworld=None, **parameters):
parameters["type"] = "Dune::simplex"
parameters["refinement"] = "Dune::conforming"
return alu.create(constructor, dimgrid, dimworld, **parameters)
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
from __future__ import absolute_import, division, print_function, unicode_literals
from dune.grid.grid_generator import module
from . import alu
def create(constructor, dimgrid, dimworld=None,
**parameters):
parameters["type"] = "Dune::cube"
parameters["refinement"] = "Dune::nonconforming"
return alu.create(constructor, dimgrid, dimworld, **parameters)
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
from __future__ import absolute_import, division, print_function, unicode_literals
from dune.grid.grid_generator import module
from . import alu
def create(constructor, dimgrid, dimworld=None, refinement="Dune::nonconforming",
**parameters):
parameters["type"] = "Dune::simplex"
parameters["refinement"] = refinement
return alu.create(constructor, dimgrid, dimworld, **parameters)
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: the alugrid manager",
version="2.4",
author="Andreas Dedner and Martin Nolte",
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']}
)
# package_data = {'dune': ['${CMAKE_CURRENT_BINARY_DIR}/dune/*.so']}
# package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}' },
# packages=[ 'dune.common',
# 'dune.geometry',
# 'dune.grid', ]
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