Fixed bug in post_global
[email protected] Thu, 5 Sep 2013 13:08:47 +0200
| Newsgroups | gmane.comp.mathematics.tochnog.user |
|---|---|
| Message-ID | <[email protected]> |
--+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Dear All, In my version of Tochnog I had a bug in post_global command : it was calculationg the min and max value only of primary dof (neglecting derivatives). In the attachment you will find a very simple patch for the function post_global. To apply it just replace the routine in the post.cc source file. (sorry that I do not send a path but in my Tochnog source code I have a lot of "strange" stuff :-). Best regards, Roman -- Roman Putanowicz, PhD < [email protected] > Institute for Computational Civil Engng (L-5) Dept. of Civil Engng, Cracow Univ. of Technology www.l5.pk.edu.pl, tel. +48 12 628 2569, fax 2034 --+HP7ph2BbKc20aGI Content-Type: text/x-c++src; charset=us-ascii Content-Disposition: attachment; filename="post_global.cc" void post_global( void ) { long int ipost=0, npost=0, post_type=0, element=0, max_element=0, max_node=0, length=0, global_elements=0, global_nodes=0, global_unknown_number=0, element_empty=0, inod=0, ipuknwn=0, iuknwn=0, ldum=0, idum[1], post_global[DATA_ITEM_SIZE], node_bounded[MUKNWN], dof_principal[MUKNWN]; double element_mass=0., element_strainenergy=0., global_mass=0., global_strainenergy=0., element_volume=0., global_volume=0., ddum[1], global_unknown_sum[MUKNWN], global_unknown_max[MUKNWN], global_unknown_average[MUKNWN], global_unknown_min[MUKNWN], node_dof[MUKNWN]; if ( db_active_index( POST_GLOBAL, 0, VERSION_NORMAL ) ) { db( POST_GLOBAL, 0, post_global, ddum, npost, VERSION_NORMAL, GET ); db_max_index( ELEMENT, max_element, VERSION_NORMAL, GET ); db_max_index( NODE, max_node, VERSION_NORMAL, GET ); if ( max_element>=0 ) { for ( element=0; element<=max_element; element++ ) { element_empty = -NO; db( ELEMENT_EMPTY, element, &element_empty, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS ); if ( element_empty==-NO || element_empty==-FRONT ) { if ( db_active_index( ELEMENT_MASS, element, VERSION_NORMAL ) ) { db( ELEMENT_MASS, element, idum, &element_mass, ldum, VERSION_NORMAL, GET ); global_mass += element_mass; } if ( db_active_index( ELEMENT_STRAINENERGY, element, VERSION_NORMAL ) ) { db( ELEMENT_STRAINENERGY, element, idum, &element_strainenergy, ldum, VERSION_NORMAL, GET ); global_strainenergy += element_strainenergy; } if ( db_active_index( ELEMENT_VOLUME, element, VERSION_NORMAL ) ) { db( ELEMENT_VOLUME, element, idum, &element_volume, ldum, VERSION_NORMAL, GET ); global_volume += element_volume; } if ( db_active_index( ELEMENT, element, VERSION_NORMAL ) ) { global_elements++; } } } } if ( max_node>=0 ) { db( DOF_PRINCIPAL, 0, dof_principal, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS ); array_set( global_unknown_sum, 0., nuknwn ); array_set( global_unknown_max, -EPS_LARGE, nuknwn ); array_set( global_unknown_min, +EPS_LARGE, nuknwn ); for ( inod=0; inod<=max_node; inod++ ) { if ( db_active_index( NODE, inod, VERSION_NORMAL ) ) { global_nodes++; array_set( node_bounded, 0, npuknwn ); db( NODE_BOUNDED, inod, node_bounded, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS ); db( NODE_DOF, inod, idum, node_dof, ldum, VERSION_NORMAL, GET ); for ( ipuknwn=0; ipuknwn<npuknwn; ipuknwn++ ) { iuknwn = ipuknwn*nder; if ( dof_principal[iuknwn]>=0 ) { if ( !node_bounded[ipuknwn] ) global_unknown_number++; } global_unknown_sum[iuknwn] += node_dof[iuknwn]; if ( node_dof[iuknwn]>global_unknown_max[iuknwn] ) global_unknown_max[iuknwn] = node_dof[iuknwn]; if ( node_dof[iuknwn]<global_unknown_min[iuknwn] ) global_unknown_min[iuknwn] = node_dof[iuknwn]; /* calculate extreme values for derivatives */ { /* LOCAL_BLOCK */ int j; for(j=0; j<nder; j++) { if ( node_dof[iuknwn+j]>global_unknown_max[iuknwn+j] ) global_unknown_max[iuknwn+j] = node_dof[iuknwn+j]; if ( node_dof[iuknwn+j]<global_unknown_min[iuknwn+j] ) global_unknown_min[iuknwn+j] = node_dof[iuknwn+j]; } } /* END_LOCAL_BLOCK */ } } } } for ( ipost=0; ipost<npost; ipost++ ) { post_type = post_global[ipost]; length = nuknwn; if ( post_type==-GLOBAL_UNKNOWN_AVERAGE && global_nodes>0 ) { array_multiply( global_unknown_sum, global_unknown_average, 1./global_nodes, length ); db( -GLOBAL_UNKNOWN_AVERAGE, 0, idum, global_unknown_average, length, VERSION_NORMAL, PUT ); } if ( post_type==-GLOBAL_UNKNOWN_SUM ) db( -GLOBAL_UNKNOWN_SUM, 0, idum, global_unknown_sum, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_UNKNOWN_MAX ) db( -GLOBAL_UNKNOWN_MAX, 0, idum, global_unknown_max, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_UNKNOWN_MIN ) db( -GLOBAL_UNKNOWN_MIN, 0, idum, global_unknown_min, length, VERSION_NORMAL, PUT ); length = 1; if ( post_type==-GLOBAL_MASS ) db( -GLOBAL_MASS, 0, idum, &global_mass, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_VOLUME ) db( -GLOBAL_VOLUME, 0, idum, &global_volume, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_ELEMENTS ) db( -GLOBAL_ELEMENTS, 0, &global_elements, ddum, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_NODES ) db( -GLOBAL_NODES, 0, &global_nodes, ddum, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_UNKNOWN_NUMBER ) db( -GLOBAL_UNKNOWN_NUMBER, 0, &global_unknown_number, ddum, length, VERSION_NORMAL, PUT ); if ( post_type==-GLOBAL_STRAINENERGY ) db( -GLOBAL_STRAINENERGY, 0, idum, &global_strainenergy, length, VERSION_NORMAL, PUT ); } } } --+HP7ph2BbKc20aGI Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk --+HP7ph2BbKc20aGI Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Tochnog-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tochnog-users --+HP7ph2BbKc20aGI--