/* * ========================================================================== * Small program to Test Matrix Library : Analysis of 4 Story Shear Structure * ========================================================================== * Copyright (C) 1993-96 by Mark Austin and David Mazzoni. * * This software is provided "as is" without express or implied warranty. * Permission is granted to use this software 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 September 1993 * ========================================================================== */ #include #include "matrix.h" #include "miscellaneous.h" enum { NoFloors = 4 }; int main( void ) { MATRIX *spEload; MATRIX *spStiff; MATRIX *spDispl; int ii, ij; /* Allocate Matrices for Stiffness and External Load */ spStiff = matAllocIndirect( "Stiffness", DoubleArray, NoFloors, NoFloors ); spEload = matAllocIndirect("External Load", DoubleArray, NoFloors, 1); /* Set values in external Load and Stiffness Matrices */ for(ii = 1; ii <= (int) NoFloors; ii++) spEload->uMatrix.dpp[ ii - 1 ][0] = ((double) (ii) / ((double) NoFloors))*10.0; spStiff->uMatrix.dpp[ 0 ][ 0 ] = 2000; spStiff->uMatrix.dpp[ 0 ][ 1 ] = -1000; spStiff->uMatrix.dpp[ 1 ][ 0 ] = -1000; spStiff->uMatrix.dpp[ 1 ][ 1 ] = 2000; spStiff->uMatrix.dpp[ 1 ][ 2 ] = -1000; spStiff->uMatrix.dpp[ 2 ][ 1 ] = -1000; spStiff->uMatrix.dpp[ 2 ][ 2 ] = 2000; spStiff->uMatrix.dpp[ 2 ][ 3 ] = -1000; spStiff->uMatrix.dpp[ 3 ][ 2 ] = -1000; spStiff->uMatrix.dpp[ 3 ][ 3 ] = 1000; /* Print Stiffness and External Load Matrices */ matPrint( spStiff ); matPrint( spEload ); /* Solve Equations and Print Displacements */ spDispl = matSolve( spStiff, spEload ); spDispl->cpName = saveString( "Displacements", __FILE__, __LINE__ ); matPrint( spDispl ); }