Subversion Repositories slepc-dev

Rev

Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1377 slepc 1
#
2
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1672 slepc 3
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
2116 eromero 4
#  Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
1377 slepc 5
#
1672 slepc 6
#  This file is part of SLEPc.
7
#    
8
#  SLEPc is free software: you can redistribute it and/or modify it under  the
9
#  terms of version 3 of the GNU Lesser General Public License as published by
10
#  the Free Software Foundation.
11
#
12
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
13
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
14
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
15
#  more details.
16
#
17
#  You  should have received a copy of the GNU Lesser General  Public  License
18
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
1377 slepc 19
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20
#
21
 
914 dsic.upv.es!antodo 22
import os
23
import sys
24
 
25
def Load(petscdir):
1651 slepc 26
  global ARCH,DIR,MAKE,SCALAR,PRECISION,ISINSTALL,INSTALL_DIR
914 dsic.upv.es!antodo 27
 
28
  if 'PETSC_ARCH' in os.environ:
1527 slepc 29
    ISINSTALL = 0
914 dsic.upv.es!antodo 30
    ARCH = os.environ['PETSC_ARCH']
1527 slepc 31
    PETSCVARIABLES = os.sep.join([petscdir,ARCH,'conf','petscvariables'])
914 dsic.upv.es!antodo 32
  else:
1527 slepc 33
    ISINSTALL = 1
34
    ARCH = 'unknown'
35
    PETSCVARIABLES = os.sep.join([petscdir,'conf','petscvariables'])
914 dsic.upv.es!antodo 36
 
37
  try:
1527 slepc 38
    f = open(PETSCVARIABLES)
914 dsic.upv.es!antodo 39
    for l in f.readlines():
40
      (k,v) = l.split('=',1)
41
      k = k.strip()
42
      v = v.strip()
43
      if k == 'PETSC_SCALAR':
44
        SCALAR = v
45
      elif k == 'PETSC_PRECISION':
46
        PRECISION = v
47
      elif k == 'MAKE':
48
        MAKE = v
1366 slepc 49
      elif k == 'INSTALL_DIR':
50
        INSTALL_DIR = v
914 dsic.upv.es!antodo 51
    f.close()
52
  except:
53
    sys.exit('ERROR: PETSc is not configured for architecture ' + ARCH)