📄 mainwzpointtest.html
字号:
<TITLE>WZ 1.1: Point data</TITLE><H1>Point Data</H1> <P>Points are often used in COG, in the geometry description as wellas in the grid generation.<PRE>#include "<A HREF="wzpoint.hxx">wzpoint.hxx</A>"</PRE> <P>An interesting property of the class <B>wzPoint</B> is that afterconstruction only the coordinates of the point are defined, but thepoint itself is still invalid. To make the point valid, the <A HREF="mainwzsegmenttest.html">segment</A> of the point should bedefined.<PRE>int main(){ wzPoint p0,p1(0.1),p2(0.1,0,2),p3(0.1,0.2,0.3); now(p0.invalid()); now(p1.invalid()); now(p2.invalid()); now(p3.invalid()); p0.segment()=wzRegion(2); p1.segment()=wzFace(1); p2.segment()=wzEdge(1); p3.segment()=wzVertex(1); now(p0.valid()); now(p0.inRegion()); now(p0.region()==2); now(p0.codim()==0); now(p1.valid()); now(p1.onFace()); now(p1.face()==1); now(p1.codim()==1); now(p2.valid()); now(p2.onEdge()); now(p2.edge()==1); now(p2.codim()==2); now(p3.valid()); now(p3.isVertex()); now(p3.vertex()==1); now(p3.codim()==3);</PRE> <P>The reason for this choice was that this definition is the resultof a nontrivial operation - geometry description.<H3>Coordinates</H3> <P>For every point, <B>wzPoint::Dim</B> coordinates are defined.There are various syntactic possibilities to access them:<PRE> p0.x() = 0.1; now(p0[0]==0.1); now(p0.X[0]==0.1); p0.y() = 0.1; now(p0[1]==0.1); now(p0.X[1]==0.1); p0.z() = 0.1; now(p0[2]==0.1); now(p0.X[2]==0.1);</PRE> <P>There are also <B>wzPoint::DimFloat</B> additional floating pointvalues. Again, there are various syntactic access possibilities:<PRE> p0.f() = 0.1; now(p0.f(0)==0.1); if(p0.floatValues()>2){ p0.g() = 0.2; now(p0.f(1)==0.2); p0.h() = 0.3; now(p0.f(2)==0.3); }</PRE> <P>There are also <B>wzPoint::DimIndex</B> additional indexvalues. Again, there are various syntactic access possibilities:<PRE> p0.i() = 1; now(p0.i(0)==1); if(p0.indexValues()>2){ p0.j() = 2; now(p0.i(1)==2); p0.k() = 2; now(p0.i(2)==2); }</PRE><A NAME="baddim"> <hr></A><H3>About the dimensions</H3> <P>The standard values of the parameters (initialized in <A HREF="wzpoint.cxx"> wzpoint.cxx</A> are the constants<B>wzPointDim</B>, <B>wzPointDimFloat</B>, <B>wzPointDimIndex</B>defined in <A HREF="wzpoint.hxx"> wzpoint.hxx</A>. They may bechanged during runtime with <B>setSpaceDimension</B>,<B>setFloatValues</B> and <B>setIndexValues</B>. But they should notbecome greater than the constants:<PRE> p0.setSpaceDimension(2); p0.setFloatValues(0); p0.setIndexValues(0); try{ p0.setSpaceDimension(wzPointDim+1); should_fail(); }catch(wzError e){;} try{ p0.setFloatValues(wzPointDimFloat+1); should_fail(); }catch(wzError e){;} try{ p0.setIndexValues(wzPointDimIndex+1); should_fail(); }catch(wzError e){;}</PRE> <P>The designed purpose of making them smaller is to make somefunctions like copy-operations and scalar products faster. To allowmore function values, you should modify the constants<B>wzPointDim</B>, <B>wzPointDimFloat</B>, <B>wzPointDimIndex</B>defined in <A HREF="wzpoint.hxx"> wzpoint.hxx</A> and recompile thewhole package.<A NAME="End"> <hr></A> <P>You can test this code with: <BR> <BR><B>>cog main wzpoint</B> <BR> <BR>The output should be simply: <BR> <BR><B>success</B><PRE> fine();}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -