C and cpp file
Moderators: silvia, selimgunay, Moderators
-
- Posts: 123
- Joined: Tue Oct 31, 2006 10:40 am
- Location: k.n.toosi University
C and cpp file
Dear Frank,
There are both c and cpp files in \PACKAGES\win32 when I go through WindowsDLLs.sln. That is, I found trussC.c as well as TrussCPP.cpp. Are they related somehow? If I want to make changes to trussCpp and build my own element and/or material, Do I have to make my changes to both of them or just cpp file?
Thanks
There are both c and cpp files in \PACKAGES\win32 when I go through WindowsDLLs.sln. That is, I found trussC.c as well as TrussCPP.cpp. Are they related somehow? If I want to make changes to trussCpp and build my own element and/or material, Do I have to make my changes to both of them or just cpp file?
Thanks
Pejman
-
- Posts: 58
- Joined: Sat Sep 20, 2008 11:13 pm
- Location: Tehran-Amir Kabir University of Technology (Tehran Polytechnic)
- Contact:
Re: C and cpp file
Hi All
I have a question about *.h and *.cpp files.
How can I use these files in Opensees commands?
Best,
I have a question about *.h and *.cpp files.
How can I use these files in Opensees commands?
Best,
Re: C and cpp file
what are you asking? .. rephrase the question
Question
Hi Frank,
The following tcl script I wrote gets me an error , would you please check it out and let me know what is the problem if possible?
#---SOIL GEOMETRY
# thicknesses of soil profile (m)
set soilThick 30.0
# number of soil layers
set numLayers 3
# layer thicknesses
set layerThick(3) 2.0
set layerThick(2) 8.0
set layerThick(1) 20.0
# depth of water table
set waterTable 2.0
# define layer boundaries
set layerBound(1) $layerThick(1)
set sum $layerBound(1)
for {set i 2} {$i<=$numLayers} {incr i 1} {
set sum [expr $sum+$layerThick($i)]
set layerBound($i) $sum
}
#---MESH GEOMETRY
# number of elements in horizontal direction
set nElemX 1
# number of nodes in horizontal direction
set nNodeX [expr 2*$nElemX+1]
# horizontal element size (m)
set sElemX 2.0
# number of elements in vertical direction for each layer
set nElemY(3) 4
set nElemY(2) 16
set nElemY(1) 40
# total number of elements in vertical direction
set nElemT 60
# vertical element size in each layer
for {set i 1} {$i <=$numLayers} {incr i 1} {
set sElemY($i) [expr $layerThick($i)/$nElemY($i)]
puts "size: $sElemY($i)"
}
# number of nodes in vertical direction
set nNodeY [expr 2*$nElemT+1]
# total number of nodes
set nNodeT [expr $nNodeX*$nNodeY]
################# creating interiror nodes #################
model BasicBuilder -ndm 2 -ndf 2
set x1coord [expr $sElemX/2]
set x2coord $sElemX
set k 1
set nodelist {}
set lowerBound 0
for {set j 1} {$j<= $nNodeY} {incr j 1} {
if {[expr ($j-1)*$sElemY($k)/2]<=$layerBound($k) && [expr ($j-1)*$sElemY($k)/2]> $lowerBound} {
set ycoord [expr ($j-1)*$sElemY($k)/2]
lappend nodelist $ycoord
return $nodelist
} else {
set k [expr $k+1]
if {$k>3} {
set k 3
}
}
set lowerBound $layerBound($k)
}
for {set i 2} {$i <= $nNodeY} {incr i 3} {
set k 2
set ycoor [lindex $nodelist [expr $i-$k]]
node $i $x1coord $ycoor
set k [expr $k+2]
}
for {set i 1} {$i <= [expr $nNodeY-$nElemT]} {incr i 6} {
set k 0
set ycoor [lindex $nodelist [expr $i-$k]]
node $i 0 $ycoor
node [expr $i+2] $x2coord $ycoor
set k [expr $k+4]
}
The following tcl script I wrote gets me an error , would you please check it out and let me know what is the problem if possible?
#---SOIL GEOMETRY
# thicknesses of soil profile (m)
set soilThick 30.0
# number of soil layers
set numLayers 3
# layer thicknesses
set layerThick(3) 2.0
set layerThick(2) 8.0
set layerThick(1) 20.0
# depth of water table
set waterTable 2.0
# define layer boundaries
set layerBound(1) $layerThick(1)
set sum $layerBound(1)
for {set i 2} {$i<=$numLayers} {incr i 1} {
set sum [expr $sum+$layerThick($i)]
set layerBound($i) $sum
}
#---MESH GEOMETRY
# number of elements in horizontal direction
set nElemX 1
# number of nodes in horizontal direction
set nNodeX [expr 2*$nElemX+1]
# horizontal element size (m)
set sElemX 2.0
# number of elements in vertical direction for each layer
set nElemY(3) 4
set nElemY(2) 16
set nElemY(1) 40
# total number of elements in vertical direction
set nElemT 60
# vertical element size in each layer
for {set i 1} {$i <=$numLayers} {incr i 1} {
set sElemY($i) [expr $layerThick($i)/$nElemY($i)]
puts "size: $sElemY($i)"
}
# number of nodes in vertical direction
set nNodeY [expr 2*$nElemT+1]
# total number of nodes
set nNodeT [expr $nNodeX*$nNodeY]
################# creating interiror nodes #################
model BasicBuilder -ndm 2 -ndf 2
set x1coord [expr $sElemX/2]
set x2coord $sElemX
set k 1
set nodelist {}
set lowerBound 0
for {set j 1} {$j<= $nNodeY} {incr j 1} {
if {[expr ($j-1)*$sElemY($k)/2]<=$layerBound($k) && [expr ($j-1)*$sElemY($k)/2]> $lowerBound} {
set ycoord [expr ($j-1)*$sElemY($k)/2]
lappend nodelist $ycoord
return $nodelist
} else {
set k [expr $k+1]
if {$k>3} {
set k 3
}
}
set lowerBound $layerBound($k)
}
for {set i 2} {$i <= $nNodeY} {incr i 3} {
set k 2
set ycoor [lindex $nodelist [expr $i-$k]]
node $i $x1coord $ycoor
set k [expr $k+2]
}
for {set i 1} {$i <= [expr $nNodeY-$nElemT]} {incr i 6} {
set k 0
set ycoor [lindex $nodelist [expr $i-$k]]
node $i 0 $ycoor
node [expr $i+2] $x2coord $ycoor
set k [expr $k+4]
}
Re: C and cpp file
c and c++ both language is same but in this language the coding is different because both programming is diifferent extence so I think we use one program in both extence but the file save is different name with extence c and cpp.both language programs are same but in this program we print the value in different name. like in c "println", "scanf".
Re: C and cpp file
i presume you have already determined that ycoor around line 136 was not set correctly
Re: C and cpp file
Hi Frank,
When I try to run the following script which is a part of a bigger one , OpenSees analysis window freezes and I have to close it. I have tried to play with it and I found that there is something wrong with the TransfTag assignment.
The program is to assign a LinearBeamColumn element to the bridge spine line beam in the longitudinal direction.
Could anybody help me , I have spent hours to detect the error but no success.
Thanks,
Evgin.
# geomTransf Linear $transfTag $vecxzX $vecxzY $vecxzZ <-jntOffset $dXi $dYi $dZi $dXj $dYj $dZj>
set IDColTrans 1
set IDSpineBeam 2
set IDCapBeamTrans 3
# supperstructure spine-line ( figure 2.1 AVIRAM)
geomTransf Linear $IDSpineBeam 0 0 1
# cap beams
geomTransf Linear $IDCapBeamTrans 0 0 1
# column
geomTransf Linear $IDColTrans 0 1 0
# creating spine-line element for the supper structure
set count 1
for {set i 100} {$i <120} {incr i 1} {
set eleID [expr 2*$i-($count-1)]
set nID $i
set nJD [expr $i+1]
#element elasticBeamColumn $eleTag $iNode $jNode $A $E $G $J $Iy $Iz $transfTag <-mass $massDens>
element elasticBeamColumn $eleID $nID $nJD $areabeam $ec $gc $j $ix $iz $IDSpineBeam
set count [expr $count+1]
}
When I try to run the following script which is a part of a bigger one , OpenSees analysis window freezes and I have to close it. I have tried to play with it and I found that there is something wrong with the TransfTag assignment.
The program is to assign a LinearBeamColumn element to the bridge spine line beam in the longitudinal direction.
Could anybody help me , I have spent hours to detect the error but no success.
Thanks,
Evgin.
# geomTransf Linear $transfTag $vecxzX $vecxzY $vecxzZ <-jntOffset $dXi $dYi $dZi $dXj $dYj $dZj>
set IDColTrans 1
set IDSpineBeam 2
set IDCapBeamTrans 3
# supperstructure spine-line ( figure 2.1 AVIRAM)
geomTransf Linear $IDSpineBeam 0 0 1
# cap beams
geomTransf Linear $IDCapBeamTrans 0 0 1
# column
geomTransf Linear $IDColTrans 0 1 0
# creating spine-line element for the supper structure
set count 1
for {set i 100} {$i <120} {incr i 1} {
set eleID [expr 2*$i-($count-1)]
set nID $i
set nJD [expr $i+1]
#element elasticBeamColumn $eleTag $iNode $jNode $A $E $G $J $Iy $Iz $transfTag <-mass $massDens>
element elasticBeamColumn $eleID $nID $nJD $areabeam $ec $gc $j $ix $iz $IDSpineBeam
set count [expr $count+1]
}
Re: C and cpp file
sorry for the delay .. i trust you figured this out