thank you,

I'm fine with creating a child of FunctionBase.
Will it be enough to override only the component() method?
Michael.

On 6/15/2017 5:08 PM, Roy Stogner wrote:

On Thu, 15 Jun 2017, Michael Povolotskyi wrote:

AnalyticFunction<> dirichlet_function_object(zero1);

void zero1(DenseVector<Number> & output,
                    const Point & p,
                    const Real)
{
 output(0) = 0;  output(1) = 0;
  output(2) = 10; output(3) = 10;

}

Unfortunately, this does not work. Somehow argument output in the function zero1 has 2 components. Most likely I'm doing something wrong.

You're suffering from the interaction of a couple questionable design
decisions, is all.  Sorry!

AnalyticFunction::component(i) only resizes output to be large enough
to fill i, because it doesn't actually know how large an output vector
your C function is ready to handle.

The internal dirichlet boundary constraint code iterates one variable
at a time, and uses component() to query values of just that variable,
because it's complicated enough code even without trying to project
multiple variables at once.

Could you, please, tell me how to achieve what I want

Most easily?  Just test output.size() and only fill indices below that
size.

Most efficiently?  Subclass FunctionBase yourself and override
component() too.

or point me to a similar example?

I don't think there is one!  introduction_ex4 and ex5 use
AnalyticFunction with DirichletBoundary, but only for a single
solution variable.  All the multi-variable DirichletBoundary examples
appear to be using subclassing.
---
Roy



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to