📄 fe_allocate.c
字号:
/* * ============================================================================= * ALADDIN Version 1.0 : * fe_allocate.c : Allocation Functions for Finite Elements * * 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 <stdio.h>#include <ctype.h>#include "defs.h"#include "units.h"#include "matrix.h"#include "fe_database.h"#include "symbol.h"#include "code.h"#include "y.tab.h"/*#define DEBUG*/static int num_elmt_attrs = 0;int max_no_nodes;int max_no_eqs;int max_no_elements;int max_no_rigid;int max_no_nforces;int max_no_loaded_nodes;int max_no_loaded_elmts;/* =========================================================== *//* Allocate space for Element, Section and Material Attributes *//* =========================================================== */ELEMENT_ATTR *Alloc_Element_Attr_Item() {ELEMENT_ATTR *eap;int i;#ifdef DEBUG printf("*** In Alloc_Element_Attr_Item ()\n");#endif eap = (ELEMENT_ATTR *) MyCalloc(1,sizeof(ELEMENT_ATTR)); eap->name = (char *)NULL; eap->elmt_type = (char *)NULL; eap->section = (char *)NULL; eap->material = (char *)NULL; eap->fiber_attr_name = (char *)NULL; eap->map_ldof_to_gdof = (int *) MyCalloc(6, sizeof(int)); eap->work_material = (QUANTITY *) MyCalloc(UNIT_MATERIAL_ATTR, sizeof(QUANTITY)); eap->work_section = (QUANTITY *) MyCalloc(UNIT_SECTION_ATTR, sizeof(QUANTITY));#ifdef DEBUG printf("*** leaving Alloc_Element_Attr_Item ()\n");#endif return(eap);}SECTION_ATTR *Alloc_Section_Attr_Item(){SECTION_ATTR *sp; sp = (SECTION_ATTR *) MyCalloc(1, sizeof(SECTION_ATTR)); return(sp);}MATERIAL_ATTR *Alloc_Material_Attr_Item() {MATERIAL_ATTR *mp;SYMBOL *slp;int iInPlaneIntegPts;int iThicknessIntegPts;int iNO_INTEG_pts; slp = lookup("InPlaneIntegPts"); /* number of integration pts in plane/surface */ if(slp == NULL) iInPlaneIntegPts = 2*2; /* 2x2 as default */ else iInPlaneIntegPts = (int) slp->u.q->value; slp = lookup("ThicknessIntegPts"); /* number of integration pts in thickness direction*/ if(slp == NULL) iThicknessIntegPts = 2; /* 2 as default */ else iThicknessIntegPts = (int) slp->u.q->value; iNO_INTEG_pts = iInPlaneIntegPts*iThicknessIntegPts; mp = (MATERIAL_ATTR *) MyCalloc(1, sizeof(MATERIAL_ATTR)); mp->alpha_thermal = (QUANTITY *) MyCalloc(3, sizeof(QUANTITY)); mp->LC_ptr = (MATER_LOAD_CURVE *) MyCalloc(1,sizeof(MATER_LOAD_CURVE)); mp->LC_ptr->back_stress = MatrixAllocIndirectDouble(6, iNO_INTEG_pts); mp->LC_ptr->R = (double *) MyCalloc(iNO_INTEG_pts, sizeof(double)); mp->LC_ptr->H = (double *) MyCalloc(iNO_INTEG_pts, sizeof(double)); mp->LC_ptr->ialph = 0; mp->LC_ptr->pen = 0; mp->LC_ptr->load[0] = 0; mp->LC_ptr->load[1] = 0; mp->LC_ptr->load[2] = 0; mp->LC_ptr->load[3] = 0; mp->LC_ptr->load[4] = 0; mp->LC_ptr->load[5] = 0; return(mp);}#ifdef __STDC__FIBER_ELMT *Alloc_Fiber_Elmt_Attr_Item( int no_fiber ) #elseFIBER_ELMT *Alloc_Fiber_Elmt_Attr_Item( no_fiber ) int no_fiber;#endif{FIBER_ELMT *fep;#ifdef DEBUG printf("*** In Alloc_Fiber_Elmt_Attr_Item ()\n");#endif fep = (FIBER_ELMT *) MyCalloc(1,sizeof(FIBER_ELMT)); fep->no_fiber = no_fiber; fep->fiber = (FIBER_ATTR *) MyCalloc(no_fiber, sizeof(FIBER_ATTR));#ifdef DEBUG printf("*** Leaving Alloc_Fiber_Elmt_Attr_Item ()\n");#endif return(fep);}/* * -------------------------------- * Mapping from global to local dof * -------------------------------- */#ifdef __STDC__void Ldof_to_gdof(ELEMENT_ATTR *eap, MATRIX *m_local, MATRIX *m_global)#elsevoid Ldof_to_gdof(eap, m_local, m_global)ELEMENT_ATTR *eap;MATRIX *m_local, *m_global;#endif{int i, j, k, n;int ldof, gdof;#ifdef DEBUG printf(" #### Enter Ldof_to_gdof() \n");#endif if(m_global->iNoRows == 1) { n = MAX(m_global->iNoRows, m_global->iNoColumns); } if( n < 6) { if(m_global->iNoRows == 1) { for(j = 1; j <= m_global->iNoColumns; j++) eap->map_ldof_to_gdof[(int)(m_local->uMatrix.daa[0][j-1]-1)] = (int) m_global->uMatrix.daa[0][j-1]; } if(m_global->iNoColumns == 1) { for(j = 1; j <= m_global->iNoRows; j++) eap->map_ldof_to_gdof[(int)(m_local->uMatrix.daa[j-1][0]-1)] = (int) m_global->uMatrix.daa[j-1][0]; } } else if(n > 6) FatalError("number maping dofs can not more than 6",(char *)NULL);#ifdef DEBUG printf(" #### Leaving Ldof_to_gdof() \n");#endif}/* ===================================================== *//* Alloc Frame *//* function to allocate space for datastructure EFRAME *//* for a fixed size ---as defined by parameters in *//* defs.h file *//* UNIT_NDM,UNIT_NDF,UNIT_NEN,UNIT_NAD *//* UNIT_ELEMENTS *//* UNIT_NODES,UNIT_NFORCES,UNIT_EFORCES *//* UNIT_SECTION_ATTR,UNIT_MATERIAL_ATTR *//* ==================================================== */EFRAME *FrameAlloc(){EFRAME *frp;NODE *np;ELEMENT *ep;ELEMENT_ATTR *eap;ELEMENT_LOADS *elsp;ELOAD_LIB *elp;NODE_LOADS *nlp;RIGID *rig;SYMBOL *sp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -