/usr/include/dolfin/swig/la/pre.i is in libdolfin-dev 1.4.0+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | /* -*- C -*- */
// Copyright (C) 2009 Johan Jansson
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Anders Logg 2007-2012
// Modified by Garth Wells 2008-2011
// Modified by Ola Skavhaug 2008-2009
// Modified by Kent-Andre Mardal 2008
// Modified by Martin Sandve Alnaes 2008
// Modified by Johan Hake 2008-2009
//
// First added: 2007-01-21
// Last changed: 2011-04-20
//=============================================================================
// SWIG directives for the DOLFIN la kernel module (pre)
//
// The directives in this file are applied _before_ the header files of the
// modules has been loaded.
//=============================================================================
//-----------------------------------------------------------------------------
// Ignore warnings about nested classes.
//-----------------------------------------------------------------------------
%warnfilter(325) dolfin::GenericLinearAlgebraFactory::NotImplementedLinearOperator;
//-----------------------------------------------------------------------------
// Rename solve so it wont clash with solve from fem
//-----------------------------------------------------------------------------
%rename(la_solve) dolfin::solve;
//-----------------------------------------------------------------------------
// Ignore the get_eigen{value,pair} methods (reimplemented in post)
//-----------------------------------------------------------------------------
#ifdef HAS_SLEPC
%ignore dolfin::SLEPcEigenSolver::get_eigenvalue;
%ignore dolfin::SLEPcEigenSolver::get_eigenpair;
#endif
//-----------------------------------------------------------------------------
// Fix problem with missing uBLAS namespace
//-----------------------------------------------------------------------------
%inline %{
namespace boost{ namespace numeric{ namespace ublas{}}}
%}
//-----------------------------------------------------------------------------
// Modify VectorSpaceBasis::operator[]
//-----------------------------------------------------------------------------
%rename(_sub) dolfin::VectorSpaceBasis::operator[];
//-----------------------------------------------------------------------------
// Ignore some operator=
//-----------------------------------------------------------------------------
%ignore dolfin::GenericTensor::operator=;
%ignore dolfin::BlockVector::operator=;
%ignore dolfin::SubVector::operator=;
%ignore dolfin::SubMatrix::operator=;
%ignore dolfin::SubMatrix::operator=;
//-----------------------------------------------------------------------------
// Ignore free function norm(), reimplemented in Python
//-----------------------------------------------------------------------------
%ignore dolfin::norm;
//-----------------------------------------------------------------------------
// Rename set and get from BlockFoo
//-----------------------------------------------------------------------------
//%rename(_get) dolfin::BlockVector::get;
//%rename(_set) dolfin::BlockVector::set;
//%rename(_get) dolfin::BlockMatrix::get;
//%rename(_set) dolfin::BlockMatrix::set;
//-----------------------------------------------------------------------------
// Modify the Scalar interface
//-----------------------------------------------------------------------------
%rename(__float__) dolfin::Scalar::operator double;
%rename(assign) dolfin::Scalar::operator=;
//-----------------------------------------------------------------------------
// Typemaps for GenericMatrix get and set functions
//-----------------------------------------------------------------------------
%typemap(in) const double* block = double* _array;
%typemap(in) (std::size_t m, const dolfin::la_index* rows) = (std::size_t _array_dim, dolfin::la_index* _array);
%typemap(in) (std::size_t n, const dolfin::la_index* cols) = (std::size_t _array_dim, dolfin::la_index* _array);
%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (std::size_t m, const dolfin::la_index* rows)
{
// rows typemap
$1 = PyArray_Check($input);
}
%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (std::size_t n, const dolfin::la_index* cols)
{
// cols typemap
$1 = PyArray_Check($input);
}
//-----------------------------------------------------------------------------
// Ignore low level interface
//-----------------------------------------------------------------------------
%ignore dolfin::LinearAlgebraObject::instance;
%ignore dolfin::GenericTensor::get(double*, const dolfin::la_index*, const dolfin::la_index * const *) const;
%ignore dolfin::GenericTensor::set(const double* , const dolfin::la_index* , const dolfin::la_index * const *);
%ignore dolfin::GenericTensor::add(const double* , const dolfin::la_index* , const dolfin::la_index * const *);
%ignore dolfin::PETScLinearOperator::wrapper;
//-----------------------------------------------------------------------------
%ignore dolfin::uBLASVector::operator ()(std::size_t i) const;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Ignore wrapping of the Set variable (Might add typemap for this in future...)
//-----------------------------------------------------------------------------
%ignore dolfin::SparsityPattern::diagonal_pattern;
%ignore dolfin::SparsityPattern::off_diagonal_pattern;
//-----------------------------------------------------------------------------
// Declare newobject for vector and matrix get functions
//-----------------------------------------------------------------------------
%newobject _get_vector_sub_vector;
//%newobject _get_matrix_sub_vector;
//%newobject _get_matrix_sub_matrix;
//-----------------------------------------------------------------------------
// Modify the GenericVector interface
//-----------------------------------------------------------------------------
%rename(_assign) dolfin::GenericVector::operator=;
%ignore dolfin::GenericVector::operator[];
%ignore dolfin::GenericVector::operator*=;
%ignore dolfin::GenericVector::operator/=;
%ignore dolfin::GenericVector::operator+=;
%ignore dolfin::GenericVector::operator-=;
%ignore dolfin::GenericVector::getitem;
%ignore dolfin::GenericVector::setitem;
//-----------------------------------------------------------------------------
// Ignore the get and set functions used for blocks
// NOTE: The %ignore has to be set using the actual type used in the declaration
// so we cannot use dolfin::uint or unsigned int for uint. Strange...
//-----------------------------------------------------------------------------
%ignore dolfin::GenericVector::get(double*, std::size_t, const dolfin::la_index*) const;
%ignore dolfin::GenericVector::set(const double* , std::size_t m, const dolfin::la_index*);
%ignore dolfin::GenericVector::data() const;
%ignore dolfin::GenericVector::data();
//-----------------------------------------------------------------------------
// Modify the GenericMatrix interface
//-----------------------------------------------------------------------------
%rename(assign) dolfin::GenericMatrix::operator=;
%ignore dolfin::GenericMatrix::operator*=;
%ignore dolfin::GenericMatrix::operator/=;
%ignore dolfin::GenericMatrix::operator+=;
%ignore dolfin::GenericMatrix::operator-=;
%ignore dolfin::GenericMatrix::set(const double*, const dolfin::la_index*,
const dolfin::la_index * const *);
%ignore dolfin::GenericMatrix::add(const double*, const dolfin::la_index*,
const dolfin::la_index * const * rows);
%ignore dolfin::GenericMatrix::get(double*, const dolfin::la_index*,
const dolfin::la_index * const *) const;
%ignore dolfin::GenericMatrix::data;
%ignore dolfin::GenericMatrix::getitem;
%ignore dolfin::GenericMatrix::setitem;
%ignore dolfin::GenericMatrix::operator();
//-----------------------------------------------------------------------------
// Modify uBLAS matrices, as these are not renamed by the GenericMatrix rename
//-----------------------------------------------------------------------------
%rename(assign) dolfin::uBLASMatrix<boost::numeric::ublas::matrix<double> >::operator=;
%rename(assign) dolfin::uBLASMatrix<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::row_major> >::operator=;
// Ignore reference version of constructor
%ignore dolfin::PETScKrylovSolver(std::string, PETScPreconditioner&);
%ignore dolfin::PETScKrylovSolver(std::string, PETScUserPreconditioner&);
%ignore dolfin::PaStiXLUSolver(const STLMatrix& A);
//-----------------------------------------------------------------------------
// PETSc/SLEPc backend
//-----------------------------------------------------------------------------
#ifdef HAS_PETSC
// Ignore MatNullSpace not properly wrapped by SWIG
%ignore dolfin::PETScPreconditioner::near_nullspace() const;
// Only ignore C++ accessors if petsc4py is enabled
#ifdef HAS_PETSC4PY
%ignore dolfin::PETScVector::vec() const;
%ignore dolfin::PETScBaseMatrix::mat() const;
%ignore dolfin::PETScKrylovSolver::ksp() const;
%ignore dolfin::PETScLUSolver::ksp() const;
%ignore dolfin::PETScSNESSolver::snes() const;
#else
// Ignore everything
%ignore dolfin::PETScVector::vec;
%ignore dolfin::PETScBaseMatrix::mat;
%ignore dolfin::PETScKrylovSolver::ksp;
%ignore dolfin::PETScLUSolver::ksp;
%ignore dolfin::PETScSNESSolver::snes;
#endif
#endif
#ifdef HAS_SLEPC
%ignore dolfin::SLEPcEigenSolver(const PETScMatrix&);
%ignore dolfin::SLEPcEigenSolver(const PETScMatrix&, const PETScMatrix&);
#endif
//-----------------------------------------------------------------------------
// Trilinos backend
//-----------------------------------------------------------------------------
#ifdef HAS_TRILINOS
%ignore dolfin::EpetraMatrix::mat;
%ignore dolfin::EpetraVector::vec;
%ignore dolfin::EpetraMatrix(std::shared_ptr<Epetra_FECrsMatrix> A);
//-----------------------------------------------------------------------------
// Typemaps for Teuchos::RCP (Trilinos backend)
//-----------------------------------------------------------------------------
%define %RCP_to_const_ref_typemap(Type)
%typemap(in) const Type&
{
int res = SWIG_ConvertPtr($input, (void**)&$1, $1_descriptor, 0);
if (!SWIG_IsOK(res))
{
Teuchos::RCP<Type> *rcp_ptr;
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, (void**)&rcp_ptr,
$descriptor(Teuchos::RCP<Type>*), 0, &newmem);
if (!SWIG_IsOK(res))
SWIG_exception_fail(SWIG_ArgError(res), "in method '$symname', argument $argnum of type '$type'");
if (rcp_ptr)
{
$1 = rcp_ptr->get();
if (newmem & SWIG_CAST_NEW_MEMORY)
delete rcp_ptr;
}
else
$1 = NULL;
}
if (!$1)
SWIG_exception_fail(SWIG_ValueError, "invalid null reference in method '$symname', argument $argnum of type '$type'");
}
%typecheck(SWIG_TYPECHECK_POINTER) const Type&
{
void *dummy;
int res;
res = SWIG_ConvertPtr($input, &dummy, $1_descriptor, 0);
if (!SWIG_IsOK(res))
{
Teuchos::RCP<Type> *rcp_ptr;
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, (void**)&rcp_ptr,
$descriptor(Teuchos::RCP<Type>*), 0, &newmem);
if (rcp_ptr && (newmem & SWIG_CAST_NEW_MEMORY))
delete rcp_ptr;
}
$1 = SWIG_CheckState(res);
}
%enddef
%RCP_to_const_ref_typemap(Epetra_CrsGraph);
%RCP_to_const_ref_typemap(Epetra_BlockMap);
%RCP_to_const_ref_typemap(Teuchos::ParameterList);
#endif
//-----------------------------------------------------------------------------
// Add director classes
//-----------------------------------------------------------------------------
%feature("director") dolfin::PETScUserPreconditioner;
%feature("director") dolfin::PETScLinearOperator;
%feature("nodirector") dolfin::PETScLinearOperator::str;
%feature("nodirector") dolfin::PETScLinearOperator::wrapper;
%feature("director") dolfin::uBLASLinearOperator;
%feature("nodirector") dolfin::uBLASLinearOperator::str;
%feature("director") dolfin::LinearOperator;
%feature("nodirector") dolfin::LinearOperator::instance;
%feature("nodirector") dolfin::LinearOperator::shared_instance;
//-----------------------------------------------------------------------------
// Director typemaps for dolfin::GenericVector
//-----------------------------------------------------------------------------
%typemap(directorin, fragment="NoDelete") dolfin::GenericVector&
{
// Director in dolfin::GenericVector&
std::shared_ptr< dolfin::GenericVector > *smartresult = new std::shared_ptr< dolfin::GenericVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::GenericVector > *), SWIG_POINTER_OWN);
}
%typemap(directorin, fragment="NoDelete") const dolfin::GenericVector&
{
// Director in const dolfin::GenericVector&
std::shared_ptr< const dolfin::GenericVector > *smartresult = new std::shared_ptr< const dolfin::GenericVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::GenericVector > *), SWIG_POINTER_OWN);
}
//-----------------------------------------------------------------------------
// Director typemaps for dolfin::PETScVector
//-----------------------------------------------------------------------------
%typemap(directorin, fragment="NoDelete") dolfin::PETScVector&
{
// Director in dolfin::PETScVector&
std::shared_ptr< dolfin::PETScVector > *smartresult
= new std::shared_ptr< dolfin::PETScVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::PETScVector > *), SWIG_POINTER_OWN);
}
%typemap(directorin, fragment="NoDelete") const dolfin::PETScVector&
{
// Director in const dolfin::PETScVector&
std::shared_ptr< const dolfin::PETScVector > *smartresult
= new std::shared_ptr< const dolfin::PETScVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::PETScVector > *), SWIG_POINTER_OWN);
}
//-----------------------------------------------------------------------------
// Director typemaps for dolfin::uBLASVector
//-----------------------------------------------------------------------------
%typemap(directorin, fragment="NoDelete") dolfin::uBLASVector&
{
// Director in dolfin::uBLASVector&
std::shared_ptr< dolfin::uBLASVector > *smartresult = new std::shared_ptr< dolfin::uBLASVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::uBLASVector > *), SWIG_POINTER_OWN);
}
%typemap(directorin, fragment="NoDelete") const dolfin::uBLASVector& {
// Director in const dolfin::uBLASVector&
std::shared_ptr< const dolfin::uBLASVector > *smartresult = new std::shared_ptr< const dolfin::uBLASVector >(reference_to_no_delete_pointer($1_name));
$input = SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(std::shared_ptr< dolfin::uBLASVector > *), SWIG_POINTER_OWN);
}
|