On Sat, Nov 14, 2009 at 11:35:35AM +0000, Garth N. Wells wrote:
DOLFIN wrote:
> One or more new changesets pushed to the primary dolfin repository.
> A short summary of the last three changesets is included below.
>
> changeset: 7442:a409a2b179f1 tag: tip user: "Garth N. Wells
> <gnw20@xxxxxxxxx>" date: Fri Nov 13 19:08:44 2009 +0000 files:
> demo/pde/advection-diffusion/cpp/main.cpp demo/pde/bcs/cpp/main.cpp
> demo/pde/cahn-hilliard/cpp/main.cpp demo/pde/curl-curl/cpp/main.cpp
> demo/pde/elasticity/cpp/main.cpp demo/pde/elastodynamics/cpp/main.cpp
> demo/pde/equality/cpp/main.cpp demo/pde/nonlinear-poisson/cpp/main.cpp
> demo/pde/periodic/cpp/main.cpp demo/pde/poisson/cpp/main.cpp
> demo/pde/poisson1D/cpp/main.cpp
> demo/pde/stokes/stabilized/cpp/main.cpp
> demo/pde/stokes/taylor-hood/cpp/main.cpp
> demo/pde/sym-dirichlet-bc/cpp/main.cpp dolfin/function/Constant.cpp
> dolfin/function/Constant.h dolfin/function/Expression.cpp
> dolfin/function/Expression.h dolfin/function/SpecialFunctions.cpp
> dolfin/swig/docstrings.i dolfin/swig/function_pre.i description:
> Remove geometric dimension from Constant. Some demos broken still.
>
I had to comment out the below code in function_pre.i since I removed
Expression::geometric_dimension. I don't really understand how it works.
Garth
//-----------------------------------------------------------------------------
// Director typemap for coordinates in Expression
//-----------------------------------------------------------------------------
%typemap(directorin) const double* x {
{
// Compute size of x
npy_intp dims[1] = {this->geometric_dimension()};
$input = PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE,
reinterpret_cast<char *>(const_cast<double*>($1_name)));
}
}
When I first looked at your changes (the removal of geometric_dimension),
I couldn't understand why we had required it in the first place, but
this reminds me about why. I think it was added originally to let us
use exactly this typemap to map the x argument to a NumPy array in the
eval callback.
Johan can comment more on this. There might be a way around this.
One option could be to not use double* in the eval() function in
Expression but instead use std::vector<double>&. That would remove the
need for checking geometric_dimension to get the size of the array.