G+Smo
24.08.0
Geometry + Simulation Modules
|
Info Stucture, which should keep track of the structure of the considered PDE and Discretization. This class brings together information about the different unknown and eachs components, which basis corresponds to which component and the transformation for the several unknowns.
It is assumed that we order the components consecutive, e.g. we have a PDE with 2 unknown, the first has 1 component and the second one 2. This means, we have in total 3 components, the first corresponds to unk 1 the second and the third to unk 2. If we want to have different solution and test spaces, we have the double ammount of components, where the second half corresponds to the trial variables. These have the same structure as the solution variables (same dimension of each variable). Each component (including the trial space) is assigned a basis, which might be equal. The purpose is to keep track, which basis belongs to which component, to prevent evaluation the same basis twice, which is a very costly part of IgA.
Furthermore, the class stores, which transformation is used for which unknown (all components of this unknown must have the same transformation). Only in the case of HGrad conforming transformation, the transformation applies to all components of the unknown in the same way. Hence, the transformation is connected to the whole unknown.
class gsAssemblerSetup { public:
Standard case is Poisson Case gsAssemblerSetup() { m_comp2basis.setOnes(1); m_unkDims.setOnes(1);
nUnk= 1; nComp = 1;
m_transforms.push_back (transform::Hgrad);
index_t c=0; m_unk2comp.resize(nUnk); m_comp2unk.resize(nComp); for(index_t unk=0; unk<nUnk;++unk) { m_unk2comp[unk].resize(m_unkDims[unk]); for(unsigned comp=0; comp<m_unkDims[unk];++comp,++c) { m_unk2comp[unk][comp]= c; m_comp2unk[c]=unk; } } }
initialize the info structure with your settings of the discretization and the PDE. comp2basis describes a map from every component (sequentially numbered) to each basis see also SparseSystem. This information is contained in both clases.
template<typename T> void init(const gsPde<T>& pde, const gsVector<index_t>& comp2basis) { m_comp2basis = comp2basis; m_unkDims= pde.unknownDim(); nUnk= m_unkDims.size(); nComp = m_unkDims.sum(); usingDifferentTrialSpaces = false; if(nComp==2*m_comp2basis.size()) usingDifferentTrialSpaces=true; else if(nComp!=m_comp2basis.size()) GISMO_ERROR("You messed up something, number of components does not match the ones from the PDE"); m_transforms.resize(nUnk); for(index_t unk=0; unk<nUnk;++unk) m_transforms[unk] = transform::Hgrad; index_t c=0; m_unk2comp.resize(nUnk); m_comp2unk.resize(nComp); for(index_t unk=0; unk<nUnk;++unk) { m_unk2comp[unk].resize(m_unkDims[unk]); for(unsigned comp=0; comp<m_unkDims[unk];++comp,++c) { m_unk2comp[unk][comp]= c; m_comp2unk[c]=unk; } } }
public:
Accessor funtions, to be completed.
inline bool trialSpaceNotIdentical() const {return usingDifferentTrialSpaces;} inline bool isTrialSpace(index_t compWithTrial) const {return compWithTrial>= nComp ? true: false;} inline index_t getUnk(index_t compWithTrial) const {return m_comp2unk[compWithTrial%nComp];} inline const gsVector<index_t>& getAllBasis() const {return m_comp2basis;} inline index_t getBasis(index_t compWithTrial) const {return m_comp2basis[compWithTrial];} inline index_t getBasis(index_t comp, bool testSpace) const { return m_comp2basis[usingDifferentTrialSpaces && testSpace ? comp+nComp : comp]; } inline index_t getBasis(index_t unk, index_t comp_unk, bool testSpace=false) const { return getBasis(m_unk2comp[unk][comp_unk], testSpace); } inline void setTransform(index_t unk, transform::type trans) { m_transforms[unk]=trans;} inline const transform::type& getTransform(index_t unk)const {return m_transforms[unk];} inline const gsVector<index_t> & getComp(index_t unk)const {return m_unk2comp[unk];} inline const gsVector<unsigned>& unknownDims() const { return m_unkDims; } inline unsigned unknownDims(index_t unk) const { return m_unkDims[unk]; } inline index_t nUnknown() const { return nUnk; } inline index_t nComponents(bool withTrialSpace=false) const { return withTrialSpace ? 2*nComp : nComp ; }
private:
gsVector<index_t> m_comp2basis; gsVector<unsigned> m_unkDims; std::vector<transform::type> m_transforms; std::vector<gsVector< index_t> > m_unk2comp; std::vector< index_t> m_comp2unk; index_t nUnk; index_t nComp; bool usingDifferentTrialSpaces;
};