← Back to team overview

dolfin team mailing list archive

Re: Re: [PETSC #13198] Re: trouble with FeNiCS

 

Anders Logg <logg@xxxxxxxxx> writes:

> I'm a little confused...
>
> Matt says:
>
>    This flag says:
>  
>    1) You configured with --with-clanguage=C++ so that the C++
>    compiler is used to compile the libraries.
>
> Barry says:
>
>     If PETSc is configured to compile with the C++ compiler
>     --with-clanguage=c++ then this flag should NOT be used
>
> Which is it?

  We both say that using this flag is not recommended. It does have the effect
of demangling the PETSc symbols.

> Which is the default? If I just do
>
>     ./config/configure.py
>     make BOPT=g_c++
>     make BOPT=O_c++
>
> then I should not need this flag, right?
>

        Yes.

> If someone needs it, that means he (Andy) did something different when
> compiling PETSc?

  Yes, that means he wants to call a C++ PETSc from C code.

       Matt

> /Anders
>
> On Tue, Jun 14, 2005 at 02:49:37PM -0500, Matthew Knepley wrote:
>> Anders Logg <logg@xxxxxxxxx> writes:
>> 
>>        This flag says:
>> 
>>   1) You configured with --with-clanguage=C++ so that the C++ compiler is used to
>>      compile the libraries.
>> 
>>   2) The PETSc symbols are NOT mangled when using PETSC_USE_EXTERN_CXX so C code
>>      can call these symbols.
>> 
>> This is not are normal mode. We believe if you want to compile with C++, then you
>> want mangled symbols.
>> 
>>      Thanks,
>> 
>>         Matt
>> 
>> > I think we added a
>> >
>> > PETSC_CFLAGS="$PETSC_CFLAGS -DPETSC_USE_EXTERN_CXX"
>> >
>> > just below the definition of PETSC_CFLAGS in configure.ac.  You need
>> > to add this, then run scripts/preconfigure and then ./configure again.
>> >
>> > We get PETSC_CFLAGS by
>> >
>> > PETSC_CFLAGS=`make -s -C $PETSC_DIR getincludedirs PETSC_DIR=$PETSC_DIR BOPT=$BOPT`
>> >
>> > which I think should be enough. I don't know why the extra
>> > -DPETSC_USE_EXTERN_CXX helps on some systems or why it's not included
>> > with getincludedirs.
>> >
>> > /Anders
>> >
>> > On Tue, Jun 14, 2005 at 01:38:05PM -0500, Andy Ray Terrel wrote:
>> >> Sorry to bother you again.  But when I tried to run some things with 
>> >> dolfin I just got a PETSc Error.  So I tried to rebuild but remembered 
>> >> that when I built the first time I had to add some linker to PETSc 
>> >> somewhere.  Well I have forgotten what it was we added to get PETSc to 
>> >> link.  Do you remember?
>> >> 
>> >> Andy
>> >> 
>> >> Anders Logg wrote:
>> >> 
>> >> >You need to do A and B separately, as two different forms in two
>> >> >different files.
>> >> >
>> >> >In the first file, do something like
>> >> >
>> >> >   vector = FiniteElement("Vector Lagrange", "triangle", 1)
>> >> >
>> >> >   v = BasisFunction(vector)
>> >> >   u = BasisFunction(vector)
>> >> >
>> >> >   a = v.dx(i)*u.dx(i)*dx
>> >> >
>> >> >In the second file, do something like
>> >> >
>> >> >   vector = FiniteElement("Vector Lagrange", "triangle", 1)
>> >> >   scalar = FiniteElement("Lagrange", "triangle", 1)
>> >> >   
>> >> >   q = BasisFunction(scalar)
>> >> >   u = BasisFunction(vector)
>> >> >
>> >> >   a = q*u[i].dx(i)*dx
>> >> >
>> >> >Compile each form and then assemble separately in DOLFIN to get A and B.
>> >> >You can then either combine A and B to get the full matrix, or you can
>> >> >do fixed-point iteration, or you can create something called a
>> >> >"VirtualMatrix" in DOLFIN which implements the matrix-vector product
>> >> >for the full matrix in terms of A and B.
>> >> >
>> >> >Hope this helps. Ask me again when you need more help.
>> >> >
>> >> >/Anders
>> >> >
>> >> >On Tue, Jun 14, 2005 at 09:48:43AM -0500, Andy Terrel wrote:
>> >> > 
>> >> >
>> >> >>Hey Anders,
>> >> >>
>> >> >>I am having some trouble figuring out how to write some stokes equations 
>> >> >>up for my project.  So I have the forms:
>> >> >>
>> >> >>a = v.dx(j) *u.dy(j)
>> >> >>b= q*r*dx
>> >> >>
>> >> >>and I want to construct the matrix C s.t.
>> >> >>   [ A   B^t  ]
>> >> >>C=[ B    0     ]
>> >> >>
>> >> >>This is so I can call some mixed methods for the solving of the problem 
>> >> >>to get the benchmarking results.
>> >> >>
>> >> >>If you have time can you help me?
>> >> >>
>> >> >>Andy
>> >> >>
>> >> >>PS This is to solve (grad(u), grad(v)) - (p, div(v)) = 0,
>> >> >>                           (div(u), w) = 0.
>> >> >>
>> >> >>   
>> >> >>
>> >> >
>> >> > 
>> >> >
>> >> 
>> >
>> >
>> >
>> >
>> 
>
> -- 
> Anders Logg
> Research Assistant Professor
> Toyota Technological Institute at Chicago
> http://www.tti-c.org/logg/
>
>
>

-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness



Follow ups

References