void MicrotubuleProcess::connectNwSw(unsigned int i) { unsigned int a(startCoord+i); Voxel& aVoxel((*theLattice)[a]); unsigned int b(startCoord+(Protofilaments-1)*theDimerSize+(i-1)); Voxel& adjoin((*theLattice)[b]); aVoxel.adjoiningCoords[aVoxel.adjoiningSize++] = b; adjoin.adjoiningCoords[adjoin.adjoiningSize++] = a; }
void MicrotubuleProcess::connectEastWest(unsigned int i, unsigned int j) { unsigned int a(startCoord+j*theDimerSize+i); Voxel& aVoxel((*theLattice)[a]); unsigned int b(startCoord+(j-1)*theDimerSize+i); Voxel& adjoin((*theLattice)[b]); aVoxel.adjoiningCoords[aVoxel.adjoiningSize++] = b; adjoin.adjoiningCoords[adjoin.adjoiningSize++] = a; }
void MicrotubuleProcess::connectNorthSouth(unsigned int i, unsigned int j) { unsigned int a(startCoord+j*theDimerSize+(i-1)); Voxel& aVoxel((*theLattice)[a]); unsigned int b(startCoord+j*theDimerSize+i); Voxel& adjoin((*theLattice)[b]); aVoxel.adjoiningCoords[NORTH] = b; adjoin.adjoiningCoords[SOUTH] = a; aVoxel.adjoiningSize = 2; adjoin.adjoiningSize = 2; }
void MicrotubuleProcess::connectPeriodic(unsigned int j) { unsigned int a(startCoord+j*theDimerSize+theDimerSize-1); Voxel& aVoxel((*theLattice)[a]); unsigned int b(startCoord+j*theDimerSize); Voxel& adjoin((*theLattice)[b]); aVoxel.adjoiningCoords[NORTH] = b; adjoin.adjoiningCoords[SOUTH] = a; aVoxel.adjoiningSize = 2; adjoin.adjoiningSize = 2; }
void MicrotubuleProcess::addIndirect(Voxel& offVoxel, unsigned a, Voxel& latVoxel, unsigned b) { Point aPoint(*offVoxel.point); for(unsigned int i(0); i != theAdjoiningCoordSize; ++i) { unsigned int aCoord(latVoxel.adjoiningCoords[i]); Voxel& adjoin((*theLattice)[aCoord]); if(adjoin.id == theComp->vacantSpecies->getID() || adjoin.id == tempID) { Point adPoint(theSpatiocyteStepper->coord2point(aCoord)); double dist(getDistance(&aPoint, &adPoint)); if(dist <= offLatticeRadius && inMTCylinder(adPoint)) { offVoxel.adjoiningCoords[offVoxel.adjoiningSize++] = b; initAdjoins(latVoxel); updateAdjoinSize(latVoxel); latVoxel.initAdjoins[latVoxel.adjoiningSize++] = a; } } } }
int dm_table_add_target(struct dm_table *t, const char *type, sector_t start, sector_t len, char *params) { int r = -EINVAL, argc; char **argv; struct dm_target *tgt; if ((r = check_space(t))) return r; tgt = t->targets + t->num_targets; memset(tgt, 0, sizeof(*tgt)); if (!len) { DMERR("%s: zero-length target", dm_device_name(t->md)); return -EINVAL; } tgt->type = dm_get_target_type(type); if (!tgt->type) { DMERR("%s: %s: unknown target type", dm_device_name(t->md), type); return -EINVAL; } tgt->table = t; tgt->begin = start; tgt->len = len; tgt->error = "Unknown error"; /* * Does this target adjoin the previous one ? */ if (!adjoin(t, tgt)) { tgt->error = "Gap in table"; r = -EINVAL; goto bad; } r = dm_split_args(&argc, &argv, params); if (r) { tgt->error = "couldn't split parameters (insufficient memory)"; goto bad; } r = tgt->type->ctr(tgt, argc, argv); kfree(argv); if (r) goto bad; t->highs[t->num_targets++] = tgt->begin + tgt->len - 1; /* FIXME: the plan is to combine high here and then have * the merge fn apply the target level restrictions. */ combine_restrictions_low(&t->limits, &tgt->limits); return 0; bad: DMERR("%s: %s: %s", dm_device_name(t->md), type, tgt->error); dm_put_target_type(tgt->type); return r; }
void MicrotubuleProcess::enlistLatticeVoxels() { for(unsigned int n(startCoord); n != endCoord; ++n) { Voxel& offVoxel((*theLattice)[n]); offVoxel.diffuseSize = offVoxel.adjoiningSize; double rA(theSpatiocyteStepper->getMinLatticeSpace()); if(rA < offLatticeRadius) { rA = offLatticeRadius; } Point center(*offVoxel.point); unsigned int aCoord(theSpatiocyteStepper->point2coord(center)); Point cl(theSpatiocyteStepper->coord2point(aCoord)); //theSpecies[3]->addMolecule(aVoxel.coord); Point bottomLeft(*offVoxel.point); Point topRight(*offVoxel.point); bottomLeft.x -= rA+center.x-cl.x+theSpatiocyteStepper->getColLength(); bottomLeft.y -= rA+center.y-cl.y+theSpatiocyteStepper->getLayerLength(); bottomLeft.z -= rA+center.z-cl.z+theSpatiocyteStepper->getRowLength(); topRight.x += rA+cl.x-center.x+theSpatiocyteStepper->getColLength()*1.5; topRight.y += rA+cl.y-center.y+theSpatiocyteStepper->getLayerLength()*1.5; topRight.z += rA+cl.z-center.z+theSpatiocyteStepper->getRowLength()*1.5; unsigned int blRow(0); unsigned int blLayer(0); unsigned int blCol(0); theSpatiocyteStepper->point2global(bottomLeft, blRow, blLayer, blCol); unsigned int trRow(0); unsigned int trLayer(0); unsigned int trCol(0); theSpatiocyteStepper->point2global(topRight, trRow, trLayer, trCol); std::vector<unsigned int> checkedAdjoins; for(unsigned int i(blRow); i < trRow; ++i) { for(unsigned int j(blLayer); j < trLayer; ++j) { for(unsigned int k(blCol); k < trCol; ++k) { unsigned int lat(theSpatiocyteStepper->global2coord(i, j, k)); Voxel& latVoxel((*theLattice)[lat]); if(latVoxel.id != theSpatiocyteStepper->getNullID()) { //theSpecies[3]->addMolecule(latVoxel); Point aPoint(theSpatiocyteStepper->coord2point(lat)); if(inMTCylinder(aPoint)) { for(unsigned int l(0); l != theAdjoiningCoordSize; ++l) { unsigned adj(latVoxel.adjoiningCoords[l]); Voxel& adjoin((*theLattice)[adj]); if(adjoin.id == theComp->vacantSpecies->getID()) { checkedAdjoins.push_back(adj); addDirect(offVoxel, n, adjoin, adj); } } } } } } } for(unsigned int i(0); i != checkedAdjoins.size(); ++i) { (*theLattice)[checkedAdjoins[i]].id = theComp->vacantSpecies->getID(); } } for(unsigned int i(0); i != occCoords.size(); ++i) { Voxel& aVoxel((*theLattice)[occCoords[i]]); unsigned int* temp = aVoxel.initAdjoins; aVoxel.initAdjoins = aVoxel.adjoiningCoords; aVoxel.adjoiningCoords = temp; aVoxel.diffuseSize = aVoxel.adjoiningSize; } for(unsigned int i(0); i != occCoords.size(); ++i) { Voxel& aVoxel((*theLattice)[occCoords[i]]); for(unsigned int i(0); i != aVoxel.adjoiningSize; ++i) { unsigned int aCoord(aVoxel.adjoiningCoords[i]); Voxel& adjoin((*theLattice)[aCoord]); if(adjoin.id == theComp->vacantSpecies->getID()) { Point adPoint(theSpatiocyteStepper->coord2point(aCoord)); if(inMTCylinder(adPoint)) { std::cout << "error in MT Process" << std::endl; } } else if(adjoin.id != theVacantSpecies->getID() && adjoin.id != theMinusSpecies->getID() && adjoin.id != thePlusSpecies->getID() && adjoin.id != theSpatiocyteStepper->getNullID()) { std::cout << "species error in MT Process" << std::endl; } } } }