本文整理汇总了C++中Atomic::LocalIntegrand方法的典型用法代码示例。如果您正苦于以下问题:C++ Atomic::LocalIntegrand方法的具体用法?C++ Atomic::LocalIntegrand怎么用?C++ Atomic::LocalIntegrand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Atomic
的用法示例。
在下文中一共展示了Atomic::LocalIntegrand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiffOrder
void
Triangle_Processor::Divide(unsigned int N, Stack<AtomicRegion>& Offspring)
{
Stack<Triangle> Parts;
Vector<unsigned int> DiffOrder(Diffs.Size());
real NewVolume;
switch(N)
{
case 2:
{
NewVolume = Geometry().Volume()/2;
TheRule->ComputeDiffs(LocalIntegrand(),Geometry(),Diffs);
// Sort the differences in descending order.
for (unsigned int ik=0 ; ik<=2 ; ik++) { DiffOrder[ik] = ik; }
for (unsigned int i=0 ; i<=1 ; i++)
{
for (unsigned int k=i+1 ; k<=2 ; k++)
if (Diffs[DiffOrder[k]]>Diffs[DiffOrder[i]])
{
unsigned int h = DiffOrder[i];
DiffOrder[i] = DiffOrder[k];
DiffOrder[k] = h;
}
}
TheDivisor2->Apply (Geometry(),Parts,DiffOrder);
break;
}
case 4:
{
NewVolume = Geometry().Volume()/4;
TheDivisor4->Apply (Geometry(),Parts,DiffOrder);
break;
}
default:
{
NewVolume = Geometry().Volume()/N;
Error(True,"This kind of subdivision is not implemented");
}
}
for (unsigned int i =0;i<N;i++)
{
Triangle* g = Parts.Pop();
g->Volume(NewVolume);
Processor<Triangle>* p = Descendant();
Atomic<Triangle>* a = new Atomic<Triangle>(g,p);
a->LocalIntegrand(&LocalIntegrand());
Offspring.Push(a);
};
return;
}
示例2: Geometry
void
Triangle_Processor::Process( Stack<AtomicRegion>& Offspring)
{
TimesCalled ++;
if (TimesCalled == 1)
{
TheRule->Apply(LocalIntegrand(),Geometry(),Integral(),AbsoluteError());
Offspring.MakeEmpty();
return;
};
if(TimesCalled == 2)
{
real NewVolume
= Geometry().Volume()/2;
Stack<Triangle> Parts;
Vector<unsigned int> DiffOrder(Diffs.Size());
const real difffac = real(1)/real(0.45);
const real difftreshold = 1e-3;
TheRule->ComputeDiffs(LocalIntegrand(),Geometry(),Diffs);
// Sort the differences in descending order.
for (unsigned int ik=0 ; ik<=2 ; ik++) { DiffOrder[ik] = ik; }
for (unsigned int i=0 ; i<=1 ; i++)
{
for (unsigned int k=i+1 ; k<=2 ; k++)
if (Diffs[DiffOrder[k]]>Diffs[DiffOrder[i]])
{
unsigned int h = DiffOrder[i];
DiffOrder[i] = DiffOrder[k];
DiffOrder[k] = h;
}
}
if (Diffs[DiffOrder[0]] < difftreshold)
{
TheDivisor4->Apply(Geometry(),Parts,DiffOrder);
NewVolume /=2;
}
else
{
if (Diffs[DiffOrder[0]]>difffac*Diffs[DiffOrder[2]])
{
TheDivisor2->Apply (Geometry(),Parts,DiffOrder);
}
else
{
TheDivisor4->Apply(Geometry(),Parts,DiffOrder);
NewVolume /=2;
}
};
unsigned int N = Parts.Size();
for (unsigned int ii =0;ii<N;ii++)
{
Triangle* g = Parts.Pop();
g->Volume(NewVolume);
Processor<Triangle>* p = Descendant();
Atomic<Triangle>* a = new Atomic<Triangle>(g,p);
a->LocalIntegrand(&LocalIntegrand());
Offspring.Push(a);
};
return;
};
Error(TimesCalled > 2,
"Triangle_Processor : more than two calls of Process()");
}
示例3: rv
void
CircleAdaptive::Process(Stack<AtomicRegion>& Offspring)
{
Circle& C = Geometry();
static unsigned int mxgen=2;
//if (mxgen == 0)
//{
//std::cerr<<"How many times may I apply the circle rule? ";
//cin>>mxgen;
//};
TimesCalled++;
if(TimesCalled ==1)
{
if (GenerationNumber < mxgen)
{
TheRule->Apply(LocalIntegrand(),C,Integral(),AbsoluteError());
}
else
{
Point rv (C.Radius(),0);
Point bp = C.Center()+rv;
AtomicRegion* A ;
A= (AtomicRegion*) POLAR_RECTANGLE(C.Center(),bp,bp);
A->LocalIntegrand(&(LocalIntegrand()));
Offspring.Push(A);
};
}
else
{
const real CircleRatio = 0.44721359549995793928;
Point m1(C.Radius()*CircleRatio ,0.);
Point m2(C.Radius() , 0.);
Point m3(0.,C.Radius());
Point m4(0.,C.Radius()*CircleRatio);
Point origin=C.Center();
AtomicRegion*
t1=(AtomicRegion*) POLAR_RECTANGLE(origin+m1,origin+m2,origin+m3);
AtomicRegion*
t2=(AtomicRegion*) POLAR_RECTANGLE(origin+m4,origin+m3,origin-m2);
AtomicRegion*
t3=(AtomicRegion*) POLAR_RECTANGLE(origin-m1,origin-m2,origin-m3);
AtomicRegion*
t4=(AtomicRegion*) POLAR_RECTANGLE(origin-m4,origin-m3,origin+m2);
Offspring.Push(t1);
Offspring.Push(t2);
Offspring.Push(t3);
Offspring.Push(t4);
Offspring.IteratorReset();
while (!Offspring.IteratorAtEnd())
{
Offspring.IteratorNext()->LocalIntegrand(&LocalIntegrand());
};
if (CircleRatio != 0.0)
{
Circle* tmp = new Circle(origin,C.Radius()*CircleRatio);
Atomic<Circle>* a =new Atomic<Circle>(tmp,Descendant());
a->LocalIntegrand(&LocalIntegrand());
Offspring.Push(a);
};
};
}