dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #16552
Re: [HG DOLFIN] Remove geometric dimension from Constant. Some demos broken still.
On Sat, Nov 14, 2009 at 05:53:38PM +0000, Garth N. Wells wrote:
> 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.
ok, let's do this.
> >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.
True, and it's good to break the interface if it means we will have a
better interface once we reach 1.0, which might also imply less
changes after 1.0 if that interface is good.
--
Anders
Attachment:
signature.asc
Description: Digital signature
References