- Timestamp:
- Mar 12, 2006 8:29:56 PM (18 years ago)
- Location:
- trunk/src/mesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/field.cc
r327 r334 5 5 #include "field.h" 6 6 7 void RpField::setMesh(const char* meshId) 8 { 9 m_meshName.assign(meshId); 7 RP_ERROR RpField::setMeshObj(RpSerializable* mesh) 8 { 9 if (mesh) { 10 m_mesh = mesh; 11 return RP_SUCCESS; 12 } 13 else { 14 return RP_ERR_NULL_PTR; 15 } 10 16 } 11 17 -
trunk/src/mesh/field.h
r327 r334 3 3 4 4 // 5 // class for field values 5 // Class for field object 6 // 7 // Example usage: 8 // mesh = new RpGrid2d; 9 // mesh->addAllPoints(x,y); 10 // field = new RpField; 11 // field->addValues(val); 12 // 6 13 // 7 14 … … 13 20 public: 14 21 // constructors 15 RpField() { };22 RpField() { m_mesh = NULL; }; 16 23 17 RpField(int size) : RpGrid1d(size) { };24 RpField(int size) : RpGrid1d(size) { m_mesh = NULL; }; 18 25 19 RpField(const char* name, int size=0) : RpGrid1d(name,size) { }; 26 RpField(const char* name, int size=0) : RpGrid1d(name,size) 27 { m_mesh = NULL; }; 20 28 21 // set mesh link 22 void setMesh(const char* meshId); 29 // set name of mesh object used in field 30 void setMeshId(const char* meshId) { m_meshName.assign(meshId); }; 31 32 // set name of mesh object used in field 33 RP_ERROR setMeshObj(RpSerializable* meshPtr); 34 35 // remove mesh - only erase name and remove ptr (not free memory as serializer manages the object memory) 36 void removeMesh(); 37 38 const char* getMeshId() { return m_meshName.c_str(); }; 39 RpSerializable* getMeshObj() { return m_mesh; }; 23 40 24 41 // return number of bytes needed for serialization … … 27 44 // return object type as a char string 28 45 virtual const char* objectType(); 46 47 virtual RP_ERROR addAllValues(double* val, int nitems) { 48 return RpGrid1d::addAllPoints(val, nitems); 49 }; 50 51 virtual void addValue(double val) { 52 RpGrid1d::addPoint(val); 53 }; 29 54 30 55 // serialize data … … 57 82 private: 58 83 std::string m_meshName; // mesh 84 RpSerializable* m_mesh; // pointer to mesh object 59 85 }; 60 86
Note: See TracChangeset
for help on using the changeset viewer.