MeshBasedTissueWithGhostNodes.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 #ifndef MESHBASEDTISSUEWITHGHOSTNODES_HPP_
00029 #define MESHBASEDTISSUEWITHGHOSTNODES_HPP_
00030
00031 #include "MeshBasedTissue.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 MeshBasedTissueWithGhostNodes : public MeshBasedTissue<DIM>
00050 {
00051 private:
00053 friend class TestMeshBasedTissueWithGhostNodes;
00054
00056 std::vector<bool> mIsGhostNode;
00057
00059 friend class boost::serialization::access;
00071 template<class Archive>
00072 void serialize(Archive & archive, const unsigned int version)
00073 {
00074
00075 archive & mIsGhostNode;
00076 archive & boost::serialization::base_object<MeshBasedTissue<DIM> >(*this);
00077 }
00078
00084 void SetGhostNodes(const std::set<unsigned>& rGhostNodeIndices);
00085
00095 void Validate();
00096
00097 public:
00098
00107 MeshBasedTissueWithGhostNodes(MutableMesh<DIM, DIM>& rMesh,
00108 std::vector<TissueCell>& rCells,
00109 const std::vector<unsigned> locationIndices=std::vector<unsigned>(),
00110 bool deleteMesh=false);
00111
00117 MeshBasedTissueWithGhostNodes(MutableMesh<DIM, DIM>& rMesh);
00118
00129 void UpdateNodeLocations(const std::vector< c_vector<double, DIM> >& rNodeForces, double dt);
00130
00134 std::vector<bool>& rGetGhostNodes();
00135
00146 bool IsGhostNode(unsigned index);
00147
00151 std::set<unsigned> GetGhostNodeIndices();
00152
00159 void UpdateGhostPositions(double dt);
00160
00166 void UpdateGhostNodesAfterReMesh(NodeMap& rMap);
00167
00176 c_vector<double, DIM> CalculateForceBetweenNodes(const unsigned& rNodeAGlobalIndex, const unsigned& rNodeBGlobalIndex);
00177
00188 TissueCell* AddCell(TissueCell& rNewCell, const c_vector<double,DIM>& rCellDivisionVector, TissueCell* pParentCell=NULL);
00189 };
00190
00191
00192 #include "SerializationExportWrapper.hpp"
00193 EXPORT_TEMPLATE_CLASS_SAME_DIMS(MeshBasedTissueWithGhostNodes)
00194
00195 namespace boost
00196 {
00197 namespace serialization
00198 {
00202 template<class Archive, unsigned DIM>
00203 inline void save_construct_data(
00204 Archive & ar, const MeshBasedTissueWithGhostNodes<DIM> * t, const BOOST_PFTO unsigned int file_version)
00205 {
00206
00207 const MutableMesh<DIM,DIM>* p_mesh = &(t->rGetMesh());
00208 ar & p_mesh;
00209 }
00210
00215 template<class Archive, unsigned DIM>
00216 inline void load_construct_data(
00217 Archive & ar, MeshBasedTissueWithGhostNodes<DIM> * t, const unsigned int file_version)
00218 {
00219
00220 MutableMesh<DIM,DIM>* p_mesh;
00221 ar >> p_mesh;
00222
00223
00224 ::new(t)MeshBasedTissueWithGhostNodes<DIM>(*p_mesh);
00225
00226 }
00227 }
00228 }
00229
00230 #endif