Hi Frank,
How are you? I have a problem in the design of input of data from the interpreter.
I am planning to input a set of data from the OpenSees interpreter, but the number of these "double values" could vary from a few to hundreds. If I use only "double" in the constructor, I must creat hundreds of constructors. So I am thinking using a vector of array in the constructor. But I can not find vector in the Tcl and even array is very different with in the C++. For example
set a {...} # {...} means a set of double type.
pattern Plain 1 Linear {
eleLoad -ele 1 -type -beamUniform $a 0. 0.;
}
What is you advice? thanks a lot
Jian
how to set a vector of array
Moderators: silvia, selimgunay, Moderators
Re: how to set a vector of array
there is no vector in tcl .. the closest thing is the list.
-
- Posts: 140
- Joined: Sun Oct 03, 2010 11:36 pm
- Location: Hong Kong
Re: how to set a vector of array
You mean TCL script?
Try
set A ""
lappend A 4
lappend A 5
...
Then A is similar to a Vector.
When you use A, you should need foreach.
foreach b $A {
...$b..
}
Try
set A ""
lappend A 4
lappend A 5
...
Then A is similar to a Vector.
When you use A, you should need foreach.
foreach b $A {
...$b..
}
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
guanlin@polyu.edu.hk
2
Thanks! There are lot of other tips in this forum.
-
- Posts: 2
- Joined: Fri Sep 23, 2011 2:55 pm
Re: how to set a vector of array
It's work for me. I am facing this problem in C++ from several day but After implementing this method. linguan118, I think you have a good knowledge of this kind of language fundamental.