DofColorMap.cppGo to the documentation of this file.00001 /* ****************************************************************** ** 00002 ** OpenSees - Open System for Earthquake Engineering Simulation ** 00003 ** Pacific Earthquake Engineering Research Center ** 00004 ** ** 00005 ** ** 00006 ** (C) Copyright 1999, The Regents of the University of California ** 00007 ** All Rights Reserved. ** 00008 ** ** 00009 ** Commercial use of this program without express permission of the ** 00010 ** University of California, Berkeley, is strictly prohibited. See ** 00011 ** file 'COPYRIGHT' in main directory for information on usage and ** 00012 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** 00013 ** ** 00014 ** Developed by: ** 00015 ** Frank McKenna (fmckenna@ce.berkeley.edu) ** 00016 ** Gregory L. Fenves (fenves@ce.berkeley.edu) ** 00017 ** Filip C. Filippou (filippou@ce.berkeley.edu) ** 00018 ** ** 00019 ** ****************************************************************** */ 00020 00021 // $Revision: 1.2 $ 00022 // $Date: 2003/02/14 23:01:57 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/renderer/DofColorMap.cpp,v $ 00024 00025 00026 // File: ~/graphics/DofColorMap.h 00027 // 00028 // Written: fmk 00029 // Created: 10/98 00030 // Revision: A 00031 // 00032 // Description: This file contains the class definition for DofColorMap. 00033 // DofColorMap is an abstract base class. An DofColorMap object is used 00034 // to determine the r,g,b values given an input value. 00035 // 00036 // What: "@(#) DofColorMap.h, revA" 00037 00038 #include <DofColorMap.h> 00039 #include <OPS_Globals.h> 00040 #include <stdlib.h> 00041 00042 00043 DofColorMap::DofColorMap(int _numEqn, int _numP) 00044 :numEqn(_numEqn),numPartitions(_numP) 00045 { 00046 nPerP=numEqn/numPartitions; 00047 00048 r[0] = 0; g[0] = 1; b[0] = 1; 00049 r[1] = 1; g[1] = 1; b[1] = 0; 00050 r[2] = 1; g[2] = 0; b[2] = 1; 00051 r[3] = 0; g[3] = 1; b[3] = 0; 00052 r[4] = 0; g[4] = 0; b[4] = 1; 00053 r[5] = 0; g[5] = 0; b[5] = 0; 00054 r[6] = 0.5; g[6] = 0.5; b[6] = 0.5; 00055 r[7] = 1; g[7] = 0; b[7] = 0; 00056 00057 if (_numP > 8) { 00058 opserr << "DofColorMap- can't handle numP > 8\n"; 00059 exit(-1); 00060 } 00061 00062 } 00063 00064 00065 float 00066 DofColorMap::getRed(float value){ 00067 int j = value/nPerP; 00068 return r[j]; 00069 00070 } 00071 00072 00073 float 00074 DofColorMap::getGreen(float value) { 00075 int j = value/nPerP; 00076 return g[j]; 00077 } 00078 00079 float 00080 DofColorMap::getBlue(float value) { 00081 int j = value/nPerP; 00082 return b[j]; 00083 } 00084 00085 |