[Dune] communication of dynamic vectors
arya fallahi
arya.fallahi at psi.ch
Wed Mar 14 19:27:27 CET 2012
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<class ElementMapper, class Vector>
class DataHandle : public Dune::CommDataHandleIF<DataHandle<ElementMapper,Vector>, typename Vector::value_type>
{
public:
typedef typename Vector::value_type DataType;
bool contains (int dim, int codim) const { return (codim==0); }
bool fixedsize (int dim, int codim) const { return true; }
template<class EntityType> size_t size (EntityType& e) const { return(1); }
template<class MessageBuffer, class EntityType>
void gather (MessageBuffer& buff, const EntityType& e) const
{
unsigned int globalElementIndex=elementMapper_.map(e);
buff.write(v_[globalElementIndex]);
}
template<class MessageBuffer, class EntityType>
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:
const ElementMapper& 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,
+41(0)56 310 50 17
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120314/fbcb37cc/attachment.htm>
More information about the Dune
mailing list