MeshBasedCellPopulationWithGhostNodes.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00037 #define MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00038
00039 #include "ChasteSerialization.hpp"
00040 #include <boost/serialization/base_object.hpp>
00041 #include <boost/serialization/vector.hpp>
00042
00043 #include "MeshBasedCellPopulation.hpp"
00044
00055 template<unsigned DIM>
00056 class MeshBasedCellPopulationWithGhostNodes : public MeshBasedCellPopulation<DIM>
00057 {
00058 private:
00059
00061 friend class TestMeshBasedCellPopulationWithGhostNodes;
00062
00064 std::vector<bool> mIsGhostNode;
00065
00069 double mGhostSpringStiffness;
00070
00072 friend class boost::serialization::access;
00084 template<class Archive>
00085 void serialize(Archive & archive, const unsigned int version)
00086 {
00087
00088 archive & mIsGhostNode;
00089 archive & mGhostSpringStiffness;
00090 archive & boost::serialization::base_object<MeshBasedCellPopulation<DIM, DIM> >(*this);
00091 }
00092
00098 void SetGhostNodes(const std::set<unsigned>& rGhostNodeIndices);
00099
00109 void Validate();
00110
00111 public:
00112
00122 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00123 std::vector<CellPtr>& rCells,
00124 const std::vector<unsigned> locationIndices=std::vector<unsigned>(),
00125 bool deleteMesh=false,
00126 double ghostSpringStiffness=15.0);
00127
00134 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00135 double ghostSpringStiffness=15.0);
00136
00140 virtual ~MeshBasedCellPopulationWithGhostNodes();
00141
00150 void UpdateNodeLocations(double dt);
00151
00155 std::vector<bool>& rGetGhostNodes();
00156
00167 bool IsGhostNode(unsigned index);
00168
00172 std::set<unsigned> GetGhostNodeIndices();
00173
00180 void UpdateGhostPositions(double dt);
00181
00187 void UpdateGhostNodesAfterReMesh(NodeMap& rMap);
00188
00197 c_vector<double, DIM> CalculateForceBetweenGhostNodes(const unsigned& rNodeAGlobalIndex, const unsigned& rNodeBGlobalIndex);
00198
00210 CellPtr AddCell(CellPtr pNewCell, const c_vector<double,DIM>& rCellDivisionVector, CellPtr pParentCell);
00211
00219 virtual void OpenWritersFiles(const std::string& rDirectory);
00220
00226 virtual void WriteVtkResultsToFile(const std::string& rDirectory);
00227
00236 void OutputCellPopulationParameters(out_stream& rParamsFile);
00237 };
00238
00239
00240 #include "SerializationExportWrapper.hpp"
00241 EXPORT_TEMPLATE_CLASS_SAME_DIMS(MeshBasedCellPopulationWithGhostNodes)
00242
00243 namespace boost
00244 {
00245 namespace serialization
00246 {
00250 template<class Archive, unsigned DIM>
00251 inline void save_construct_data(
00252 Archive & ar, const MeshBasedCellPopulationWithGhostNodes<DIM> * t, const BOOST_PFTO unsigned int file_version)
00253 {
00254
00255 const MutableMesh<DIM,DIM>* p_mesh = &(t->rGetMesh());
00256 ar & p_mesh;
00257 }
00258
00263 template<class Archive, unsigned DIM>
00264 inline void load_construct_data(
00265 Archive & ar, MeshBasedCellPopulationWithGhostNodes<DIM> * t, const unsigned int file_version)
00266 {
00267
00268 MutableMesh<DIM,DIM>* p_mesh;
00269 ar >> p_mesh;
00270
00271
00272 ::new(t)MeshBasedCellPopulationWithGhostNodes<DIM>(*p_mesh);
00273 }
00274 }
00275 }
00276
00277 #endif