Programs for generating segments of a torus.


2 programs are supplied with the CPO3D package.

(1) ‘Torus1’ (the older program) generates the segments of a torus (or part of a torus), which is complete around the internal axis of the torus but the axis itself can have a limited angular range. The surface is subdivided into triangles (the number of which can be large).

(1) ‘Torus2’ generates the segments of a part of a torus, which is split into a series of cones.


The compiled versions can be activated by the commands ‘torus1’ or ‘torus2’. The programs themselves are also supplied, as ‘torus1.f90’ and ‘torus2.cpp’.



A torus is a circle that has been rotated around an axis that is in the plane of the circle (and that usually lies outside the circle). Both torus1 and torus2 require that an input data file be prepared in advance, containing all the relevant parameters. Examples of these input data files are provided, torus1.dat and torus2.dat.

Both programs put the output data in a file that can then be manually pasted into the correct position in a cpo3d input data file.

Information about the methods used can be found in the codes torus1.f90 and ! torus2.cpp.


The differences between torus1 (the older program) and torus 2 are:

Torus1 simply reads an input data file called tempin.dat and enters the results in the output file tempout.dat, while torus2 presents a screen on which the names of the input and output files can be entered. Some information is also given in the torus2 screen.

Torus1 generates individual triangles (usually a large number), while torus2 generates cones that are divided into triangles by cpo3d.

Torus1 generates a complete torus but the parts that are output can be limited, while torus 2 generates a rotated arc -so to create a complete torus the concave and convex halves have to be generated separately. Torus2 enables the clipping option to be used.

Torus1 allows dielectric information to be generated, while this is not possible for torus2 because cones cannot be used as dielectric electrodes (because it is not possible to define unique 'inner' or 'outer' points).

Torus1 allows any orientation of the axis of the torus, while torus2 allows only the x, y or z axes (although the 'transform' option of cpo3d can of course be used to rotate an object).


We recommend torus2 as being the better program for most simulations.


Examples are given in shap2d02, shap3d16, shap3d18, shap3d32 and xmpl3d89.

Please also see the powerful option for users to use their own equations to define electrode shapes.