[Trilinos-Users] EpetraVector, BlockMap, GID and LID
pamstad at student.ethz.ch
Sun May 12 06:41:18 EDT 2019
I think I have a general problem with the understanding of BlockMaps, and EpetraVector and my last hope is this mailing list. My Goal is (as a simplified example):
* Let's assume I have a beam, discretised in a way that it has six nodes. Each node has two degrees of freedom (DOF); one in the x-direction and anotherone in the y-direction (I assume a cartesian coordinate system)
* My goal is now, that I can specify for each node a desired displacement. So let's say I want to displace node 3 by one unit in the x-direction and by 0.5 units in the y-direction. This information, by how much each node gets displaced, I want to store in the EpetraVector and want to access it later.
* My Problem is now; I have no idea how I can access these individual DOF from the BlockMap; any idea?
How do I get these informations from the BlockMap and how can fill my EpetraVector? A code snippet below, how I wanted to do this:
// Create P1 VectorEpetra
VectorEpetra p1PositionVector (p1dFESpace.map());
Int p1nCompLocalDof = p1PositionVector.epetraVector().MyLength() / 3; //My Length returns length of EpetraVector on calling processor
for (int j (0); j < p1nCompLocalDof; j++)
UInt iGID = p1PositionVector.blockMap().GID (j);
UInt jGID = p1PositionVector.blockMap().GID (j + p1nCompLocalDof);
UInt kGID = p1PositionVector.blockMap().GID (j + 2 * p1nCompLocalDof);
p1PositionVector[iGID] = 1.0 ;
p1PositionVector[jGID] = 0.5 ; //Here I want to specify the displacements of the nodes; for example displacement of 1.0 in x-direction; 0.5 in y-direction
p1PositionVector[kGID] = 0.0 ;
The result I get from this, is that for example node 5 instead of node 3 gets the displacement specified; so I have problems to access specific nodes.
Thanks for an answer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Trilinos-Users