cellsystem.cpp

00001 #include <algorithms/cellsystem.h>
00002 
00003 #include <storage/vector.h>
00004 #include <iostream>
00005 
00006 using std::endl;
00007 using std::cerr;
00008 
00009 namespace cell_system
00010 {
00011   bool CellSystemCell::serialize(storage::VVEStorage& store)
00012   {
00013     if(!store.field("Area", area))
00014     {
00015       area = 0;
00016       cerr << "Warning, reading cell with invalid area" << endl;
00017     }
00018     if(!store.field("Position", pos))
00019       return false;
00020     if(!store.field("Label", label))
00021       return false;
00022     return true;
00023   }
00024 
00025   bool CellSystemJunction::serialize(storage::VVEStorage& store)
00026   {
00027     if(!store.field("Position", pos))
00028       return false;
00029     if(!store.field("Force", force))
00030     {
00031       cerr << "Warning, cell system junction without any force. Starting with zero force." << endl;
00032       force = Point3d();
00033     }
00034     if(!store.field("Velocity", velocity))
00035     {
00036       cerr << "Warning, cell system junction without any velocity. Starting with zero velocity." << endl;
00037       velocity = Point3d();
00038     }
00039     return true;
00040   }
00041 
00042   std::string removeWhitespace(std::string s)
00043   {
00044     size_t pos = s.find_first_not_of(" \t\r");
00045     if(pos == std::string::npos)
00046       s = "";
00047     else {
00048       s = s.substr(pos, std::string::npos);
00049       pos = s.find_last_not_of(" \t\r");
00050       if(pos != std::string::npos)
00051         s = s.substr(0, pos + 1);
00052     }
00053     return s;
00054   }
00055 
00056 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:37:49 2013 for VVE by  doxygen 1.6.3