Jump to content

Recommended Posts

hi,

In a macro I written I have 3 for loop nested.

the 1st one iterates for up to 3000 times .so my execution time is long.

Is there any way to reduce time.

 

Thanks and regards,

Mahes

Share this post


Link to post
Share on other sites
On ‎8‎/‎7‎/‎2017 at 10:48 AM, tinh said:

Show us your script please.

If you just say looping 3000 times is so long then answer is looping 3 times only! 

hm_markclear nodes 1
hm_createmark nodes 1 "by set" slide5
set nodelist [hm_getmark nodes 1]
set setupdate $nodelist
foreach node $nodelist {
 hm_markclear nodes 1
 hm_createmark nodes 1 $node

 
 set temp [hm_getmark nodes 1]
 hm_markclear nodes 1
 foreach nid $temp {
  set flg [lsearch $nodelist $nid]
  if {$flg >-1} {
   *nodemarkbypath $node $nid 1
   set ls [hm_getmark nodes 1]
   if { [llength $ls]<4 } {
   foreach n $ls {
    
    if { [lsearch $setupdate $n] == -1} {
     
     lappend setupdate $n }
   } }
  }
 }
 
 
 unset temp
 lreplace $nodelist 0 0
      }

Share this post


Link to post
Share on other sites

Hi Mahes . What do you want to do?

You have a set of nodes need to be updated

You search for adjacent nodes of it

Then if between it and its adjacents existing less than 4 nodes then you add those to the set.

If you perform in 2d model, between each node and its adjacent node, there is nothing! What do you want to do with adjacent nodes?

Share this post


Link to post
Share on other sites
1 hour ago, tinh said:

Hi Mahes . What do you want to do?

You have a set of nodes need to be updated

You search for adjacent nodes of it

Then if between it and its adjacents existing less than 4 nodes then you add those to the set.

If you perform in 2d model, between each node and its adjacent node, there is nothing! What do you want to do with adjacent nodes?

hi tinh,

I have a model built of both hex and shell elements.

we create some nodal sets.

in those sets from primary nodes I need to fetch the mid nodes and update the set.

This one is a part of my macro.

elements are second order.

2nd line of code mark nodes by sets.

those sets only has primary nodes.

 

Thanks,

Mahes

Share this post


Link to post
Share on other sites
14 hours ago, tinh said:

I understand

From primary nodes, you want to add to the set only mid nodes nearby them, don't you?

hi tinh,

yes .

final set includes both primary and mid nodes.

is there any other logic other than this.

 

Thanks,

Mahes

 

Share this post


Link to post
Share on other sites
3 hours ago, tinh said:

Ok

Do you need to add mid nodes those are inside solid comps? Or only on outer face of solid comps?

hi tinh,

No.

wat I want to do is...

I will do  the mesh the model which has only 1st order elements.

from that I will create nodal sets.

after that I will change all elements to second order.

By running the macro I will update the set which has the midnodes too.

 

1.jpg

2.jpg

Share this post


Link to post
Share on other sites
14 hours ago, tinh said:

Ok, look like you want to add only mid nodes on outer face of solid

Can't you switch to 2nd then create sets?

hi tinh,

Usually for me updates for mesh will come often.

each time when I want to edit mesh I have to change it to first order.

So I have do sets again.

 

Share this post


Link to post
Share on other sites
5 minutes ago, tinh said:

Why dont you create set after all updates?

Somehow you should take the least effort of machine and man also

Try arrange your work flow with fewer actions

Hi tinh,

You are correct.This wat we taught.

That's a must thing so have to be done .

 

 

Share this post


Link to post
Share on other sites

:D I can write a code that helps to select such mid nodes. But I think if you describe detailly your script aim, I can give another strategy that doesn't need to select mid nodes, shorter and faster,...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...