/usr/include/dolfin/swig/common/pre.i is in libdolfin-dev 2016.2.0-2.
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 | /* -*- C -*- */
// Copyright (C) 2009 Johan Hake
//
// 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/>.
//
// First added: 2009-09-22
// Last changed: 2014-01-17
//=============================================================================
// SWIG directives for the DOLFIN common kernel module (pre)
//
// The directives in this file are applied _before_ the header files of the
// modules has been loaded.
//=============================================================================
//-----------------------------------------------------------------------------
// petsc4py/slepc4py typemaps
//-----------------------------------------------------------------------------
// This must come early. The petsc4py/slepc4py module defines typemaps
// which we will later use on %extended classes (in post). The
// typemaps must be in scope when swig sees the original class, not
// the extended definition.
// Remove petsc4py typemaps that check for nullity of pointer
// and object itself we only care about the former.
%define %petsc4py_objreft(Type)
%typemap(check,noblock=1) Type *OUTPUT {
if ($1 == NULL)
%argument_nullref("$type", $symname, $argnum);
}
%apply Type *OUTPUT { Type & }
%enddef
#ifdef HAS_PETSC4PY
%include "petsc4py/petsc4py.i"
%petsc4py_objreft(Mat)
%petsc4py_objreft(Vec)
%petsc4py_objreft(KSP)
%petsc4py_objreft(SNES)
%petsc4py_objreft(Tao)
#endif
#ifdef HAS_SLEPC4PY
%include "slepc4py/slepc4py.i"
%petsc4py_objreft(EPS)
#endif
//-----------------------------------------------------------------------------
// Make DOLFIN aware of the types defined in UFC
//-----------------------------------------------------------------------------
%{
#include <ufc.h>
%}
// Avoid polluting the dolfin namespace with symbols introduced in
// ufc.h that we don't need
%rename("$ignore", regextarget=1, fullname=1) "ufc::.*$";
// Brings back ('un-ignore') some destructors for SWIG to handle
// shared_ptr wrapping
%rename("%s", regextarget=1, fullname=1) "ufc::cell::~cell()$";
%rename("%s", regextarget=1, fullname=1) "ufc::dofmap::~dofmap()$";
%rename("%s", regextarget=1, fullname=1) "ufc::finite_element::~finite_element()*$";
%rename("%s", regextarget=1, fullname=1) "ufc::coordinate_mapping::~coordinate_mapping()*$";
%rename("%s", regextarget=1, fullname=1) "ufc::form::~form()*$";
%rename("%s", regextarget=1, fullname=1) "ufc::function::~function()*$";
// Unignore ufc::shape enum
%rename(ufc_shape) ufc::shape;
%rename(interval) ufc::shape::interval;
%rename(triangle) ufc::shape::triangle;
%rename(quadrilateral) ufc::shape::quadrilateral;
%rename(tetrahedron) ufc::shape::tetrahedron;
%rename(hexahedron) ufc::shape::hexahedron;
// Bring back ufc::cell members that are used in user Python
// implementations of Expression.eval_cell
%rename(cell_shape) ufc::cell::cell_shape;
%rename(index) ufc::cell::index;
%rename(topological_dimension) ufc::cell::topological_dimension;
%rename(geometric_dimension) ufc::cell::geometric_dimension;
%rename(local_facet) ufc::cell::local_facet;
%rename(mesh_identifier) ufc::cell::mesh_identifier;
// Rename only the symbols we need to ufc_* 'namespace'
%rename(ufc_cell) ufc::cell;
%rename(ufc_finite_element) ufc::finite_element;
%rename(ufc_dofmap) ufc::dofmap;
%rename(ufc_coordinate_mapping) ufc::coordinate_mapping;
%rename(ufc_form) ufc::form;
%rename(ufc_function) ufc::function;
%include <ufc.h>
// Jit with ctypes will result in factory functions returning just a
// void * to a new object, these functions will cast them into our
// swig wrapper type system and make them shared_ptrs in the process
// to manage their lifetime.
// Note: assuming std::size_t == std::uint_ptr_t here, should rather use that one
%inline %{
std::shared_ptr<const ufc::finite_element> make_ufc_finite_element(void * element)
{
ufc::finite_element * p = static_cast<ufc::finite_element *>(element);
return std::shared_ptr<const ufc::finite_element>(p);
}
std::shared_ptr<const ufc::finite_element> make_ufc_finite_element(std::size_t element)
{
ufc::finite_element * p = reinterpret_cast<ufc::finite_element *>(element);
return std::shared_ptr<const ufc::finite_element>(p);
}
std::shared_ptr<const ufc::dofmap> make_ufc_dofmap(void * dofmap)
{
ufc::dofmap * p = static_cast<ufc::dofmap *>(dofmap);
return std::shared_ptr<const ufc::dofmap>(p);
}
std::shared_ptr<const ufc::dofmap> make_ufc_dofmap(std::size_t dofmap)
{
ufc::dofmap * p = reinterpret_cast<ufc::dofmap *>(dofmap);
return std::shared_ptr<const ufc::dofmap>(p);
}
std::shared_ptr<const ufc::coordinate_mapping> make_ufc_coordinate_mapping(void * element)
{
ufc::coordinate_mapping * p = static_cast<ufc::coordinate_mapping *>(element);
return std::shared_ptr<const ufc::coordinate_mapping>(p);
}
std::shared_ptr<const ufc::coordinate_mapping> make_ufc_coordinate_mapping(std::size_t element)
{
ufc::coordinate_mapping * p = reinterpret_cast<ufc::coordinate_mapping *>(element);
return std::shared_ptr<const ufc::coordinate_mapping>(p);
}
std::shared_ptr<const ufc::form> make_ufc_form(void * form)
{
ufc::form * p = static_cast<ufc::form *>(form);
return std::shared_ptr<const ufc::form>(p);
}
std::shared_ptr<const ufc::form> make_ufc_form(std::size_t form)
{
ufc::form * p = reinterpret_cast<ufc::form *>(form);
return std::shared_ptr<const ufc::form>(p);
}
%}
//-----------------------------------------------------------------------------
// Global modifications to the Array interface
//-----------------------------------------------------------------------------
%ignore dolfin::Array::operator=;
%ignore dolfin::Array::operator[];
//-----------------------------------------------------------------------------
// Global modifications to the ArrayView interface
//-----------------------------------------------------------------------------
%ignore dolfin::ArrayView::operator=;
%ignore dolfin::ArrayView::operator[];
//-----------------------------------------------------------------------------
// Global modifications to the IndexSet interface
//-----------------------------------------------------------------------------
%ignore dolfin::IndexSet::operator[];
//-----------------------------------------------------------------------------
// Global modifications to the dolfin::Set interface
//-----------------------------------------------------------------------------
%ignore dolfin::Set::operator[];
//-----------------------------------------------------------------------------
// Copy Array construction typemaps from NumPy typemaps
//-----------------------------------------------------------------------------
%typemap(in) (std::size_t N, const std::size_t* x) = (std::size_t _array_dim, std::size_t* _array);
%typemap(in) (std::size_t N, const int* x) = (std::size_t _array_dim, int* _array);
%typemap(in) (std::size_t N, const double* x) = (std::size_t _array_dim, double* _array);
//%typemap(in) (std::size_t N, const std::size_t* x) = (std::size_t _arrayview_dim, std::size_t* _arrayview);
//%typemap(in) (std::size_t N, const int* x) = (std::size_t _arrayview_dim, int* _arrayview);
//%typemap(in) (std::size_t N, const double* x) = (std::size_t _arrayview_dim, double* _arrayview);
//-----------------------------------------------------------------------------
// Ignores for Hierarchical
//-----------------------------------------------------------------------------
%ignore dolfin::Hierarchical::operator=;
//-----------------------------------------------------------------------------
// Ignore all foo and rename foo_shared_ptr to _foo
//-----------------------------------------------------------------------------
%ignore dolfin::Hierarchical::parent;
%rename(_parent) dolfin::Hierarchical::parent_shared_ptr;
%ignore dolfin::Hierarchical::child;
%rename(_child) dolfin::Hierarchical::child_shared_ptr;
%ignore dolfin::Hierarchical::root_node;
%rename(_root_node) dolfin::Hierarchical::root_node_shared_ptr;
%ignore dolfin::Hierarchical::leaf_node;
%rename(_leaf_node) dolfin::Hierarchical::leaf_node_shared_ptr;
//-----------------------------------------------------------------------------
// Ignores for Variable
//-----------------------------------------------------------------------------
%ignore dolfin::Variable::operator=;
//-----------------------------------------------------------------------------
// Ignores for SubSystemsManager
//-----------------------------------------------------------------------------
// Would not be useful from Python without further tweaking probably
%ignore dolfin::SubSystemsManager::PetscDolfinErrorHandler;
|