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 #ifndef MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00030 #define MESHBASEDCELLPOPULATIONWITHGHOSTNODES_HPP_
00031
00032 #include "MeshBasedCellPopulation.hpp"
00033 #include "TrianglesMeshReader.hpp"
00034
00035 #include "ChasteSerialization.hpp"
00036 #include <boost/serialization/base_object.hpp>
00037 #include <boost/serialization/vector.hpp>
00038
00049 template<unsigned DIM>
00050 class MeshBasedCellPopulationWithGhostNodes : public MeshBasedCellPopulation<DIM>
00051 {
00052 private:
00053
00055 friend class TestMeshBasedCellPopulationWithGhostNodes;
00056
00058 std::vector<bool> mIsGhostNode;
00059
00063 double mGhostSpringStiffness;
00064
00066 friend class boost::serialization::access;
00078 template<class Archive>
00079 void serialize(Archive & archive, const unsigned int version)
00080 {
00081
00082 archive & mIsGhostNode;
00083 archive & mGhostSpringStiffness;
00084 archive & boost::serialization::base_object<MeshBasedCellPopulation<DIM> >(*this);
00085 }
00086
00092 void SetGhostNodes(const std::set<unsigned>& rGhostNodeIndices);
00093
00103 void Validate();
00104
00105 public:
00106
00116 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00117 std::vector<CellPtr>& rCells,
00118 const std::vector<unsigned> locationIndices=std::vector<unsigned>(),
00119 bool deleteMesh=false,
00120 double ghostSpringStiffness=15.0);
00121
00128 MeshBasedCellPopulationWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00129 double ghostSpringStiffness=15.0);
00130
00141 void UpdateNodeLocations(const std::vector< c_vector<double, DIM> >& rNodeForces, double dt);
00142
00146 std::vector<bool>& rGetGhostNodes();
00147
00158 bool IsGhostNode(unsigned index);
00159
00163 std::set<unsigned> GetGhostNodeIndices();
00164
00171 void UpdateGhostPositions(double dt);
00172
00178 void UpdateGhostNodesAfterReMesh(NodeMap& rMap);
00179
00188 c_vector<double, DIM> CalculateForceBetweenGhostNodes(const unsigned& rNodeAGlobalIndex, const unsigned& rNodeBGlobalIndex);
00189
00201 CellPtr AddCell(CellPtr pNewCell, const c_vector<double,DIM>& rCellDivisionVector, CellPtr pParentCell);
00202
00206 void WriteVtkResultsToFile();
00207
00216 void OutputCellPopulationParameters(out_stream& rParamsFile);
00217 };
00218
00219
00220 #include "SerializationExportWrapper.hpp"
00221 EXPORT_TEMPLATE_CLASS_SAME_DIMS(MeshBasedCellPopulationWithGhostNodes)
00222
00223 namespace boost
00224 {
00225 namespace serialization
00226 {
00230 template<class Archive, unsigned DIM>
00231 inline void save_construct_data(
00232 Archive & ar, const MeshBasedCellPopulationWithGhostNodes<DIM> * t, const BOOST_PFTO unsigned int file_version)
00233 {
00234
00235 const MutableMesh<DIM,DIM>* p_mesh = &(t->rGetMesh());
00236 ar & p_mesh;
00237 }
00238
00243 template<class Archive, unsigned DIM>
00244 inline void load_construct_data(
00245 Archive & ar, MeshBasedCellPopulationWithGhostNodes<DIM> * t, const unsigned int file_version)
00246 {
00247
00248 MutableMesh<DIM,DIM>* p_mesh;
00249 ar >> p_mesh;
00250
00251
00252 ::new(t)MeshBasedCellPopulationWithGhostNodes<DIM>(*p_mesh);
00253
00254 }
00255 }
00256 }
00257
00258 #endif