当前位置: 首页>>代码示例>>C++>>正文


C++ CellPtr类代码示例

本文整理汇总了C++中CellPtr的典型用法代码示例。如果您正苦于以下问题:C++ CellPtr类的具体用法?C++ CellPtr怎么用?C++ CellPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CellPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

unsigned AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>::GetLocationIndexUsingCell(CellPtr pCell)
{
    // Check the cell is in the map
    assert(this->mCellLocationMap.find(pCell.get()) != this->mCellLocationMap.end());

    return mCellLocationMap[pCell.get()];
}
开发者ID:ktunya,项目名称:Chaste,代码行数:7,代码来源:AbstractCellPopulation.cpp

示例2: constraintIsConsistent

bool MeshTestUtility::constraintIsConsistent(MeshTopologyViewPtr meshTopo, AnnotatedEntity &constrainingEntity,
                                             int d, IndexType constrainedEntityIndex, bool requireConstrainingEntityBelongToActiveCell)
{
  int sideDim = meshTopo->getDimension() - 1;
  CellPtr constrainingCell = meshTopo->getCell(constrainingEntity.cellID);
  int constrainingSubcordInCell = CamelliaCellTools::subcellOrdinalMap(constrainingCell->topology(),
                                                                       sideDim, constrainingEntity.sideOrdinal,
                                                                       constrainingEntity.dimension, constrainingEntity.subcellOrdinal);
  
  IndexType constrainingEntityIndex = constrainingCell->entityIndex(constrainingEntity.dimension, constrainingSubcordInCell);
  bool isAncestor = meshTopo->entityIsGeneralizedAncestor(constrainingEntity.dimension, constrainingEntityIndex, d, constrainedEntityIndex);
  
  if (!isAncestor) return false;
  
  if (requireConstrainingEntityBelongToActiveCell)
  {
    set<pair<IndexType,unsigned>> cellEntries = meshTopo->getCellsContainingEntity(constrainingEntity.dimension, constrainingEntityIndex);
    auto activeCells = &meshTopo->getActiveCellIndices();
    for (auto cellEntry : cellEntries)
    {
      IndexType cellID = cellEntry.first;
      if (activeCells->find(cellID) != activeCells->end()) return true; // found an active cell, and isAncestor is true
    }
    return false;
  }
  
  return isAncestor;
}
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:28,代码来源:MeshTestUtility.cpp

示例3:

void ApoptoticCellKiller<SPACE_DIM>::CheckAndLabelSingleCellForApoptosis(CellPtr pCell)
{
    if (pCell->HasCellProperty<ApoptoticCellProperty>() && !(pCell->HasApoptosisBegun()))
    {
        pCell->StartApoptosis();
    }
}
开发者ID:ktunya,项目名称:ChasteMod,代码行数:7,代码来源:ApoptoticCellKiller.cpp

示例4: consp

bool consp(ExprPtr e)
{
	if (!dynamic_pointer_cast<Cell>(e))
		return false;
	CellPtr c = static_pointer_cast<Cell>(e);
	if (c->is_nil())
		return false;
	return true;
}
开发者ID:duyanning,项目名称:finelisp,代码行数:9,代码来源:Cell.cpp

示例5: checkConstraintConsistency

bool MeshTestUtility::checkConstraintConsistency(MeshPtr meshMinimumRule)
{
  MeshTopologyViewPtr meshTopo = meshMinimumRule->getTopology();
  GDAMinimumRule* minRule = dynamic_cast<GDAMinimumRule*>(meshMinimumRule->globalDofAssignment().get());
  
  bool consistent = true;
  
  for (IndexType cellID : meshMinimumRule->cellIDsInPartition())
  {
    CellConstraints constraints = minRule->getCellConstraints(cellID);
    CellPtr cell = meshTopo->getCell(cellID);
    CellTopoPtr cellTopo = cell->topology();
    
    for (int d=0; d<cellTopo->getDimension(); d++)
    {
      int scCount = cellTopo->getSubcellCount(d);
      for (int scord=0; scord<scCount; scord++)
      {
        IndexType entityIndex = cell->entityIndex(d, scord);
        
        AnnotatedEntity constrainingEntity = constraints.subcellConstraints[d][scord];
        bool isConsistent = constraintIsConsistent(meshTopo, constrainingEntity, d, entityIndex, true);
        
        if (!isConsistent)
        {
          cout << "Failed consistency test for standard constraints on cell " << cellID << ", " << CamelliaCellTools::entityTypeString(d) << " " << scord << endl;
          
          consistent = false;
          break;
        }
        
        // now, check space-only constraints (for space-time meshes), if these are defined for this subcell
        if (constraints.spatialSliceConstraints != Teuchos::null)
        {
          AnnotatedEntity constrainingEntityForSpatialSlice = constraints.spatialSliceConstraints->subcellConstraints[d][scord];
          if (constrainingEntityForSpatialSlice.cellID != -1) {
            isConsistent = constraintIsConsistent(meshTopo, constrainingEntityForSpatialSlice, d, entityIndex, true);
            
          }
          if (!isConsistent)
          {
            cout << "Failed consistency test for spatial slice on cell " << cellID << ", " << CamelliaCellTools::entityTypeString(d) << " " << scord << endl;
            
            consistent = false;
            break;
          }
        }
      }
      if (!consistent) break;
    }
    if (!consistent) break;
  }
  return consistent;
}
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:54,代码来源:MeshTestUtility.cpp

示例6: MeshTopology

MeshPtr MeshTools::timeSliceMesh(MeshPtr spaceTimeMesh, double t,
                                 map<GlobalIndexType, GlobalIndexType> &sliceCellIDToSpaceTimeCellID, int H1OrderForSlice) {
  MeshTopologyPtr meshTopo = spaceTimeMesh->getTopology();
  set<IndexType> cellIDsToCheck = meshTopo->getRootCellIndices();
  set<IndexType> activeCellIDsForTime;
  
  set<IndexType> allActiveCellIDs = meshTopo->getActiveCellIndices();
  
  int spaceDim = meshTopo->getSpaceDim() - 1;  // # of true spatial dimensions
  
  MeshTopologyPtr sliceTopo = Teuchos::rcp( new MeshTopology(spaceDim) );
  set<IndexType> rootCellIDs = meshTopo->getRootCellIndices();
  for (set<IndexType>::iterator rootCellIt = rootCellIDs.begin(); rootCellIt != rootCellIDs.end(); rootCellIt++) {
    IndexType rootCellID = *rootCellIt;
    FieldContainer<double> physicalNodes = spaceTimeMesh->physicalCellNodesForCell(rootCellID);
    if (cellMatches(physicalNodes, t)) { // cell and some subset of its descendents should be included in slice mesh
      vector< vector< double > > sliceNodes = timeSliceForCell(physicalNodes, t);
      CellTopoPtrLegacy cellTopo = getBottomTopology(meshTopo, rootCellID);
      CellPtr sliceCell = sliceTopo->addCell(cellTopo, sliceNodes);
      sliceCellIDToSpaceTimeCellID[sliceCell->cellIndex()] = rootCellID;
    }
  }
  
  MeshPtr sliceMesh = Teuchos::rcp( new Mesh(sliceTopo, spaceTimeMesh->bilinearForm(), H1OrderForSlice, spaceDim) );
  
  // process refinements.  For now, we assume isotropic refinements, which means that each refinement in spacetime induces a refinement in the spatial slice
  set<IndexType> sliceCellIDsToCheckForRefinement = sliceTopo->getActiveCellIndices();
  while (sliceCellIDsToCheckForRefinement.size() > 0) {
    set<IndexType>::iterator cellIt = sliceCellIDsToCheckForRefinement.begin();
    IndexType sliceCellID = *cellIt;
    sliceCellIDsToCheckForRefinement.erase(cellIt);
    
    CellPtr sliceCell = sliceTopo->getCell(sliceCellID);
    CellPtr spaceTimeCell = meshTopo->getCell(sliceCellIDToSpaceTimeCellID[sliceCellID]);
    if (spaceTimeCell->isParent()) {
      set<GlobalIndexType> cellsToRefine;
      cellsToRefine.insert(sliceCellID);
      sliceMesh->hRefine(cellsToRefine, RefinementPattern::regularRefinementPattern(sliceCell->topology()->getKey()));
      vector<IndexType> spaceTimeChildren = spaceTimeCell->getChildIndices();
      for (int childOrdinal=0; childOrdinal<spaceTimeChildren.size(); childOrdinal++) {
        IndexType childID = spaceTimeChildren[childOrdinal];
        FieldContainer<double> childNodes = meshTopo->physicalCellNodesForCell(childID);
        if (cellMatches(childNodes, t)) {
          vector< vector<double> > childSlice = timeSliceForCell(childNodes, t);
          CellPtr childSliceCell = sliceTopo->findCellWithVertices(childSlice);
          sliceCellIDToSpaceTimeCellID[childSliceCell->cellIndex()] = childID;
          sliceCellIDsToCheckForRefinement.insert(childSliceCell->cellIndex());
        }
      }
    }
  }
  
  return sliceMesh;
}
开发者ID:Kun-Qu,项目名称:Camellia,代码行数:54,代码来源:MeshTools.cpp

示例7:

void AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>::SetCellUsingLocationIndex(unsigned index, CellPtr pCell)
{
    // Clear the maps
    mLocationCellMap[index].clear();
    mCellLocationMap.erase(pCell.get());

    // Replace with new cell
    mLocationCellMap[index].insert(pCell);

    // Do other half of the map
    mCellLocationMap[pCell.get()] = index;
}
开发者ID:ktunya,项目名称:Chaste,代码行数:12,代码来源:AbstractCellPopulation.cpp

示例8: makeRectMesh

bool MeshTopologyTests::testCellsForEntity()
{
  bool success = true;

  // to begin, a simple test that cellsForEntity()'s side ordinals are consistent

  MeshTopologyPtr mesh2D = makeRectMesh(0.0, 0.0, 1.0, 1.0, 1, 1);
  IndexType cellID = 0;
  CellPtr cell = mesh2D->getCell(cellID); // the only cell in the mesh

  int spaceDim = mesh2D->getDimension();
  int sideDim = spaceDim - 1;

  for (int d=0; d<spaceDim; d++)
  {
    int scCount = cell->topology()->getSubcellCount(d);
    for (int scord=0; scord<scCount; scord++)
    {
      IndexType scEntityIndex = cell->entityIndex(d, scord);
      set< pair<IndexType, unsigned> > cellsContainingEntity = mesh2D->getCellsContainingEntity(d, scEntityIndex);
      vector<IndexType> sidesContainingEntity = mesh2D->getSidesContainingEntity(d, scEntityIndex);
      if (cellsContainingEntity.size() != 1)
      {
        cout << "cellsContainingEntity should have exactly one entry, but has " << cellsContainingEntity.size() << endl;
        success = false;
      }
      else
      {
        pair<IndexType, unsigned> cellEntry = *(cellsContainingEntity.begin());
//        cout << "for d " << d << ", scord " << scord << ", cell containing entity is (" << cellEntry.first << ", " << cellEntry.second << ")\n";
        if (cellEntry.first != cellID)
        {
          cout << "Expected cellEntry.first = " << cellID << ", but is " << cellEntry.first << endl;
          success = false;
        }
        else
        {
          unsigned sideOrdinal = cellEntry.second;
          IndexType sideEntityIndex = cell->entityIndex(sideDim, sideOrdinal);
          if (std::find(sidesContainingEntity.begin(), sidesContainingEntity.end(), sideEntityIndex) == sidesContainingEntity.end())
          {
            cout << "The side returned by getCellsContainingEntity() does not contain the specified entity.\n";
            success = false;
          }
        }
      }
    }
  }

  return success;
}
开发者ID:vijaysm,项目名称:Camellia,代码行数:51,代码来源:MeshTopologyTests.cpp

示例9: buildLookupTables

void Boundary::buildLookupTables()
{
  _boundaryElements.clear();

  const set<GlobalIndexType>* rankLocalCells = &_mesh->cellIDsInPartition();
  for (GlobalIndexType cellID : *rankLocalCells)
  {
    CellPtr cell = _mesh->getTopology()->getCell(cellID);
    vector<unsigned> boundarySides = cell->boundarySides();
    for (int i=0; i<boundarySides.size(); i++)
    {
      _boundaryElements.insert(make_pair(cellID, boundarySides[i]));
    }
  }
}
开发者ID:vijaysm,项目名称:Camellia,代码行数:15,代码来源:Boundary.cpp

示例10:

void CellMutationStatesWriter<ELEMENT_DIM, SPACE_DIM>::VisitCell(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
{
    double mutation_state = pCell->GetMutationState()->GetColour();

    CellPropertyCollection collection = pCell->rGetCellPropertyCollection();
    CellPropertyCollection label_collection = collection.GetProperties<CellLabel>();

    if (label_collection.GetSize() == 1)
    {
        boost::shared_ptr<CellLabel> p_label = boost::static_pointer_cast<CellLabel>(label_collection.GetProperty());
        mutation_state = p_label->GetColour();
    }

    *this->mpOutStream << mutation_state << " ";
}
开发者ID:getshameer,项目名称:Chaste,代码行数:15,代码来源:CellMutationStatesWriter.cpp

示例11:

double CellMutationStatesWriter<ELEMENT_DIM, SPACE_DIM>::GetCellDataForVtkOutput(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
{
    double mutation_state = pCell->GetMutationState()->GetColour();

    CellPropertyCollection collection = pCell->rGetCellPropertyCollection();
    CellPropertyCollection label_collection = collection.GetProperties<CellLabel>();

    if (label_collection.GetSize() == 1)
    {
        boost::shared_ptr<CellLabel> p_label = boost::static_pointer_cast<CellLabel>(label_collection.GetProperty());
        mutation_state = p_label->GetColour();
    }

    return mutation_state;
}
开发者ID:Chaste,项目名称:Old-Chaste-svn-mirror,代码行数:15,代码来源:CellMutationStatesWriter.cpp

示例12: UpdateRadius

void UpdateRadius(CellPtr pCell){
  double MaxRad = GetMaxRadius(pCell);
  double Rad = pCell->GetCellData()->GetItem("Radius");
  if(Rad<MaxRad-0.1){
    SetRadius(pCell,Rad+=GetTimestep());
  }
};
开发者ID:KathrynA,项目名称:ChasteElegansProject,代码行数:7,代码来源:StatechartInterface.hpp

示例13: make_cell

ListPtr Parser::read_list()
{

	CellPtr head = make_cell();
	CellPtr current = head;

	m_word = m_scanner->get_word();

	ExprPtr expr;
	if (m_word.type == ")") {
		return head;
	}
	else {
		expr = read_expr();
		head->setcar(expr);

		m_word = m_scanner->get_word();
	}

	while (m_word.type != ")") {
		if (m_word.type == ".") {
			m_word = m_scanner->get_word();
			expr = read_expr();
			current->setcdr(expr);

			m_word = m_scanner->get_word();
		}
		else if (m_word.type == ")") {
			break;
		}
		else {
			expr = read_expr();
			CellPtr new_cell = make_cell();
			new_cell->setcar(expr);
			current->setcdr(new_cell);
			current = new_cell;

			m_word = m_scanner->get_word();
		}
	}

	return head;
}
开发者ID:duyanning,项目名称:finelisp,代码行数:43,代码来源:Parser.cpp

示例14:

void CellIdWriter<ELEMENT_DIM, SPACE_DIM>::VisitCell(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
{
    unsigned cell_id = pCell->GetCellId();
    unsigned location_index = pCellPopulation->GetLocationIndexUsingCell(pCell);
    *this->mpOutStream << " " << cell_id << " " << location_index;

    c_vector<double, SPACE_DIM> coords = pCellPopulation->GetLocationOfCellCentre(pCell);
    for (unsigned i=0; i<SPACE_DIM; i++)
    {
        *this->mpOutStream << " " << coords[i];
    }
}
开发者ID:Chaste,项目名称:Old-Chaste-svn-mirror,代码行数:12,代码来源:CellIdWriter.cpp

示例15:

void CellDataItemWriter<ELEMENT_DIM, SPACE_DIM>::VisitCell(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
{
    // Output the location index corresponding to this cell
    unsigned location_index = pCellPopulation->GetLocationIndexUsingCell(pCell);
    *this->mpOutStream << location_index << " ";

    // Output this cell's ID
    unsigned cell_id = pCell->GetCellId();
    *this->mpOutStream << cell_id << " ";

    // Output the position of this cell's centre
    c_vector<double, SPACE_DIM> centre_location = pCellPopulation->GetLocationOfCellCentre(pCell);
    for (unsigned i=0; i<SPACE_DIM; i++)
    {
        *this->mpOutStream << centre_location[i] << " ";
    }

    // Output this cell's level of mCellDataVariableName
    double value = pCell->GetCellData()->GetItem(mCellDataVariableName);
    *this->mpOutStream << value << " ";
}
开发者ID:Chaste,项目名称:Old-Chaste-svn-mirror,代码行数:21,代码来源:CellDataItemWriter.cpp


注:本文中的CellPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。