Subversion Repositories slepc-dev

Rev

Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1376 slepc 1
/*
2
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1672 slepc 3
   SLEPc - Scalable Library for Eigenvalue Problem Computations
4
   Copyright (c) 2002-2009, Universidad Politecnica de Valencia, Spain
1024 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/>.
1376 slepc 19
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20
*/
21
 
1469 slepc 22
#include "private/fortranimpl.h"
1024 slepc 23
#include "slepcst.h"
24
 
25
#ifdef PETSC_HAVE_FORTRAN_CAPS
26
#define stshellsetapply_          STSHELLSETAPPLY
27
#define stshellsetapplytranspose_ STSHELLSETAPPLYTRANSPOSE
28
#define stshellsetbacktransform_  STSHELLSETBACKTRANSFORM
29
#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
30
#define stshellsetapply_          stshellsetapply
31
#define stshellsetapplytranspose_ stshellsetapplytranspose
32
#define stshellsetbacktransform_  stshellsetbacktransform
33
#endif
34
 
35
EXTERN_C_BEGIN
36
static void (PETSC_STDCALL *f1)(void*,Vec*,Vec*,PetscErrorCode*);
37
static void (PETSC_STDCALL *f2)(void*,Vec*,Vec*,PetscErrorCode*);
38
static void (PETSC_STDCALL *f3)(void*,PetscScalar*,PetscScalar*,PetscErrorCode*);
39
EXTERN_C_END
40
 
41
/* These are not extern C because they are passed into non-extern C user level functions */
42
static PetscErrorCode ourshellapply(void *ctx,Vec x,Vec y)
43
{
44
  PetscErrorCode ierr = 0;
45
  (*f1)(ctx,&x,&y,&ierr);CHKERRQ(ierr);
46
  return 0;
47
}
48
 
49
static PetscErrorCode ourshellapplytranspose(void *ctx,Vec x,Vec y)
50
{
51
  PetscErrorCode ierr = 0;
52
  (*f2)(ctx,&x,&y,&ierr);CHKERRQ(ierr);
53
  return 0;
54
}
55
 
56
static PetscErrorCode ourshellbacktransform(void *ctx,PetscScalar *eigr,PetscScalar *eigi)
57
{
58
  PetscErrorCode ierr = 0;
59
  (*f3)(ctx,eigr,eigi,&ierr);CHKERRQ(ierr);
60
  return 0;
61
}
62
 
63
EXTERN_C_BEGIN
64
 
65
void PETSC_STDCALL stshellsetapply_(ST *st,void (PETSC_STDCALL *apply)(void*,Vec *,Vec *,PetscErrorCode*),
66
                                    PetscErrorCode *ierr)
67
{
68
  f1 = apply;
69
  *ierr = STShellSetApply(*st,ourshellapply);
70
}
71
 
72
void PETSC_STDCALL stshellsetapplytranspose_(ST *st,void (PETSC_STDCALL *applytranspose)(void*,Vec *,Vec *,PetscErrorCode*),
73
                                             PetscErrorCode *ierr)
74
{
75
  f2 = applytranspose;
76
  *ierr = STShellSetApplyTranspose(*st,ourshellapplytranspose);
77
}
78
 
79
void PETSC_STDCALL stshellsetbacktransform_(ST *st,void (PETSC_STDCALL *backtransform)(void*,PetscScalar*,PetscScalar*,PetscErrorCode*),
80
                                    PetscErrorCode *ierr)
81
{
82
  f3 = backtransform;
83
  *ierr = STShellSetBackTransform(*st,ourshellbacktransform);
84
}
85
 
86
EXTERN_C_END
87