本文整理汇总了C++中MultiGrid::has_vertex_attachment方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiGrid::has_vertex_attachment方法的具体用法?C++ MultiGrid::has_vertex_attachment怎么用?C++ MultiGrid::has_vertex_attachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiGrid
的用法示例。
在下文中一共展示了MultiGrid::has_vertex_attachment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveGridHierarchyTransformed
bool SaveGridHierarchyTransformed(MultiGrid& mg, ISubsetHandler& sh,
const char* filename, number offset)
{
PROFILE_FUNC_GROUP("grid");
APosition aPos;
// uses auto-attach
Grid::AttachmentAccessor<Vertex, APosition> aaPos(mg, aPos, true);
// copy the existing position to aPos. We take care of dimension differences.
// Note: if the method was implemented for domains, this could be implemented
// in a nicer way.
if(mg.has_vertex_attachment(aPosition))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition, aPos);
else if(mg.has_vertex_attachment(aPosition2))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition2, aPos);
else if(mg.has_vertex_attachment(aPosition1))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition1, aPos);
// iterate through all vertices and apply an offset depending on their level.
for(size_t lvl = 0; lvl < mg.num_levels(); ++lvl){
for(VertexIterator iter = mg.begin<Vertex>(lvl);
iter != mg.end<Vertex>(lvl); ++iter)
{
aaPos[*iter].z() += (number)lvl * offset;
}
}
// finally save the grid
bool writeSuccess = SaveGridToFile(mg, sh, filename, aPos);
// clean up
mg.detach_from_vertices(aPos);
return writeSuccess;
}
示例2: TestGridLayoutMap
bool TestGridLayoutMap(MultiGrid& mg, GridLayoutMap& glm)
{
if(mg.has_vertex_attachment(aPosition))
return TestGridLayoutMap(mg, glm, aPosition);
else if(mg.has_vertex_attachment(aPosition2))
return TestGridLayoutMap(mg, glm, aPosition2);
else if(mg.has_vertex_attachment(aPosition1))
return TestGridLayoutMap(mg, glm, aPosition1);
else
UG_LOG("ERROR in TestGridLayoutMap: A standard position attachment"
" is required.\n");
return false;
}
示例3: SaveGridLevelToFile
bool SaveGridLevelToFile(MultiGrid& srcMG, ISubsetHandler& srcSH, int lvl, const char* filename)
{
// check whether one of the standard attachments is attached and call
// SaveGridLevel with that attachment
if(srcMG.has_vertex_attachment(aPosition))
return SaveGridLevel(srcMG, srcSH, lvl, filename, aPosition);
if(srcMG.has_vertex_attachment(aPosition2))
return SaveGridLevel(srcMG, srcSH, lvl, filename, aPosition2);
if(srcMG.has_vertex_attachment(aPosition1))
return SaveGridLevel(srcMG, srcSH, lvl, filename, aPosition1);
return false;
}
示例4: SaveSurfaceViewTransformed
bool SaveSurfaceViewTransformed(MultiGrid& mg, const SurfaceView& sv,
const char* filename, number offset)
{
PROFILE_FUNC_GROUP("grid");
APosition aPos;
// uses auto-attach
Grid::AttachmentAccessor<Vertex, APosition> aaPos(mg, aPos, true);
// copy the existing position to aPos. We take care of dimension differences.
// Note: if the method was implemented for domains, this could be implemented
// in a nicer way.
if(mg.has_vertex_attachment(aPosition))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition, aPos);
else if(mg.has_vertex_attachment(aPosition2))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition2, aPos);
else if(mg.has_vertex_attachment(aPosition1))
ConvertMathVectorAttachmentValues<Vertex>(mg, aPosition1, aPos);
// iterate through all vertices and apply an offset depending on their level.
for(size_t lvl = 0; lvl < mg.num_levels(); ++lvl){
for(VertexIterator iter = mg.begin<Vertex>(lvl);
iter != mg.end<Vertex>(lvl); ++iter)
{
aaPos[*iter].z() += (number)lvl * offset;
}
}
// create a subset handler which holds different subsets for the different interface types
SubsetHandler sh(mg);
AssignSubsetsBySurfaceViewState<Vertex>(sh, sv, mg);
AssignSubsetsBySurfaceViewState<Edge>(sh, sv, mg);
AssignSubsetsBySurfaceViewState<Face>(sh, sv, mg);
AssignSubsetsBySurfaceViewState<Volume>(sh, sv, mg);
AssignSubsetColors(sh);
EraseEmptySubsets(sh);
// finally save the grid
bool writeSuccess = SaveGridToFile(mg, sh, filename, aPos);
// clean up
mg.detach_from_vertices(aPos);
return writeSuccess;
}
示例5: CreateSmoothHierarchy
bool CreateSmoothHierarchy(MultiGrid& mg, size_t numRefs)
{
PROFILE_FUNC_GROUP("grid");
IRefinementCallback* refCallback = NULL;
// we're only checking for the main attachments here.
//todo: improve this - add a domain-based hierarchy creator.
if(mg.has_vertex_attachment(aPosition1))
refCallback = new SubdivisionLoopProjector<APosition1>(mg, aPosition1, aPosition1);
else if(mg.has_vertex_attachment(aPosition2))
refCallback = new SubdivisionLoopProjector<APosition2>(mg, aPosition2, aPosition2);
else if(mg.has_vertex_attachment(aPosition))
refCallback = new SubdivisionLoopProjector<APosition>(mg, aPosition, aPosition);
if(!refCallback){
UG_LOG("No standard position attachment found. Aborting.\n");
return false;
}
GlobalMultiGridRefiner ref(mg, refCallback);
for(size_t lvl = 0; lvl < numRefs; ++lvl){
ref.refine();
}
if(mg.has_vertex_attachment(aPosition1))
ProjectToLimitPLoop(mg, aPosition1, aPosition1);
else if(mg.has_vertex_attachment(aPosition2))
ProjectToLimitPLoop(mg, aPosition2, aPosition2);
else if(mg.has_vertex_attachment(aPosition))
ProjectToLimitPLoop(mg, aPosition, aPosition);
delete refCallback;
return true;
}