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 std::set<unsigned> GetNeighbouringLocationIndices(CellPtr pCell);
00151
00160 void UpdateNodeLocations(double dt);
00161
00165 std::vector<bool>& rGetGhostNodes();
00166
00177 bool IsGhostNode(unsigned index);
00178
00182 std::set<unsigned> GetGhostNodeIndices();
00183
00190 void UpdateGhostPositions(double dt);
00191
00197 void UpdateGhostNodesAfterReMesh(NodeMap& rMap);
00198
00207 c_vector<double, DIM> CalculateForceBetweenGhostNodes(const unsigned& rNodeAGlobalIndex, const unsigned& rNodeBGlobalIndex);
00208
00220 CellPtr AddCell(CellPtr pNewCell, const c_vector<double,DIM>& rCellDivisionVector, CellPtr pParentCell);
00221
00229 virtual void OpenWritersFiles(OutputFileHandler& rOutputFileHandler);
00230
00236 virtual void WriteVtkResultsToFile(const std::string& rDirectory);
00237
00246 void OutputCellPopulationParameters(out_stream& rParamsFile);
00247 };
00248
00249
00250 #include "SerializationExportWrapper.hpp"
00251 EXPORT_TEMPLATE_CLASS_SAME_DIMS(MeshBasedCellPopulationWithGhostNodes)
00252
00253 namespace boost
00254 {
00255 namespace serialization
00256 {
00260 template<class Archive, unsigned DIM>
00261 inline void save_construct_data(
00262 Archive & ar, const MeshBasedCellPopulationWithGhostNodes<DIM> * t, const BOOST_PFTO unsigned int file_version)
00263 {
00264
00265 const MutableMesh<DIM,DIM>* p_mesh = &(t->rGetMesh());
00266 ar & p_mesh;
00267 }
00268
00273 template<class Archive, unsigned DIM>
00274 inline void load_construct_data(
00275 Archive & ar, MeshBasedCellPopulationWithGhostNodes<DIM> * t, const unsigned int file_version)
00276 {
00277
00278 MutableMesh<DIM,DIM>* p_mesh;
00279 ar >> p_mesh;
00280
00281
00282 ::new(t)MeshBasedCellPopulationWithGhostNodes<DIM>(*p_mesh);
00283 }
00284 }
00285 }
00286
00287 #endif