Last active
August 18, 2017 09:43
-
-
Save stephanmg/bab51a3b22400be731de98d4021b88f2 to your computer and use it in GitHub Desktop.
Test SCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename TGridFunction> | |
void TestenSCV(SmartPtr<TGridFunction> spGridFct, | |
const char* cmp, const char* subset) { | |
SmartPtr<ug::MultiGridSubsetHandler> spSh = spGridFct->domain().get()->subset_handler(); | |
ug::MultiGridSubsetHandler* sh = spSh.get(); | |
int si = sh->get_subset_index(subset); | |
UG_COND_THROW(si == -1, "Subset not present!"); | |
int grid_level = sh->num_levels()-1; | |
for (TetrahedronIterator iter = sh->begin<Tetrahedron>(si, grid_level); iter != sh->end<Tetrahedron>(si, grid_level); ++iter) { | |
Tetrahedron* t = *iter; | |
DimFV1Geometry<3> geo; | |
typedef ug::MathVector<3> position_type; | |
typedef Attachment<position_type> position_attachment_type; | |
typedef Grid::VertexAttachmentAccessor<position_attachment_type> position_accessor_type; | |
const position_accessor_type& aaPos = spGridFct->domain().get()->position_accessor(); | |
size_t numVertices=t->num_vertices(); | |
std::vector<ug::vector3> coCoord; | |
for (size_t i = 0; i < numVertices; ++i) { | |
coCoord.push_back(aaPos[t->vertex(i)]); | |
} | |
geo.update(t, &(coCoord[0]), spGridFct->domain().get()->subset_handler().get()); | |
for (size_t i=0;i < geo.num_scv();i++) { | |
const typename DimFV1Geometry<3>::SCV& scv = geo.scv(i); | |
const size_t nodeID = scv.node_id(); | |
const size_t fctID = spGridFct->fct_id_by_name(cmp); | |
std::vector<MultiIndex<2> > multInd; | |
Vertex* vrt = t->vertex(nodeID); | |
spGridFct->inner_dof_indices(vrt, fctID, multInd); | |
TGridFunction& u = *(spGridFct.get()); | |
UG_LOG_ALL_PROCS("Value: " << ug::BlockRef(u[ multInd[fctID][0] ], multInd[fctID][1]) << std::endl); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment