The SIMION SL Toolkit (version 1.2.1.0 - 2004-11-09) |
swirl.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <iostream>
00011 #include <cmath>
00012
00013 #include <simion/pa.h>
00014
00015 using namespace std;
00016 using namespace simion;
00017
00018 const double pi = 3.141592;
00019
00020 int main()
00021 {
00022 cout << "Generating swirl.pa# file....\n";
00023
00024
00025 PA pa( PAArgs().nx(100).ny(100).nz(100));
00026
00027
00028 for( int x = 0; x < pa. nx(); x++) {
00029 for( int y = 0; y < pa. ny(); y++) {
00030 for( int z = 0; z < pa. nz(); z++) {
00031
00032 int dx = x - 50;
00033 int dy = y - 50;
00034 double radius = sqrt(( double)(dx * dx + dy * dy));
00035 double theta = atan2(( double)dy, ( double)dx);
00036
00037 double omega = pi + theta + ( double)z/5;
00038
00039 while( omega >= 2* pi)
00040 omega -= 2* pi;
00041
00042 bool is_electrode = (radius > 30 && radius < 35 && omega < 2);
00043 double voltage = 1;
00044
00045
00046 if(is_electrode) pa. point(x, y, z, true, voltage);
00047 }}}
00048
00049
00050 pa. save( "swirl.pa#");
00051
00052 cout << "done\n";
00053
00054 return 0;
00055 }
00056
(c) 2003-2004. Scientific Instrument Services, Inc. All Rights Reserved.
|
Please report any errors/comments regarding this web page: