Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Can someone explain how BaseVectors work in compound spaces?

More
3 years 2 months ago #3536 by JSR
Apologies for what is probably and incredibly basic question, but I can't seem to find anything about this in the documentation, and the "help" function isn't helping. Could someone clarify what gfu.vec and gfu.vec.data represent for functions in a CompoundFESpace?

For a non-compound space, I gather that gfu.vec is a BaseVector object which stores the raw coefficient values of gfu in gfu.vec.data. When you work in a compound space, you have a new attribute, gfu.vecs, which as far as I can tell is just a list of BaseVectors.

The thing that confuses me is that GridFunctions in CompoundFESpaces still have a "vec" attribute. What do gfu.vec and gfu.vec.data represent in a compound space? Are they just a convenient concatenation of the individual BaseVectors stored in gfu.vecs, or is there something else going on?
More
3 years 2 months ago - 3 years 2 months ago #3545 by christopher
Hi,

for a compound space gfu.vec also stores the values of the coefficient values for the compound space. The first ndof components are of the first space then second space and so on. You can get the individual vectors from the component gridfunction.
Code:
gfu.components[i].vec
gives you the i-th vector. This gives you the slice belonging the i-th component.

gfu.vecs is for multidim GridFunctions (a gridfunction with many vectors) used for example in eigenvector computation. Each entry then is an eigenvector. The GridFunction needs to be created using the multidim argument for this, see for example docu.ngsolve.org/latest/i-tutorials/unit...well/Maxwellevp.html

Best
Christopher
Last edit: 3 years 2 months ago by christopher.
More
3 years 2 months ago - 3 years 2 months ago #3546 by joachim
Hi,

also the compound space allocates one linear vector.
It is equivalent whether
(a) you read/write to a range (interval) of the long vector, or
(b) access the vector of one of its component gridfunctions

Here an example,

Joachim
Attachments:
Last edit: 3 years 2 months ago by joachim.
Time to create page: 0.125 seconds