public bool IsBestHeight(NodePointLayer inPnt)
 {
     if (isTraceH && (inPnt.name == currentConflict.name) && inPnt.numberNode == currentConflict.number1)
     {
         if (inPnt.layer == Layers.metal1Trace)// &&  currentConflict.border1Met )
         {
             if (currentConflict.compare1Met && (inPnt.number > currentConflict.border1Met))
             {
                 return(true);
             }
             if (!currentConflict.compare1Met && (inPnt.number < currentConflict.border1Met))
             {
                 return(true);
             }
         }
         if (inPnt.layer == Layers.siliconTrace)
         {
             if (currentConflict.compare1Sil && (inPnt.number > currentConflict.border1Sil))
             {
                 return(true);
             }
             if (!currentConflict.compare1Sil && (inPnt.number < currentConflict.border1Sil))
             {
                 return(true);
             }
         }
         //(inPnt.number > numberH))
     }
     if (isTraceH && (inPnt.name == currentConflict.name) && inPnt.numberNode == currentConflict.number2)//Params.maxPriority
     {
         if (inPnt.layer == Layers.metal1Trace)
         {
             if (currentConflict.compare2Met && (inPnt.number > currentConflict.border2Met))
             {
                 return(true);
             }
             if (!currentConflict.compare2Met && (inPnt.number < currentConflict.border2Met))
             {
                 return(true);
             }
         }
         if (inPnt.layer == Layers.siliconTrace)
         {
             if (currentConflict.compare2Sil && (inPnt.number > currentConflict.border2Sil))
             {
                 return(true);
             }
             if (!currentConflict.compare2Sil && (inPnt.number < currentConflict.border2Sil))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public NodePointLayer GetBest(List <NodePointLayer> inPoints)
        {
            NodePointLayer bestPnt  = GetAnyNotDiffusion(inPoints);
            bool           isExcept = false;

            foreach (NodePointLayer pnt in inPoints)
            {
                if (bestPnt.priority < pnt.priority)
                {
                    bestPnt = pnt;
                }
                isExcept = IsBestExecept(pnt);
            }
            if (isTraceH && (bestPnt.name == currentConflict.name) && (!IsBestHeight(bestPnt)))//!!!!
            {
                foreach (NodePointLayer pnt in inPoints)
                {
                    bestPnt = ChooseBestWithHigh(pnt, bestPnt);
                }
            }
            return(bestPnt);
        }
        public NodePointLayer ChooseBestWithHigh(NodePointLayer inPnt1, NodePointLayer inPnt2)
        {
            bool fstExcept = IsBestExecept(inPnt1);
            bool scdExcept = IsBestExecept(inPnt2);

            //bool fstBestHeight = IsBestHeight(inPnt1);
            //bool scdBestHeight = IsBestHeight(inPnt2);

            if (fstExcept && scdExcept)
            {
                if (inPnt1.priority < inPnt2.priority)
                {
                    return(inPnt2);
                }
                return(inPnt1);
            }

            if (fstExcept)
            {
                return(inPnt1);
            }
            return(inPnt2);
        }
 public BestPointSet(BestPointSet inBest)
 {
     point      = new NodePointLayer(inBest.point, inBest.point.layer);
     layer      = inBest.layer;
     isOneLayer = inBest.isOneLayer;
 }
 public BestPointSet(NodePointLayer inPoint, int inLayer, bool inOneLayer)
 {
     point      = inPoint;
     layer      = inLayer;
     isOneLayer = inOneLayer;
 }
 public BestPointSet(BestPointSet inBest)
 {
     point = new NodePointLayer(inBest.point, inBest.point.layer);
     layer = inBest.layer;
     isOneLayer = inBest.isOneLayer;
 }
 public BestPointSet(NodePointLayer inPoint, int inLayer, bool inOneLayer)
 {
     point = inPoint;
     layer = inLayer;
     isOneLayer = inOneLayer;
 }
Exemple #8
0
        /*private bool SetOneOfBest_old(PairInt inCnt, int inLayer, NodePoint inSample)
        {
            bool noLayer = false;
            int sourceBest = 0;

            ContactSimple simple = new ContactSimple(inCnt, inLayer);
            List<ContactSimple> arround = simple.GetArroundPoints(wide);

            foreach (ContactSimple cntArround in arround)
            {
                NodePoint pn = GetPoint(cntArround);
                if ((GetPoint(cntArround).name != inSample.name) &&
                    (!GetPoint(cntArround).isReplace) &&
                    (GetPoint(cntArround).name != Material.diffusionName))
                    noLayer = true;
                if (!noLayer && GetPoint(cntArround).isSource &&
                   (GetPoint(cntArround).name != inSample.name))
                    sourceBest++;
            }
            int sourseCount = 0;
            if ((sourceBest > 1) && (diffusionExeption.FindIndex(el => el == inSample.name) >= 0))
            {
                foreach (ContactSimple cnt in GetSourceContacts(new ContactSimple(inCnt, inLayer), inSample.name))
                {
                    if (GetPoint(cnt).name == inSample.name)
                        sourseCount++;
                }
                if (sourseCount > sourceBest)
                    sourceBest = 1;
            }

            if (!noLayer && (sourceBest < 2) && (GetPoint(inCnt, inLayer).isReplace))
            {
                SetNextCont(inCnt, inLayer, inSample);//error gap in line
                return true;
            }
            return false;
        }*/
        private bool SetOneOfBest(PairInt inCnt, int inLayer, NodePointLayer inSample)
        {
            NodePoint crPnt = GetPoint(inCnt, inLayer);
            if (!crPnt.isReplace || inSample.name == Material.blankName || crPnt.name == inSample.name)
                return false;

            ContactSimple curCentr = new ContactSimple(inCnt, inLayer);
            SetContact(curCentr, Material.blankName, 0, 0, -1);
            /*layoutMap[inChanged.x][inChanged.y][layerChanged].isReplace = false;
            layoutMap[inChanged.x][inChanged.y][layerChanged].name = inSample.name;
            layoutMap[inChanged.x][inChanged.y][layerChanged].numberNode = inSample.numberNode;
            layoutMap[inChanged.x][inChanged.y][layerChanged].priority = inSample.priority;
            layoutMap[inChanged.x][inChanged.y][layerChanged].number = inSample.number;
            */
            string curName = inSample.name;

            //ContactSimple curPoint = new ContactSimple(inChanged, layerChanged);
            List<ContactSimple> cntArround = curCentr.GetArroundPoints(wide);

            //List<PairInt> cntCheckRepl = inCnt.GetBigArround(wide);
            //cntCheckRepl.Add(inCnt);

            bool contSetting = true;
            bool retValue = true;
            //foreach (ContactSimple cntUnit in cntArround)
            while (contSetting)
            {
                contSetting = false;
                retValue = true;
                List<string> namesChanged = new List<string>();
                foreach (ContactSimple cntUnit in cntArround)
                {
                    NodePoint unitPnt = GetPoint(cntUnit);
                    string unitName = unitPnt.name;
                    if (unitName != curName && unitPnt.isReplace &&
                        unitName!= Material.blankName && unitName != Material.diffusionName)
                    {
                        contSetting = true;
                        if (cntUnit.x == 29 && (cntUnit.y == 38) &&
                        cntUnit.layer == Layers.siliconTrace && unitName == "INC")//4 point !!!!! != 737
                        {
                            List<NodePoint> ps = new List<NodePoint>();
                            foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide))
                                ps.Add(GetPoint(cnt));
                            contSetting = true;
                        }

                        namesChanged.Add(unitName);
                        SetContact(cntUnit, Material.blankName, 0, 0, -1);
                        //cntAdded.Add(cntUnit);
                        if (GetPoint(cntUnit).isSource)
                        {
                            foreach (ContactSimple smp in GetSourceContacts(cntUnit, curName))
                                if (smp != cntUnit)
                                    layoutMap[smp.x][smp.y][smp.layer].isReplace =	CheckNebors(new ContactSimple(smp, smp.layer));
                                    //cntCheckRepl.Add(smp);
                        }

                        foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide))
                        {
                            /*string bn = GetPoint(cnt).name;
                            if (cnt.x == 38 && cnt.y == 14 && cnt.layer == 1 && bn != Material.blankName)
                                b = false;*/
                            foreach (int lay in Params.LayersRange[inLayer])
                            {
                                //if (GetPoint(cnt, lay).name == unitName)//curName) && (cntCheckRepl.FindIndex(el => el == cnt) < 0))
                                    layoutMap[cnt.x][cnt.y][lay].isReplace =
                                    CheckNebors(new ContactSimple(cnt, lay));
                                    //cntCheckRepl.Add(cnt);
                            }
                        }
                    }
                    else if (unitName != curName &&
                            unitName!= Material.blankName && unitName != Material.diffusionName)
                    {
                        retValue = false;
                        if (namesChanged.FindIndex(el => el == unitPnt.name) >= 0)//--------delete
                            layoutMap[cntUnit.x][cntUnit.y][cntUnit.layer].isReplace =
                                CheckNebors(new ContactSimple(cntUnit, cntUnit.layer));
                    }
                }
            }

            if (retValue)
            {
                layoutMap[inCnt.x][inCnt.y][inLayer].isReplace = false;
                layoutMap[inCnt.x][inCnt.y][inLayer].name = inSample.name;
                layoutMap[inCnt.x][inCnt.y][inLayer].numberNode = inSample.numberNode;
                layoutMap[inCnt.x][inCnt.y][inLayer].priority = inSample.priority;
                layoutMap[inCnt.x][inCnt.y][inLayer].number = inSample.number;
            }

            List<PairInt> checkRepl = inCnt.GetBigArround(wide);
            checkRepl.Add(inCnt);
            foreach (PairInt cntUnit in checkRepl)
            {
                foreach (int lay in Params.LayersRange[inLayer])
                {
                    //if (GetPoint(cntUnit, lay).name == curName)
                        layoutMap[cntUnit.x][cntUnit.y][lay].isReplace =
                            CheckNebors(new ContactSimple(cntUnit, lay));
                }
            }

            return retValue;
            //--------------------------
            /*bool noLayer = false;
            int sourceBest = 0;

            ContactSimple simple = new ContactSimple(inCnt, inLayer);
            List<ContactSimple> arround = simple.GetArroundPoints(wide);

            foreach (ContactSimple cntArround in arround)
            {
                NodePoint pn = GetPoint(cntArround);
                if ((GetPoint(cntArround).name != inSample.name) &&
                    (!GetPoint(cntArround).isReplace) &&
                    (GetPoint(cntArround).name != Material.diffusionName))
                    noLayer = true;
                if (!noLayer && GetPoint(cntArround).isSource &&
                   (GetPoint(cntArround).name != inSample.name))
                    sourceBest++;
            }
            int sourseCount = 0;
            if ((sourceBest > 1) && (diffusionException.FindIndex(el => el == inSample.name) >= 0))
            {
                foreach (ContactSimple cnt in GetSourceContacts(new ContactSimple(inCnt, inLayer), inSample.name))
                {
                    if (GetPoint(cnt).name == inSample.name)
                        sourseCount++;
                }
                if (sourseCount > sourceBest)
                    sourceBest = 1;
            }

            if (!noLayer && (sourceBest < 2) && (GetPoint(inCnt, inLayer).isReplace))
            {
                if (!SetNextCont(inCnt, inLayer, inSample))
                    return false;
                return true;
            }*/
            //return false;
        }
 public bool IsBestHeight(NodePointLayer inPnt)
 {
     if (isTraceH && (inPnt.name == currentConflict.name) && inPnt.numberNode == currentConflict.number1)
     {
         if (inPnt.layer == Layers.metal1Trace)// &&  currentConflict.border1Met )
         {
             if ( currentConflict.compare1Met && (inPnt.number > currentConflict.border1Met))
                 return true;
             if (!currentConflict.compare1Met && (inPnt.number < currentConflict.border1Met))
                 return true;
         }
         if (inPnt.layer == Layers.siliconTrace)
         {
             if (currentConflict.compare1Sil && (inPnt.number > currentConflict.border1Sil))
                 return true;
             if (!currentConflict.compare1Sil && (inPnt.number < currentConflict.border1Sil))
                 return true;
         }
             //(inPnt.number > numberH))
     }
     if (isTraceH && (inPnt.name == currentConflict.name) && inPnt.numberNode == currentConflict.number2)//Params.maxPriority
     {
         if (inPnt.layer == Layers.metal1Trace)
         {
             if (currentConflict.compare2Met && (inPnt.number > currentConflict.border2Met))
                 return true;
             if (!currentConflict.compare2Met && (inPnt.number < currentConflict.border2Met))
                 return true;
         }
         if (inPnt.layer == Layers.siliconTrace)
         {
             if (currentConflict.compare2Sil && (inPnt.number > currentConflict.border2Sil))
                 return true;
             if (!currentConflict.compare2Sil && (inPnt.number < currentConflict.border2Sil))
                 return true;
         }
     }
     return false;
 }
        public NodePointLayer ChooseBestWithHigh(NodePointLayer inPnt1, NodePointLayer inPnt2)
        {
            bool fstExcept = IsBestExecept(inPnt1);
            bool scdExcept = IsBestExecept(inPnt2);
            //bool fstBestHeight = IsBestHeight(inPnt1);
            //bool scdBestHeight = IsBestHeight(inPnt2);

            if (fstExcept && scdExcept)
            {
                if (inPnt1.priority < inPnt2.priority)
                    return inPnt2;
                return inPnt1;
            }

            if (fstExcept)
                return inPnt1;
            return inPnt2;
        }