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?
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.
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 2.4.1 Maxwell eigenvalue problem — NGS-Py 6.2.2302 documentation
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