source: Sophya/trunk/SophyaPI/PIext/flowmodex.cc@ 1920

Last change on this file since 1920 was 1920, checked in by perderos, 24 years ago

1) ajout de commande pour trace de champ de vecteur
2) modif pour compil sous peida (pawexecut.cc) OP 06/03/2002

File size: 3.5 KB
RevLine 
[1920]1#include "flowmodex.h"
2#include "pi2dvec.h"
3
4#include <typeinfo>
5
6#include <vector>
7#include <string>
8#include "nobjmgr.h"
9#include "ntuple.h"
10
11#include "pidrawer.h"
12#include "nomgadapter.h"
13#include "servnobjm.h"
14
15
16/* --Methode-- */
17FlowModExecutor::FlowModExecutor(PIACmd* mpiac, PIStdImgApp* app)
18{
19
20
21 //cout << " FlowModExecutor::FlowModExecutor() mpiac = " << (unsigned long)mpiac << endl;
22 cout << " registration of flow chart commands "<<endl;
23 string hgrp,kw,usage;
24 hgrp = "Obj. Display";
25
26 kw = "nt2dvec";
27 usage = "Creates and displays a flow chart from ntuple variables";
28 usage += "\n Usage: nt2dvec x y vx vy [graphic_att] ";
29 mpiac->RegisterCommand(kw, usage, this, hgrp);
30
31
32 hgrp = "Expr. Plotting";
33 kw = "plot2dvec";
34 usage = "Creates and displays a flow chart from ntuple expressions ";
35 usage += "\n Usage: plot2dvec ntuple expx expy expvx expvy [cut graphic_att loop_par]";
36
37 mpiac->RegisterCommand(kw, usage, this, hgrp);
38
39 //cout << " Out of ContModExecutor::ContModExecutor() " << endl;
40
41}
42
43
44
45/* --Methode-- */
46FlowModExecutor::~FlowModExecutor()
47{
48}
49
50/* --Methode-- */
51int FlowModExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
52{
53
54int nz=-1;
55double z0,dz;
56PI2dVecDrawer *p2dv;
57string dopt="";
58NamedObjMgr omg;
59
60if ( kw == "nt2dvec") {
61
62
63 if (tokens.size() < 5) {
64 cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att]" << endl;
65 return(0);
66 }
67 NObjMgrAdapter* obja = omg.GetObjAdapter(tokens[0]);
68 if (obja == NULL) {
69 cout << "contour Error , No object with name " << tokens[0] << endl;
70 return(0);
71 }
72
73 if (tokens.size() > 5) dopt = tokens[5];
74 bool adel;
75
76 NTupleInterface *ntin = obja->GetNTupleInterface(adel);
77
78 p2dv = new PI2dVecDrawer(ntin,adel);
79 string expx,expy;
80 expx = tokens[1];
81 expy = tokens[2];
82 int ret = p2dv->SelectXY(expx.c_str(),expy.c_str());
83 if(ret<0){ cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att]" << endl; return(0);}
84 expx = tokens[3];
85 expy = tokens[4];
86 ret = p2dv->SelectVW(expx.c_str(),expy.c_str());
87 if(ret<0){ cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att ]" << endl; return(0);}
88
89 // On affiche le Drawer
90 int wrsid = 0;
91 bool fgsr = true;
92 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);
93
94 string name = "ChampVec";
95
96 wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt);
97
98}else if(kw == "plot2dvec"){
99
100
101 if (tokens.size() < 5) {
102 cout << "Usage: plot2dvec ntuple expx expy expvx expvy [cut graphic_att loop_par]" << endl;
103 return(0);
104 }
105
106
107 NObjMgrAdapter* obja=NULL;
108 obja = omg.GetObjAdapter(tokens[0]);
109 if (obja == NULL) {
110 cout << "plot2dvec Error , No object with name " << tokens[0] << endl;
111 return(0);
112 }
113
114 Services2NObjMgr* srvo = omg.GetServiceObj();
115
116 bool adel=true;
117 //NTupleInterface *ntin = obja->GetNTupleInterface(adel);
118
119 // Creation NTuple
120 char* ntn[4] = {"expx","expy","expex","expey"};
121 NTuple * ntint = NULL;
122 ntint = new NTuple(4,ntn);
123 // remplissage du ntuple
124 string bidon = "0.";
125 string nocut = "1.";
126 if(tokens.size()>7) bidon = tokens[7];
127 if(tokens.size()>5) nocut = tokens[5];
128 srvo->ComputeExpressions(obja,tokens[1],tokens[2],tokens[3],tokens[4],nocut,bidon,ntint,NULL,NULL);
129 p2dv = new PI2dVecDrawer(ntint,adel);
130 p2dv->SelectXY(ntn[0],ntn[1]);
131 p2dv->SelectVW(ntn[2],ntn[3]);
132
133 bool fgsr = true;
134 if (tokens.size() > 6) dopt = tokens[6];
135
136 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);
137 string name = "ChampVec";
138
139 int wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt);
140
141}
142
143
144return(0);
145
146}
147
148
149
Note: See TracBrowser for help on using the repository browser.