File: test_env.py

package info (click to toggle)
ngspetsc 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,056 kB
  • sloc: python: 2,775; makefile: 42
file content (44 lines) | stat: -rw-r--r-- 957 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
This module test that the environment is correctly been setup.
In particular it will test for: petsc4py, PETSc, NGSolve, Netgen and ngsPETSc
'''

import pytest
pytest.importorskip("ngsolve")

import petsc4py
from petsc4py import PETSc

import ngsolve as ngs
from netgen.geom2d import unit_square
from ngsolve import x,y

import ngsPETSc

def test_petsc4py():
    '''
    Testing that petsc4py can be imported correctly
    '''
    assert petsc4py.get_config() != ""

def  test_petsc():
    '''
    Testing that PETSc can be imported correctly
    '''
    assert PETSc.DECIDE == -1

def test_ngs():
    '''
    Testing that NGSolve can be imported correctly
    '''
    mesh = ngs.Mesh(unit_square.GenerateMesh(maxh=0.1))
    coefficientFunction = x*(1-y)
    mip = mesh(0.2, 0.2)
    coefficientFunction(mip)
    print(mip)

def test_ngsPETSc():
    '''
    Testing that ngsPETSc can be imported correctly
    '''
    assert ngsPETSc.VERSION == "0.0.5"