-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TexGen crashing #32
Comments
Hi Christos, |
Hi Louise, |
Hi Christos, |
Hi Louise,
I have indeed replaced it with getpointinfo(). I thought it might be worth investigating.
Kind regards,
Christos
From: Louise Brown <[email protected]>
Sent: Παρασκευή, 24 Απριλίου 2020 12:21 μμ
To: louisepb/TexGen <[email protected]>
Cc: Christos Kora <[email protected]>; Author <[email protected]>
Subject: Re: [louisepb/TexGen] TexGen crashing (#32)
Hi Christos,
I've only had time to take a quick look at this at the moment but the issue seems to be with the section getting slave nodes at the end of the script. If this is commented out then it runs fine. I'm not sure what this section is supposed to be doing?
Also, given that PointInsideYarn is quite a computationally expensive function and can be slow it might be a good idea to rewrite your code so that it's only called once for each point.
Best wishes,
Louise
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#32 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMMFFIIGTWNM7FFSJO4NRALROFYX5ANCNFSM4MPFPDYQ>.
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.
Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.
|
HI Christos, |
An unstable behaviour was observed when retrieving information from yarns for a grid of points using multiple nested loops in Python. More specifically using the functions: PointInsideYarn() and GetSlaveNodes(). This seems to occur for any textile.
Below is an example python code for a simple plain weave:
#----------------------------------------------------------------------------------------------------------
Example model generation:
numOfWarp, numOfWeft, yarnWidth, yarnSpacings, thickness, patternMatrix=2, 2, 2.97, 3.14, 0.62375, [[0,1],[1,0]]
weave = CTextileWeave2D(numOfWarp, numOfWeft, yarnSpacings, thickness, True, True)
weave.SetGapSize(0)
weave.SetYarnWidths(yarnWidth)
for i in range(numOfWarp):
for j in range(numOfWeft):
if patternMatrix[i][j]==1:
weave.SwapPosition(i,j)
for i in range(numOfWarp):
weave.SetXYarnWidths(i, yarnWidth)
weave.SetXYarnHeights(i, thickness/2)
weave.SetXYarnSpacings(i, yarnSpacings)
for j in range(numOfWarp):
weave.SetYYarnWidths(j, yarnWidth)
weave.SetYYarnHeights(j, thickness/2)
weave.SetYYarnSpacings(j, yarnSpacings)
domSizeX=yarnSpacingsnumOfWeft
domSizeY=yarnSpacingsnumOfWarp
weave.AssignDefaultDomain()
textilename = AddTextile(weave)
domain = CDomainPlanes()
domain.AddPlane(PLANE(XYZ(1, 0, 0), -domSizeX/2))
domain.AddPlane(PLANE(XYZ(-1, 0, 0), -domSizeY/2))
domain.AddPlane(PLANE(XYZ(0, 1, 0), -domSizeY/2))
domain.AddPlane(PLANE(XYZ(0, -1, 0), -domSizeY/2))
domain.AddPlane(PLANE(XYZ(0, 0, 1), 0))
domain.AddPlane(PLANE(XYZ(0, 0, -1), -thickness))
GetTextile('2DWeave(W:%i,H:%i)' % (numOfWarp,numOfWeft)).AssignDomain(domain)
#Code for retrieving information:
xstart, xend, ystart, yend, zstart, zend = -domSizeX/2, domSizeX/2, -domSizeY/2, domSizeY/2, 0.0, thickness
num=50 #point grid resolution
xstep=(xend-xstart)/num
ystep=(yend-ystart)/num
zstep=(zend-zstart)/num
xarray=[xstart+i * xstep for i in range(num)]
yarray=[ystart+i * ystep for i in range(num)]
zarray=[zstart+i * zstep for i in range(num)]
point_vector=XYZVector()
for x in xarray:
for y in yarray:
for z in zarray:
point_vector.push_back(XYZ(x,y,z))
Textile=GetTextile()
Yarns=Textile.GetYarns()
for point in point_vector:
for yarn in Yarns:
if yarn.PointInsideYarn(point):
Tangent=XYZ()
Loc=XY()
VolumeFraction=None
DistanceToSurface=None
Tolerance=1e-9
Orientation=XYZ()
data=yarn.PointInsideYarn(point,Tangent,Loc,VolumeFraction, DistanceToSurface, Tolerance, Orientation)
slave_nodes=yarn.GetSlaveNodes(0)
slave_nodes_vector=XYZVector()
for node in slave_nodes:
slave_nodes_vector.push_back(node.GetPosition())
else:
continue
The text was updated successfully, but these errors were encountered: