← Back to team overview

dolfin team mailing list archive

Re: discrete function initialization

 

Yes, I believe everything is OK now.

Jake

Anders Logg wrote:
On Tue, Jan 15, 2008 at 10:08:10PM -0500, Jake Ostien wrote:
Anders Logg wrote:
On Tue, Jan 15, 2008 at 03:29:27PM -0500, Jake Ostien wrote:
Firstly, I am trying to update my code to the latest version of DOLFIN (pulled today). I am getting an assertion error while trying to initialize a discrete vector (which obviously worked previously, say the 0.7.1 release). Here is the general flavor of what I am doing

<In the constructor of a NonlinearProblem class>

BilinearForm a;
LinearForm L(f, g, h);

Vector vec;
Function func;

func.init(mesh, vec, *L, 3);
The last argument seems suspicious. You have a form with only three
arguments and you ask for the forth function space associated with the
form. If you want a Function corresponding to the h function, try with
a 2 instead.
DiscreteFunction::init computes num_arguments = form.rank() + form.num_coefficients() as a check. I read that as providing basically an offset (by the form rank) of the argument number. This previously worked for me, and I never argued with a success, even though the convention you imply is more intuitive.

But now in the operator[], dof_map_set.size() only seems to be as large as the form rank. So taking my actual code (not an example) I have in my constructor

< some stuff >

a = new DGSGPaBilinearForm(tan, n, h, alpha, k, mu, lambda, plastic_flag);

< some other stuff >

plastic_flag.init(mesh, pflag_vec, *a, 9)

which made sense if you take a rank two form (0,1) plus the arguments (2,3,4,5,6,7,8,9). After the update in the DofMapSet::operator[] method dof_map_set.size() is 2 and i is 9, so obviously the assertion fails. Now, curiously, when I go back and check the version I was using, I see different behavior, such that the operator[] is never called during construction. I'm confused about this, so I'll look some more, but I'm open to suggestions from anyone who knows the system better than me.

Does it work now?




References