[Dune] communication of dynamic vectors

Fallahi Arya Arya.Fallahi at psi.ch
Thu Mar 15 00:48:02 CET 2012


Hi Martin, Andreas and Christian,

First thanks a lot for your quick replies and your guesses. Actually, I thought I was clear enough and have written the whole required things, but it seems I was wrong. Sorry for the disturbance. I thought maybe you already had faced with such an issue.

As I mentioned in my first email, I receive error when the template "Vector" is set to "DynamicVector" and it runs ok when it is set to "FieldVector". Furthermore, I am using ALUGrid.

The code compiles correctly and completely, so the error does not happen during the compilation. The error was returned by C++ during the runtime, exactly when the communication is to be fulfilled. I myself could actually understand nothing from the message, but if it may be helpful I will send it tomorrow morning, because I should run the code again to see the error.

The reason I want to use "DynamicVector" is that the dimensions of the vector is found by a function at the very beginning of the code. So, although it never changes in the code, it can not be of type "const". That's the reason I am trying to use "DynamicVector" instead of "FieldVector" as the template parameter (referenced by "Vector"). Perhaps, the suggestion that the fixedsize is not true is the sort of the problem. I will check it again and let you know tomorrow, when I send you the error message.

Thanks again for your support,
Arya



-----Original Message-----
From: dune-bounces+arya.fallahi=psi.ch at dune-project.org on behalf of Martin Nolte
Sent: Wed 3/14/2012 8:58 PM
To: dune at dune-project.org
Subject: Re: [Dune] communication of dynamic vectors
 
Hi Arya,

Sorry, but any answer to your request would be pure guess work. What kind of 
error message are you referring to (compiler error, runtime exception, 
assertion, undefined behavior, ...). Moreover, the code is absolutely useless, 
because you are not stating the template arguments. For example: What is Vector? 
Not to mention: What grid are you using?

Maybe you could you even provide a simple example program and file a correct bug 
report? This would potentially allow us to reproduce the error and give you a 
helpful answer.

Please note: Even writing such a reply takes a lot of time and DUNE' development 
team is rather small, its support team is even non-existent. If you want useful 
answers (unlike the one I just wrote), you might want to consider writing 
understandable or reproducible questions.

Best,

Martin

On 03/14/2012 07:27 PM, arya fallahi wrote:
> Dear Dune team,
>
> Recently, I have had a problem with the communication of variables with type
> DynamicVector. I have the following communicator inside a code, which is written
> in accordance with the Dune guide notes:
>
> template<classElementMapper, classVector>
> classDataHandle: publicDune::CommDataHandleIF<DataHandle<ElementMapper,Vector>,
> typenameVector::value_type>
> {
>
> public:
> typedeftypenameVector::value_typeDataType;
> bool contains (int dim, int codim) const { return (codim==0); }
> bool fixedsize (int dim, int codim) const {returntrue; }
>
> template<classEntityType> size_t size (EntityType& e) const { return(1); }
>
> template<classMessageBuffer, classEntityType>
> void gather (MessageBuffer& buff, const EntityType& e) const
> {
> unsigned int globalElementIndex=elementMapper_.map(e);
> buff.write(v_[globalElementIndex]);
> }
>
> template<classMessageBuffer, classEntityType>
> void scatter (MessageBuffer& buff, const EntityType& e, size_t n)
> {
> DataType x;
> buff.read(x);
> unsigned int globalElementIndex=elementMapper_.map(e);
> v_[globalElementIndex] = x;
> }
>
> DataHandle (const ElementMapper& elementMapper, Vector& v):
> elementMapper_(elementMapper),v_(v){}
>
> private:
> constElementMapper& elementMapper_;
> Vector& v_;
> };
>
> This works well when variables with type FieldVector
> (Dune::FieldVector<double,6>) are going to be communicated. However, when I want
> to communicate DynamicVector (Dune::DynamicVector<double>) data, the code stops
> and I receive an error message. I believe the problem lies in the communication
> part, since the code with DynamicVector works well on 1 processor. Do you have
> any idea why such a thing happens? Have you previously faced with this problem?
>
> Best regards and thanks,
>
> Arya Fallahi,
> Dr. sc. techn. ETH,
> Computational Accelerator Scientist
> Paul Scherrer Institute (PSI),
> CH-5232 Villigen, Switzerland,
> arya.fallahi at psi.ch <mailto:arya.fallahi at psi.ch>,
> +41(0)56 310 50 17
>
>
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany

_______________________________________________
Dune mailing list
Dune at dune-project.org
http://lists.dune-project.org/mailman/listinfo/dune





More information about the Dune mailing list