MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MeshEntry.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2011 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #include "header.h"
11 #include "ElementValueFinfo.h"
12 #include "MeshEntry.h"
13 #include "Boundary.h"
14 // #include "Stencil.h"
15 #include "ChemCompt.h"
16 
18 {
20  "remeshOut",
21  "Tells the target pool or other entity that the compartment subdivision"
22  "(meshing) has changed, and that it has to redo its volume and "
23  "memory allocation accordingly."
24  "Arguments are: oldvol, numTotalEntries, startEntry, localIndices, vols"
25  "The vols specifies volumes of each local mesh entry. It also specifies"
26  "how many meshEntries are present on the local node."
27  "The localIndices vector is used for general load balancing only."
28  "It has a list of the all meshEntries on current node."
29  "If it is empty, we assume block load balancing. In this second"
30  "case the contents of the current node go from "
31  "startEntry to startEntry + vols.size()."
32  );
33  return &remeshOut;
34 }
35 
37 {
39  "remeshReacsOut",
40  "Tells connected enz or reac that the compartment subdivision"
41  "(meshing) has changed, and that it has to redo its volume-"
42  "dependent rate terms like numKf_ accordingly."
43  );
44  return &remeshReacsOut;
45 }
46 
48 {
50  // Field Definitions
53  "volume",
54  "Volume of this MeshEntry",
56  );
57 
59  dimensions (
60  "dimensions",
61  "number of dimensions of this MeshEntry",
63  );
64 
66  meshType(
67  "meshType",
68  " The MeshType defines the shape of the mesh entry."
69  " 0: Not assigned"
70  " 1: cuboid"
71  " 2: cylinder"
72  " 3. cylindrical shell"
73  " 4: cylindrical shell segment"
74  " 5: sphere"
75  " 6: spherical shell"
76  " 7: spherical shell segment"
77  " 8: Tetrahedral",
79  );
80 
82  coordinates (
83  "Coordinates",
84  "Coordinates that define current MeshEntry. Depend on MeshType.",
86  );
87 
89  neighbors (
90  "neighbors",
91  "Indices of other MeshEntries that this one connects to",
93  );
94 
96  diffusionArea (
97  "DiffusionArea",
98  "Diffusion area for geometry of interface",
100  );
101 
103  diffusionScaling (
104  "DiffusionScaling",
105  "Diffusion scaling for geometry of interface",
107  );
108 
110  // MsgDest Definitions
112  static DestFinfo process( "process",
113  "Handles process call",
115  static DestFinfo reinit( "reinit",
116  "Handles reinit call",
119  // Shared definitions
121  static Finfo* procShared[] = {
122  &process, &reinit
123  };
124  static SharedFinfo proc( "proc",
125  "Shared message for process and reinit",
126  procShared, sizeof( procShared ) / sizeof( const Finfo* )
127  );
128 
129  static Finfo* meshShared[] = {
130  remeshOut(), volume.getFinfo()
131  };
132 
133  static SharedFinfo mesh( "mesh",
134  "Shared message for updating mesh volumes and subdivisions,"
135  "typically controls pool volumes",
136  meshShared, sizeof( meshShared ) / sizeof( const Finfo* )
137  );
138 
139 
141  // SrcFinfo Definitions
143 
144  static Finfo* meshFinfos[] = {
145  &volume, // Readonly Value
146  &dimensions, // Readonly Value
147  &meshType, // Readonly Value
148  &coordinates, // Readonly Value
149  &neighbors, // Readonly Value
150  &diffusionArea, // Readonly Value
151  &diffusionScaling, // Readonly Value
152  &proc, // SharedFinfo
153  &mesh, // SharedFinfo
154  remeshReacsOut(), // SrcFinfo
155  };
156 
157  static string doc[] =
158  {
159  "Name", "MeshEntry",
160  "Author", "Upi Bhalla",
161  "Description", "One voxel in a chemical reaction compartment",
162  };
163  static Dinfo< MeshEntry > dinfo;
164  static Cinfo meshEntryCinfo (
165  "MeshEntry",
167  meshFinfos,
168  sizeof( meshFinfos ) / sizeof ( Finfo* ),
169  &dinfo,
170  doc,
171  sizeof(doc)/sizeof( string ),
172  true // This IS a FieldElement, not be be created directly.
173  );
174 
175  return &meshEntryCinfo;
176 }
177 
179 // Class definitions
182 
184  : parent_( 0 )
185 {;}
186 
188  : parent_( parent )
189 {;}
190 
192 // Process operations. Used for reac-diff calculations.
194 
205 {
206  // cout << "updateDiffusion for " << e.fieldIndex() << ", at t = " << info->currTime << ", on thr = " << info->threadIndexInGroup << endl << flush;
207  // parent_->updateDiffusion( e.fieldIndex() );
208 }
209 
214 {
215  if ( e.dataIndex() == 0 ) {
216  ObjId pa = Neutral::parent( e );
217  // parent_->lookupStoich( pa );
218  }
219 }
220 
221 
223 // Field Definitions
225 
226 double MeshEntry::getVolume( const Eref& e ) const
227 {
228  //return parent_->getMeshEntryVolume( e.dataIndex() );
229  return parent_->getMeshEntryVolume( e.fieldIndex() );
230 }
231 
232 unsigned int MeshEntry::getDimensions( const Eref& e ) const
233 {
234  return parent_->getMeshDimensions( e.fieldIndex() );
235 }
236 
237 unsigned int MeshEntry::getMeshType( const Eref& e ) const
238 {
239  return parent_->getMeshType( e.fieldIndex() );
240 }
241 
242 vector< double >MeshEntry::getCoordinates( const Eref& e ) const
243 {
244  return parent_->getCoordinates( e.fieldIndex() );
245 }
246 
247 vector< unsigned int >MeshEntry::getNeighbors( const Eref& e ) const
248 {
249  return parent_->getNeighbors( e.fieldIndex() );
250 }
251 
252 
253 vector< double >MeshEntry::getDiffusionArea( const Eref& e ) const
254 {
255  return parent_->getDiffusionArea( e.fieldIndex() );
256 }
257 
258 
259 vector< double >MeshEntry::getDiffusionScaling( const Eref& e ) const
260 {
261  return parent_->getDiffusionScaling( e.fieldIndex() );
262 }
263 
265 // Utility function to pass on mesh changes
268  double oldvol,
269  unsigned int startEntry, const vector< unsigned int >& localIndices,
270  const vector< double >& vols )
271 {
272  // cout << "MeshEntry::triggerRemesh on " << e.element()->getName() << endl;
273  remeshOut()->send( e, oldvol, parent_->getNumEntries(),
274  startEntry, localIndices, vols );
275  remeshReacsOut()->send( e );
276 }
277 
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701
DestFinfo * getFinfo() const
Definition: ValueFinfo.cpp:18
const ChemCompt * parent_
Volume or area.
Definition: MeshEntry.h:127
static const Cinfo * meshEntryCinfo
Definition: MeshEntry.cpp:181
Definition: Dinfo.h:60
unsigned int dataIndex() const
Definition: Eref.h:50
Definition: ObjId.h:20
void reinit(const Eref &e, ProcPtr info)
Definition: MeshEntry.cpp:213
virtual unsigned int getMeshDimensions(unsigned int fid) const =0
Virtual function to return dimensions of specified entry.
virtual vector< double > getCoordinates(unsigned int fid) const =0
Virtual function to return coords of mesh Entry.
unsigned int fieldIndex() const
Definition: Eref.h:61
unsigned int getNumEntries() const
Definition: ChemCompt.cpp:390
double getVolume(const Eref &e) const
Definition: MeshEntry.cpp:226
virtual vector< unsigned int > getNeighbors(unsigned int fid) const =0
Virtual function to return info on Entries connected to this one.
vector< unsigned int > getNeighbors(const Eref &e) const
Definition: MeshEntry.cpp:247
virtual vector< double > getDiffusionScaling(unsigned int fid) const =0
Virtual function to return scale factor for diffusion. 1 here.
virtual vector< double > getDiffusionArea(unsigned int fid) const =0
Virtual function to return diffusion X-section area per neighbor.
Definition: Eref.h:26
static SrcFinfo5< double, unsigned int, unsigned int, vector< unsigned int >, vector< double > > * remeshOut()
Definition: MeshEntry.cpp:17
unsigned int getDimensions(const Eref &e) const
Definition: MeshEntry.cpp:232
void triggerRemesh(const Eref &e, double oldvol, unsigned int startEntry, const vector< unsigned int > &localIndices, const vector< double > &vols)
Definition: MeshEntry.cpp:267
static SrcFinfo0 * remeshReacsOut()
Definition: MeshEntry.cpp:36
void process(const Eref &e, ProcPtr info)
Definition: MeshEntry.cpp:204
void send(const Eref &e) const
Definition: SrcFinfo.cpp:70
vector< double > getCoordinates(const Eref &e) const
Definition: MeshEntry.cpp:242
vector< double > getDiffusionArea(const Eref &e) const
Definition: MeshEntry.cpp:253
vector< double > getDiffusionScaling(const Eref &e) const
Definition: MeshEntry.cpp:259
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
virtual unsigned int getMeshType(unsigned int fid) const =0
Virtual function to return MeshType of specified entry.
static const Cinfo * initCinfo()
Definition: MeshEntry.cpp:47
virtual double getMeshEntryVolume(unsigned int fid) const =0
Virtual function to return volume of mesh Entry.
unsigned int getMeshType(const Eref &e) const
Definition: MeshEntry.cpp:237
Definition: Cinfo.h:18
Definition: Finfo.h:12