⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fe_print.c

📁 利用语言编写的有限元分析软件
💻 C
📖 第 1 页 / 共 3 页
字号:
/*
 *  ============================================================================= 
 *  ALADDIN Version 1.0 :
 *           fe_print.c : Print FE Mesh and Solution
 *                                                                     
 *  Copyright (C) 1995 by Mark Austin, Xiaoguang Chen, and Wane-Jang Lin
 *  Institute for Systems Research,                                           
 *  University of Maryland, College Park, MD 20742                                   
 *                                                                     
 *  This software is provided "as is" without express or implied warranty.
 *  Permission is granted to use this software for any on any computer system
 *  and to redistribute it freely, subject to the following restrictions:
 * 
 *  1. The authors are not responsible for the consequences of use of
 *     this software, even if they arise from defects in the software.
 *  2. The origin of this software must not be misrepresented, either
 *     by explicit claim or by omission.
 *  3. Altered versions must be plainly marked as such, and must not
 *     be misrepresented as being the original software.
 *  4. This notice is to remain intact.
 *                                                                    
 *  Written by: Mark Austin, Xiaoguang Chen, and Wane-Jang Lin      December 1995
 *  ============================================================================= 
 */

#include <ctype.h>

#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif

#include "defs.h"
#include "units.h"
#include "matrix.h"
#include "vector.h"
#include "fe_database.h"
#include "symbol.h"
#include "fe_functions.h"
#include "elmt.h"
#include "miscellaneous.h"

/* External Declarations for global frame/working element data structures */

extern ARRAY     *array;
extern EFRAME    *frame;

/*
#define DEBUG 
*/


/*
 *  -------------------------
 *  Print Finite Element Mesh
 *  -------------------------
 */

void Print_Mesh()
{
MATRIX  *m = (MATRIX *)NULL;
NODE                    *np;
ELEMENT               *elmt;
ELEMENT_ATTR           *eap;
RIGID                   *rb;

NODE_LOADS         *nforces;
ELEMENT_LOADS         *elsp;
ELOAD_LIB              *elp;

void           (*voidptr)();
int          iel_no,i,j,k,l;
int            UNITS_SWITCH;

#ifdef DEBUG
       printf("*** In Print_Mesh()\n");
#endif

    UNITS_SWITCH = CheckUnits();

    printf("\n");
    printf("===========================================================================\n");
    printf("Title : DESCRIPTION OF FINITE ELEMENT MESH                                 \n");
    printf("===========================================================================\n");
    printf("\n");

    printf("=======================\n");
    printf("Profile of Problem Size\n");
    printf("=======================\n\n");

    printf("   Dimension of Problem        = %6d\n", frame->no_dimen);
    printf("\n");
    printf("   Number Nodes                = %6d\n", frame->no_nodes);
    printf("   Degrees of Freedom per node = %6d\n", frame->no_dof);
    printf("   Max No Nodes Per Element    = %6d\n", frame->no_nodes_per_elmt);
    printf("\n");
    printf("   Number Elements             = %6d\n", frame->no_elements);
    printf("   Number Element Attributes   = %6d\n", frame->no_element_attr);
    printf("   Number Loaded Nodes         = %6d\n", frame->no_node_loads);       
    printf("   Number Loaded Elements      = %6d\n", frame->no_element_loads);       
    printf("\n");

    /* [a] : Print Nodes */
     
       switch((int) frame->no_dimen) {
           case 3:
                printf("\n");
                printf("----------------------------------------------------------------------------------------------\n");
                printf("Node#      X_coord          Y_coord          Z_coord        Dx    Dy    Dz    Rx    Ry    Rz\n");
                printf("----------------------------------------------------------------------------------------------\n");
                printf("\n");

                switch( UNITS_SWITCH ) {
                  case ON:
                     for(i=1; i <= frame->no_nodes; i++) {
                         np = &frame->node[i-1];
                         printf("%5d %13.4e %.3s %13.4e %.3s %13.4e %.3s ", i,
                                 np->coord[0].value/np->coord[0].dimen->scale_factor,
                                 np->coord[0].dimen->units_name,
                                 np->coord[1].value/np->coord[1].dimen->scale_factor,
                                 np->coord[1].dimen->units_name,
                                 np->coord[2].value/np->coord[2].dimen->scale_factor,
                                 np->coord[2].dimen->units_name);

                         for(j=1; j <= frame->no_dof; j++)
                             printf("%5d ", np->bound_id[j-1]);

                         printf("\n");
                     }
                     break;
                  case OFF:
                     for(i=1; i <= frame->no_nodes; i++) {
                         np = &frame->node[i-1];
                         printf("%5d %13.4e     %13.4e     %13.4e     ", i,
                                 np->coord[0].value,
                                 np->coord[1].value,
                                 np->coord[2].value);

                         for(j=1; j <= frame->no_dof; j++)
                             printf("%5d ", np->bound_id[j-1]);

                         printf("\n");
                     }
                     break;
                  default:
                     break;
                }
                break;
           case 2:
                printf("\n");
                printf("------------------------------------------------------------------------------\n");
                printf("Node#      X_coord           Y_coord          Tx    Ty    Rz  \n");
                printf("------------------------------------------------------------------------------\n");
                printf("\n");

                switch( UNITS_SWITCH ) {
                  case ON:
                     for(i=1;i<=frame->no_nodes; i++) {
                         np = &frame->node[i-1];
                         printf("%5d %13.4e %.3s %13.4e %.3s ", i,
                                 np->coord[0].value/np->coord[0].dimen->scale_factor,
                                 np->coord[0].dimen->units_name,
                                 np->coord[1].value/np->coord[1].dimen->scale_factor,
                                 np->coord[1].dimen->units_name);
                         for(j=1; j<= frame->no_dof;j++)
                             printf("%5d ", np->bound_id[j-1]);
                         printf("\n");
                     }
                     break;
                  case OFF:
                     for(i=1;i<=frame->no_nodes; i++) {
                         np = &frame->node[i-1];
                         printf("%5d %13.4e     %13.4e     ", i, np->coord[0].value, np->coord[1].value);
                         for(j=1; j<= frame->no_dof;j++)
                             printf("%5d ", np->bound_id[j-1]);
                         printf("\n");
                     }
                     break;
                  default:
                     break;
                }
                break;
           default:
                printf(">>ERROR : Ndm = %d; should be 2 or 3   \n", frame->no_dimen); 
                break;
      }

    /* [b] : Print Element Data : frame->node_per_elmt = max nodes per element */

       printf("\n\n");
       printf("-----------------------");

       for(i = 1; i <= frame->no_nodes_per_elmt; i++)
           printf("-----------");

       printf("-----------------------\n");
       printf("Element#     Type      ");

       for(i=1;i <= frame->no_nodes_per_elmt; i++)
           printf("   node[%1d]", i);

       printf("      Element_Attr_Name\n");
       printf("--------------------------------------");
	
       for(i=1;i <= frame->no_nodes_per_elmt;i++)
           printf("----------");

       printf("------------\n\n");

       for(i=1; i <= frame->no_elements; i++) {

           printf("%8d", i);
           elmt = &frame->element[i-1];
           j =  elmt->elmt_attr_no;
           printf("   %-12s", frame->eattr[j-1].elmt_type);

           for(j = 1; j <= frame->no_nodes_per_elmt; j++) {
	       if(elmt->node_connect[j-1] != 0)
                  printf("%10d", elmt->node_connect[j-1]);
	       else
                  printf("          ");
	   }

           printf("      %s\n", elmt->elmt_attr_name);
       }
       printf("\n");

    /* [c] : Print Rigid Body Data */

       if(frame->no_rigid >= 1) {
          printf("\n\n");
          printf("------------------------ \n");
          printf("RBody# : Rigid Body Data \n");
          printf("------------------------ \n");

          for(i=1; i <=frame->no_rigid; i++) {
              rb = &frame->rigid[i-1];
          
              printf("\n");
              printf("%3d : name     = \"%s\" \n", i, rb->rbody_attr_name);
              printf("      type     = %2d\n", rb->rb_type);
              printf("      no nodes = %4d\n", rb->nodes_conn);
              printf("      connectivity : ");

              for(j=1;j <= rb->nodes_conn;j++) 
                  printf("%2d ", rb->in[j]);  

              printf("\n");  

              printf("          rest dof : ");

              for(j=1; j <= 6; j++) 
                  printf("%2d ", rb->rest_dof[j]);  

              printf("\n");  
              printf("      Centre Mass : (x,y,z) = (%12.4f, %12.4f, %12.3f)\n",rb->xcg.value,rb->ycg.value,rb->zcg.value);  
              printf("      Density   = %14.5f\n",  rb->prop[1].value);
              printf("      Thickness = %14.5f\n",  rb->prop[2].value);
              printf("      Area      = %14.5f\n",  rb->prop[3].value);  
              printf("      Ixx       = %14.5f\n",  rb->prop[7].value);
              printf("      Iyy       = %14.5f\n",  rb->prop[8].value);
              printf("      Izz       = %14.5f\n",  rb->prop[9].value);
              printf("      Ixy       = %14.5f\n",  rb->prop[10].value);
              printf("      Iyz       = %14.5f\n",  rb->prop[11].value);
              printf("      Izx       = %14.5f\n",  rb->prop[12].value);
              printf("\n");  
          }
     }

    /* [c] : Print Material Data */

       if(frame->no_element_attr >= 1 ) {
          printf("--------------------- \n");
          printf("Element Attribute Data :        \n");
          printf("--------------------- \n");

          for(i = 1; i <= frame->no_element_attr; i++) {

	      eap = &frame->eattr[i-1];
              printf("\n\n"); 
              printf("ELEMENT_ATTR No. %3d  : name = \"%s\" \n ", i, eap->name); 
              printf("                     : section = \"%s\" \n", eap->section); 
              printf("                      : material = \"%s\" \n ", eap->material); 
              printf("                     : type = %s\n", eap->elmt_type); 

              print_property( frame, i );
          }
       }

    /* [d] : Print Nodal Forces */

       if(frame->no_node_loads >= 1 && (frame->no_dimen == 2)) {

          printf("                        \n");
          printf("EXTERNAL NODAL LOADINGS \n");
          printf("-----------------------------------------------\n");

          nforces = &frame->nforces[0];
          if(frame->no_dof == 3) {
             switch( UNITS_SWITCH ) {
               case ON:
                   for( i=1 ; i<=frame->no_dof ; i++ )
                        UnitsSimplify( nforces->fn[i-1].dimen );
                   printf("Node#        Fx (%s)        Fy (%s)      Mz (%s)\n",nforces->fn[0].dimen->units_name,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -