Changeset 202 for trunk/src/mesh
- Timestamp:
- Feb 20, 2006 8:47:50 PM (18 years ago)
- Location:
- trunk/src/mesh
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/Makefile
r185 r202 22 22 # replace this with the full path of the directory 23 23 # containing the rappture directory 24 TOP_DIR = ../..24 TOP_DIR = /home/cxsong 25 25 26 26 # define the top of the rappture directory structure … … 60 60 LIB_RP_OBJECTS = $(LIB_INC_PREFIX) -lRpObjects 61 61 LIB_RAPPTURE = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture 62 LIB_RPMESH = -Wl,-rpath,$(LIB_DIR) -L/$(LIB_DIR) -lrpmesh 62 63 63 64 INCL_CORE = -I$(INCLUDES_DIR)/core … … 82 83 RpChoice.o RpOption.o RpUnitsStd.o RpUnits.o #RpValue.o\ 83 84 # RpValueDouble.o RpValueString.o 84 RP_MESH_DEPS = util.o grid1d.o grid1d_reg.o grid2d.o #mesh.o field.o endian.o85 RP_MESH_DEPS = element.o util.o grid1d.o grid1d_reg.o grid2d.o node3d.o node2d.o #mesh.o field.o endian.o 85 86 86 87 LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib … … 93 94 94 95 librpmesh: $(RP_MESH_DEPS) 96 if test "`uname`" == "Darwin"; then \ 97 $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \ 98 ar -r $@.a $^; \ 99 ranlib -s $@.a; \ 100 else \ 101 $(CXX) $(DEGUG) $(LDLIB_LINUX) $^; \ 102 /sbin/ldconfig -n $(LIB_DIR); \ 103 ar -r $@.a $^; \ 104 ranlib $@.a; \ 105 fi 106 librappture: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS) 95 107 if test "`uname`" == "Darwin"; then \ 96 108 $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \ … … 103 115 ranlib $@.a; \ 104 116 fi 105 librappture: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS)106 if test "`uname`" == "Darwin"; then \107 $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \108 ar -r $@.a $^; \109 ranlib -s $@.a; \110 else \111 $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ $(LIB_SCEW_FLAG) -lm; \112 /sbin/ldconfig -n $(LIB_DIR); \113 ar -r $@.a $^; \114 ranlib $@.a; \115 fi116 117 117 118 install_rappture: librappture … … 174 175 util.o: util.cc 175 176 $(CXX) $(CFLAGS) $(DEBUG) -c $? 177 node2d.o: node2d.cc 178 $(CXX) $(CFLAGS) $(DEBUG) -c $? 179 node3d.o: node3d.cc 180 $(CXX) $(CFLAGS) $(DEBUG) -c $? 176 181 endian.o: endian.cc 182 $(CXX) $(CFLAGS) $(DEBUG) -c $? 183 element.o: element.cc 177 184 $(CXX) $(CFLAGS) $(DEBUG) -c $? 178 185 … … 344 351 345 352 ################# 353 346 354 endiantest: endiantest.o 347 355 $(CXX) -o $@ $< 356 test_node: test_node.o 357 $(CXX) -o $@ $< $(LIB_RPMESH) -
trunk/src/mesh/element.h
r194 r202 4 4 #include <iostream> 5 5 #include <vector> 6 #include "node .h"6 #include "node3d.h" 7 7 #include "util.h" 8 8 … … 11 11 // in a mesh. 12 12 // 13 // Example:14 // int nodeIDs[8];15 // RpElement elements[10];16 //17 // // set ids for all elements18 // for (int i=0; i<10; i++)19 // elements[i].id(i);20 //21 // // create node list for element 022 // nodeIDs[0] = 0;23 // nodeIDs[1] = 1;24 // nodeIDs[2] = 5;25 // nodeIDs[3] = 6;26 // nodeIDs[4] = 25;27 // nodeIDs[5] = 26;28 // nodeIDs[6] = 30;29 // nodeIDs[7] = 31;30 // element[0].addNodes(nodeIDs, 8);31 //32 // nodeIDs[0] = 1;33 // nodeIDs[1] = 2;34 // nodeIDs[2] = 6;35 // nodeIDs[3] = 7;36 // nodeIDs[4] = 26;37 // nodeIDs[5] = 27;38 // nodeIDs[6] = 31;39 // nodeIDs[7] = 32;40 // element[1].addNodes(nodeIDs, 8);41 //42 // ...43 //44 //45 46 13 class RpElement { 47 14 public: … … 50 17 { 51 18 // default 52 m_nodes (8);19 m_nodes.resize(10); 53 20 }; 54 21 … … 56 23 { 57 24 m_id = id; 58 if (m_nodes.capacity() < numNodes)25 if (m_nodes.capacity() < (unsigned)numNodes) 59 26 m_nodes.resize(numNodes); 60 27 }; 61 28 62 29 // instantiate from byte stream: 63 // id(int), numNodes(int), list of ids(int *)30 // id(int), numNodes(int), list of node ids(int *) 64 31 RpElement(const char* buf); 65 32 … … 71 38 72 39 // get node id's 73 RP_ERROR getNodeIdList(int* list, int len);40 RP_ERROR getNodeIdList(int* list, int& len); 74 41 75 42 int id() { return m_id; }; 76 43 void id(int id) { m_id = id; }; 77 44 45 46 // serialize 47 // id(int), numNodes(int), list of ids(int *) 78 48 char* serialize(); 79 void serialize(constchar* buf, int buflen);80 voiddeserialize(const char* buf);49 RP_ERROR serialize(char* buf, int buflen); 50 RP_ERROR deserialize(const char* buf); 81 51 82 52 void print(); … … 91 61 int m_id; 92 62 vector<int> m_nodes; // list of node ids 63 64 // total number of bytes in an element: 65 // bytes for all node ids + element id + numberOfNodes 66 int numBytes() { 67 return ((m_nodes.size()) * sizeof(int) + 2*sizeof(int)); 68 }; 93 69 }; 94 70 -
trunk/src/mesh/node2d.h
r198 r202 31 31 { xval = m_x; yval = m_y; }; 32 32 33 void get(int * val) { val[0] = m_x; val[1] = m_y; );33 void get(int * val) { val[0] = m_x; val[1] = m_y; }; 34 34 35 35 int id() { return m_id; }; -
trunk/src/mesh/util.cc
r186 r202 1 #include " rp_defs.h"1 #include "util.h" 2 2 3 3 string RpErrorStr; -
trunk/src/mesh/util.h
r186 r202 20 20 }; 21 21 22 enum RP_ERROR _CODES{22 enum RP_ERROR { 23 23 RP_SUCCESS, 24 RP_FAILURE, 24 25 RP_ERR_MEM_ALLOC, 25 26 RP_ERR_NULL_PTR, 26 RP_ERR_TIMEOUT 27 RP_ERR_TIMEOUT, 28 RP_ERR_OUTOFBOUND_INDEX, 29 RP_ERR_INVALID_ARRAY 27 30 }; 28 31
Note: See TracChangeset
for help on using the changeset viewer.