📄 cogencomposite.cxx
字号:
#include "cogencomposite.hxx"
#include "cogenpoints.hxx"
cogenComposite CogenComposite::cogencomposite() const {return (CogenComposite*) this;}
class cogPairIntersection: public cogPairToSegment{
cogSegment operator()(cogSegment s1,cogSegment s2)
{if(s1.index()<s2.index()) return s1; return s2;}
};
class cogPairUnion: public cogPairToSegment{
cogSegment operator()(cogSegment s1,cogSegment s2)
{if(s1.index()>s2.index()) return s1; return s2;}
};
class cogPairSplit: public cogPairToSegment{
cogSegment operator()(cogSegment s1,cogSegment s2)
{if(s1 != single) return s1; return s2;}
cogSegment single;
public:
cogPairSplit(cogRegion r):single(r){;}
};
class cogPairOverlay: public cogPairToSegment{
cogSegment operator()(cogSegment s1,cogSegment s2)
{if(s1 == single) return s1; return s2;}
cogSegment single;
public:
cogPairOverlay(cogRegion s):single(s){;}
};
CogenUnion::CogenUnion()
:CogenComposite(new cogPairUnion,new cogPairUnion)
{;}
CogenIntersection::CogenIntersection()
:CogenComposite(new cogPairIntersection,new cogPairIntersection)
{;}
CogenSplit::CogenSplit(cogRegion r)
:CogenComposite(new cogPairSplit(r),new cogPairUnion)
{;}
CogenOverlay::CogenOverlay(cogRegion r)
:CogenComposite(new cogPairOverlay(r),new cogPairUnion)
{;}
CogenComposite::CogenComposite(cogPairToSegment *r, cogPairToSegment *f)
:region(r),face(f),
wzRange(sizeof(cogenerator)),
generator(base)
{
}
CogenComposite::~CogenComposite()
{
wzIndex i;
wzRangeLoop(*this,i){
generator[i] = 0;
}
}
wzIndex CogenComposite::Point(wzPoint& p0) const
{
cogSegment r0 = defaultRegion;
wzIndex i;
wzRangeLoop(*this,i){
generator[i]->geometry()->Point(p0);
r0 = (*region)(r0,p0.segment());
}
p0.segment() = r0;
return cogRCRegionFound;
}
/*
wzIndex CogenComposite::Line (cogFlag1& f, const cogLine& s) const
{
return Cogeometry::Line(f,s);
}
*/
wzIndex CogenComposite::BoundaryCondition(cogFlag1& f) const
{
cogSegment f0 = defaultFace;
wzIndex i;
wzRangeLoop(*this,i){
generator[i]->geometry()->BoundaryCondition(f);
f0 = (*face)(f0,f.p1.segment());
}
f.p1.segment() = f0;
return cogRCConditionFound;
}
wzIndex CogenComposite::add(cogenerator gen)
{
wzIndex i = create();
gen->endInitialization();
generator[i] = gen;
return i;
}
wzIndex CogenComposite::add(cogeometry geo)
{
cogenerator simple = new CogenPoints(new wzPointList,geo);
return add(simple);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -