21   int faceNumber=cellFaces.
getCount(cellIndex);
 
   35   for (
int nf=0; nf<faceNumber; nf++){
 
   36     const int f=cellFaces(cellIndex, nf);
 
   39     const int c0=faceCells(f,0);
 
   50     double product=
dot(Af,ds);
 
   52     if(product > 0.0){ flag[nf]=1;}
 
   53     else if (product < 0.0) {flag[nf]=-1;}
 
   84    for(
int c=0; c<nCells; c++){
 
   85      const int particleCount = cellParticles.
getCount(c);
 
   87      if (particleCount == 0) {
 
   96     for (
int c=0; c<nCells; c++){
 
   97       const int ibType = mesh.getIBTypeForCell(c);
 
  102         const int ncNumber=cellCells.
getCount(c);
 
  103         for(
int nc=0; nc<ncNumber; nc++){
 
  104           const int cellIndex=cellCells(c,nc);
 
  120                      const string fileBase)
 
  123     string fileName=fileBase+
"CellMark.dat";
 
  126     FILE *fp=fopen(file,
"w");
 
  128     for(
int c=0; c<nCells; c++){
 
  129       int ibType = mesh.getIBTypeForCell(c);
 
  130       fprintf(fp, 
"%i\t%i\n", c, ibType);
 
  134     string fileName1 = fileBase+
"FluidCell.dat";
 
  135     string fileName2 = fileBase+
"IBMCell.dat";
 
  136     string fileName3 = fileBase+
"SolidCell.dat";
 
  143     FILE *fp1, *fp2, *fp3;
 
  144     fp1=fopen(file1,
"w");
 
  145     fp2=fopen(file2,
"w");
 
  146     fp3=fopen(file3,
"w");
 
  148     for(
int c=0; c<nCells; c++){
 
  149       int ibType = mesh.getIBTypeForCell(c);
 
  151         fprintf(fp1, 
"%i\t%e\t%e\t%e\n", c, cellCentroid[c][0],cellCentroid[c][1],cellCentroid[c][2]);
 
  154         fprintf(fp2, 
"%i\t%e\t%e\t%e\n", c, cellCentroid[c][0],cellCentroid[c][1],cellCentroid[c][2]);
 
  157         fprintf(fp3, 
"%i\t%e\t%e\t%e\n", c, cellCentroid[c][0],cellCentroid[c][1],cellCentroid[c][2]);
 
  172     for(
int f=0; f<nFaces; f++){
 
  173       const int c0 = faceCells(f, 0);
 
  174       const int c1 = faceCells(f, 1);
 
  175       const int type0 = mesh.getIBTypeForCell(c0);
 
  176       const int type1 = mesh.getIBTypeForCell(c1);
 
  182     cout<<
"ibFaceCount is "<<ibFaceCount<<endl;
 
  185     mesh.createIBFaceList(ibFaceCount);
 
  189     for(
int f=0; f<nFaces; f++){
 
  190       const int c0 = faceCells(f, 0);
 
  191       const int c1 = faceCells(f, 1);
 
  192       const int type0 = mesh.getIBTypeForCell(c0);
 
  193       const int type1 = mesh.getIBTypeForCell(c1);
 
  195         mesh.addIBFace(ibFaceCount, f);
 
  199         mesh.addIBFace(ibFaceCount, f);
 
  224   for(
int i=0; i<ibFaceList.
getLength();i++){
 
  225     const int fID = ibFaceList[i];
 
  226     const int C0 = faceCells(fID, 0);
 
  227     const int C1 = faceCells(fID, 1);
 
  230       areaSum += faceArea[fID];
 
  233       areaSum += faceArea[fID];
 
  236   cout<<
"sum of ibFace area is  "<<areaSum<<endl;
 
  257   shared_ptr<CRConnectivity> ibFaceParticles (
new CRConnectivity (ibFaces, particles));
 
  261   (*ibFaceParticles).initCount();
 
  262   const int rowSize = ibFaces.
getCount();
 
  266   for(
int p=0; p<rowSize; p++){
 
  267     const int faceIndex = ibFaceList [p];
 
  268     int C0 = faceCells(faceIndex, 0);
 
  269     int C1 = faceCells(faceIndex, 1);
 
  275     int nP = cellParticles.
getCount(C0);
 
  277     for(
int n=0; n<nP; n++){
 
  278       int pID = cellParticles(C0, n);
 
  279       if(particleType[pID] == 1){
 
  288       const int nbSize = cellCells.
getCount(C0);
 
  289       for(
int c=0; c < nbSize; c++){
 
  290         int cnb = cellCells(C0, c);
 
  292         for (
int n=0; n<nP; n++){
 
  293           int pID = cellParticles(cnb, n);
 
  294           if(particleType[pID] == 1){
 
  302     if(count>=maxcount)         maxcount=count;   
 
  303     if(count<=mincount)         mincount=count;
 
  305     (*ibFaceParticles).addCount(p, count);      
 
  309   cout<<
"max count of particles in IB Cells is "<<maxcount<<endl;
 
  310   cout<<
"min count of particles in IB Cells is "<<mincount<<endl;
 
  313   (*ibFaceParticles).finishCount();
 
  316   for(
int p=0; p<rowSize; p++){
 
  317     const int faceIndex = ibFaceList [p];
 
  318     int C0 = faceCells(faceIndex, 0);
 
  319     int C1 = faceCells(faceIndex, 1);
 
  325     int nP = cellParticles.
getCount(C0);
 
  326     for(
int n=0; n<nP; n++){
 
  327       int pID=cellParticles(C0,n);
 
  328       if(particleType[pID] == 1){
 
  330         (*ibFaceParticles).add(p, pID);
 
  335       const int nbSize = cellCells.
getCount(C0);
 
  336       for(
int c=0; c < nbSize; c++){
 
  337         int cnb = cellCells(C0, c);
 
  339         for (
int n=0; n<nP; n++){
 
  340           int pID = cellParticles(cnb, n);
 
  341           if(particleType[pID] == 1){
 
  342             (*ibFaceParticles).add(p, pID);
 
  351   (*ibFaceParticles).finishAdd();
 
  353   return(ibFaceParticles);
 
  366   shared_ptr<CRConnectivity> ibFaceCells (
new CRConnectivity (ibFaces, cells));
 
  369   (*ibFaceCells).initCount();
 
  371   const int rowSize = ibFaces.
getCount();
 
  376   const int searchLevel = 2 ;
 
  381   for(
int p=0; p<rowSize; p++){
 
  382     const int IBfaceIndex = ibFaceList [p];
 
  386     int C0 = faceCells(IBfaceIndex, 0);      
 
  387     const int cellType = mesh.getIBTypeForCell(C0);
 
  389       C0 = faceCells(IBfaceIndex,1);
 
  392     if(searchLevel == 2){   
 
  394       const int nf = cellFaces.
getCount(C0);
 
  395       for(
int f=0; f<nf; f++){
 
  396         const int faceID = cellFaces(C0, f);
 
  397         if (faceID != IBfaceIndex){
 
  398           const int CC0 = faceCells(faceID,0);
 
  399           const int CC1 = faceCells(faceID,1);
 
  410     (*ibFaceCells).addCount(p, count);   
 
  415   cout<<
"max Cell neibhbors  "<<maxcount<<endl;
 
  419   (*ibFaceCells).finishCount();
 
  422   for(
int p=0; p<rowSize; p++){
 
  423     const int IBfaceIndex = ibFaceList [p];
 
  424     vector<int> cellIndexList;
 
  425     int C0 = faceCells(IBfaceIndex, 0);      
 
  426     const int cellType = mesh.getIBTypeForCell(C0);
 
  428       C0 = faceCells(IBfaceIndex,1);
 
  430     (*ibFaceCells).add(p, C0);
 
  432     if(searchLevel == 2){   
 
  433       const int nf = cellFaces.
getCount(C0);
 
  434       for(
int f=0; f<nf; f++){
 
  435         const int faceID = cellFaces(C0, f);
 
  436         if (faceID != IBfaceIndex){
 
  437           const int CC0 = faceCells(faceID,0);
 
  438           const int CC1 = faceCells(faceID,1);
 
  440             (*ibFaceCells).add(p, CC0);
 
  443             (*ibFaceCells).add(p, CC1);;
 
  449   (*ibFaceCells).finishAdd();
 
  451   return (ibFaceCells);
 
  460   const int rowSize = rowSite.
getCount();
 
  463   shared_ptr<CRConnectivity> rowCol (
new CRConnectivity (rowSite, colSite));
 
  466   (*rowCol).initCount();
 
  471   for(
int p=0; p<rowSize; p++){
 
  472     int value = connectivity[p];
 
  474       (*rowCol).addCount(p, 1);
 
  479   (*rowCol).finishCount();
 
  482   for(
int p=0; p<rowSize; p++){
 
  483     int value = connectivity[p];
 
  485       (*rowCol).add(p, value);
 
  488   (*rowCol).finishAdd();
 
void checkIBFaces(const Array< int > &ibFaceList, const VectorT3Array &faceArea, const CRConnectivity &faceCells, const Mesh &mesh)
int getCount(const int i) const 
const StorageSite & getIBFaces() const 
Vector< double, 3 > VectorT3
const shared_ptr< CRConnectivity > setParticleCells(const StorageSite &rowSite, const StorageSite &colSite, const Array< int > &connectivity)
void setCount(const int selfCount, const int nGhost=0)
void markCell(Mesh &mesh, const int nCells, const int nSelfCells, const CRConnectivity &cellParticles, const CRConnectivity &cellCells)
void markIBFaces(Mesh &mesh, const int nFaces, const CRConnectivity &faceCells)
Array< Vector< double, 3 > > VectorT3Array
int inCell(const int cellIndex, const VectorT3 &point, const CRConnectivity &faceCells, const CRConnectivity &cellFaces, const VectorT3Array &faceArea, const VectorT3Array &faceCentroid)
void reportCellMark(const Mesh &mesh, const int nCells, const VectorT3Array &cellCentroid, const string fileBase)
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
const shared_ptr< CRConnectivity > setibFaceCells(const Mesh &mesh, const Array< int > &ibFaceList, const StorageSite &ibFaces, const StorageSite &cells, const CRConnectivity &faceCells, const CRConnectivity &cellFaces, const VecD3Array &faceCentroid)
const shared_ptr< CRConnectivity > setibFaceParticles(const Mesh &mesh, const StorageSite &ibFaces, const Array< int > &ibFaceList, const StorageSite &particles, const CRConnectivity &faceCells, const CRConnectivity &cellParticles, const CRConnectivity &cellCells, const Array< int > &particleType)