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 #ifndef MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00029 #define MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00030
00031 #include "MeshBasedCellPopulation.hpp"
00032 #include "TrianglesMeshReader.hpp"
00033
00034 #include "ChasteSerialization.hpp"
00035 #include <boost/serialization/base_object.hpp>
00036 #include <boost/serialization/vector.hpp>
00037
00048 template<unsigned DIM>
00049 class MeshBasedCellPopulationWithGhostNodes : public MeshBasedCellPopulation<DIM>
00050 {
00051 private:
00052
00054 friend class TestMeshBasedCellPopulationWithGhostNodes;
00055
00057 std::vector<bool> mIsGhostNode;
00058
00062 double mGhostSpringStiffness;
00063
00065 friend class boost::serialization::access;
00077 template<class Archive>
00078 void serialize(Archive & archive, const unsigned int version)
00079 {
00080
00081 archive & mIsGhostNode;
00082 archive & mGhostSpringStiffness;
00083 archive & boost::serialization::base_object<MeshBasedCellPopulation<DIM> >(*this);
00084 }
00085
00091 void SetGhostNodes(const std::set<unsigned>& rGhostNodeIndices);
00092
00102 void Validate();
00103
00104 public:
00105
00115 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00116 std::vector<CellPtr>& rCells,
00117 const std::vector<unsigned> locationIndices=std::vector<unsigned>(),
00118 bool deleteMesh=false,
00119 double ghostSpringStiffness=15.0);
00120
00127 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00128 double ghostSpringStiffness=15.0);
00129
00140 void UpdateNodeLocations(const std::vector< c_vector<double, DIM> >& rNodeForces, double dt);
00141
00145 std::vector<bool>& rGetGhostNodes();
00146
00157 bool IsGhostNode(unsigned index);
00158
00162 std::set<unsigned> GetGhostNodeIndices();
00163
00170 void UpdateGhostPositions(double dt);
00171
00177 void UpdateGhostNodesAfterReMesh(NodeMap& rMap);
00178
00187 c_vector<double, DIM> CalculateForceBetweenGhostNodes(const unsigned& rNodeAGlobalIndex, const unsigned& rNodeBGlobalIndex);
00188
00200 CellPtr AddCell(CellPtr pNewCell, const c_vector<double,DIM>& rCellDivisionVector, CellPtr pParentCell);
00201
00205 void WriteVtkResultsToFile();
00206
00215 void OutputCellPopulationParameters(out_stream& rParamsFile);
00216 };
00217
00218
00219 #include "SerializationExportWrapper.hpp"
00220 EXPORT_TEMPLATE_CLASS_SAME_DIMS(MeshBasedCellPopulationWithGhostNodes)
00221
00222 namespace boost
00223 {
00224 namespace serialization
00225 {
00229 template<class Archive, unsigned DIM>
00230 inline void save_construct_data(
00231 Archive & ar, const MeshBasedCellPopulationWithGhostNodes<DIM> * t, const BOOST_PFTO unsigned int file_version)
00232 {
00233
00234 const MutableMesh<DIM,DIM>* p_mesh = &(t->rGetMesh());
00235 ar & p_mesh;
00236 }
00237
00242 template<class Archive, unsigned DIM>
00243 inline void load_construct_data(
00244 Archive & ar, MeshBasedCellPopulationWithGhostNodes<DIM> * t, const unsigned int file_version)
00245 {
00246
00247 MutableMesh<DIM,DIM>* p_mesh;
00248 ar >> p_mesh;
00249
00250
00251 ::new(t)MeshBasedCellPopulationWithGhostNodes<DIM>(*p_mesh);
00252
00253 }
00254 }
00255 }
00256
00257 #endif