← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Remove geometric dimension from Constant. Some demos broken still.

 

On Nov 14 2009, Anders Logg wrote:

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.


This would be good. It would also improve code safety.
It might also require minimal changes in the code since

1. We can use that std::vector is contiguous in memory.

2. We can allow double* as an optional eval version in C++ so as not
to break user code (if we think that's important enough).


Breaking things has never bothered us.

Garth

--
Anders


> changeset: 7441:a80d21459db0 parent: 7440:f6935b64eb40 parent: > 7439:cd6e4b6b38a9 user: Anders Logg <logg@xxxxxxxxx> date: Thu Nov 12 > 11:18:57 2009 +0100 files: demo/pde/adaptive-poisson/cpp/README > demo/pde/adaptive-poisson/python/demo.py description: merge
>
>
> changeset: 7440:f6935b64eb40 parent: 7431:9edad639d7e7 user: Anders > Logg <logg@xxxxxxxxx> date: Thu Nov 12 11:18:53 2009 +0100 files: > dolfin/adaptivity/AdaptiveObjects.cpp dolfin/fem/BoundaryCondition.h > dolfin/fem/DirichletBC.h sandbox/misc/cpp/SConstruct > sandbox/misc/cpp/main.cpp description: Implement refinement of > boundary conditions (untested).
>
> ----------------------------------------------------------------------
> For more details, visit http://www.fenics.org/hg/dolfin
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev




Follow ups

References