From a662c405f25817460429744f059b8c00faa0e0c8 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Tue, 16 Mar 2010 23:02:14 +0100 Subject: [PATCH] Helix using Parameter... auto meshing needed... --- examples/FDTD_examples.cpp | 7 +++++- examples/Helix.xml | 45 +++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/examples/FDTD_examples.cpp b/examples/FDTD_examples.cpp index d028fb4..4be87c3 100644 --- a/examples/FDTD_examples.cpp +++ b/examples/FDTD_examples.cpp @@ -612,11 +612,16 @@ void BuildHelix(const char* filename) double wire_rad = 0.7; double coil_rad = 10; double coil_length = 50; + int coil_turns = 8; double delta[] = {0.5,0.5,0.5}; CSPrimBox* box = NULL; ParameterSet* PS = CSX.GetParameterSet(); + PS->AddParameter(new Parameter("rad_coil",coil_rad)); + PS->AddParameter(new Parameter("rad_wire",wire_rad)); + PS->AddParameter(new Parameter("turns",coil_turns)); + PS->AddParameter(new Parameter("coil_length",coil_length)); CSPropMaterial* copper = new CSPropMaterial(CSX.GetParameterSet()); copper->SetKappa(56e6); @@ -625,7 +630,7 @@ void BuildHelix(const char* filename) CSPrimUserDefined* helix = new CSPrimUserDefined(CSX.GetParameterSet(),copper); helix->SetCoordSystem(CSPrimUserDefined::CYLINDER_SYSTEM); - helix->SetFunction("(r>9.3)&(r<10.7)&(sqrt(pow(x-r*cos(2*pi*z/6.25),2)+pow(y-r*sin(2*pi*z/6.25),2))<1.4)&(z>0)&(z<50)"); + helix->SetFunction("(r>(rad_coil-rad_wire))&(r0)&(zSetRadius(wire_rad); diff --git a/examples/Helix.xml b/examples/Helix.xml index 765e377..9a473ef 100644 --- a/examples/Helix.xml +++ b/examples/Helix.xml @@ -10,11 +10,16 @@ -35,-25,-20,-15,-12,-11,-10.5,-10,-9.5,-9,-8.5,-8,-7.5,-7,-6.5,-6,-5.5,-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,12,13,15,17.5,20,25,35 -25,-15,-10,-5,-2,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26,26.5,27,27.5,28,28.5,29,29.5,30,30.5,31,31.5,32,32.5,33,33.5,34,34.5,35,35.5,36,36.5,37,37.5,38,38.5,39,39.5,40,40.5,41,41.5,42,42.5,43,43.5,44,44.5,45,45.5,46,46.5,47,47.5,48,48.5,49,49.5,50,50.5,51,52,53,55,57.5,60,65,75 - + + + + + + - - + + @@ -23,8 +28,8 @@ - - + + @@ -33,38 +38,38 @@ - - + + - - - - - - - - + - - + + + + + + + + + - (r>9.3)&(r<10.7)&(sqrt(pow(x-r*cos(2*pi*z/6.25),2)+pow(y-r*sin(2*pi*z/6.25),2))<1.4)&(z>0)&(z<50) + (r>(rad_coil-rad_wire))&(r<rad_coil+rad_wire)&(sqrt(pow(x-r*cos(2*pi*z*turns/coil_length),2)+pow(y-r*sin(2*pi*z*turns/coil_length),2))<(2*rad_wire))&(z>0)&(z<coil_length) @@ -87,8 +92,8 @@ - - + +