private void SetNextCont_old(PairInt inChanged, int layerChanged, NodePoint inSample) { bool b = false; if (inChanged.x == 33 && (inChanged.y == 16 || inChanged.y == 18) && layerChanged == Layers.metal1Trace && inSample.name != "N6859613") b = false; if (inSample.name == Material.blankName) return; 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 = curPoint.GetArroundPoints(wide); List<PairInt> cntArea = inChanged.GetBigArround(wide); cntArea.Add(inChanged); foreach (ContactSimple cntUnit in cntArround) { string unitName = GetPoint(cntUnit).name; if (unitName != curName && unitName!= Material.blankName && unitName != Material.diffusionName) { if (cntUnit.x == 33 && (cntUnit.y == 16 || cntUnit.y == 18) && cntUnit.layer == Layers.metal1Trace) b = false; SetContact(cntUnit, Material.blankName, 0, 0, -1); //cntAdded.Add(cntUnit); if (GetPoint(cntUnit).isSource) { foreach (ContactSimple smp in GetSourceContacts(cntUnit, curName)) if (smp != cntUnit) cntArea.Add(smp); //cntArea.Add(GetSourceContacts //GetNearSource(cntUnit)); } 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; if ((GetPoint(cnt).name != curName) && (cntArea.FindIndex(el => el == cnt) < 0)) cntArea.Add(cnt); } } } foreach (PairInt cntUnit in cntArea) { foreach (int lay in Params.LayersRange[layerChanged]) { layoutMap[cntUnit.x][cntUnit.y][lay].isReplace = CheckNebors(new ContactSimple(cntUnit, lay)); } } }
/*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; }
private bool SetNextCont(PairInt inChanged, int layerChanged, NodePoint inSample) { /*bool b = false; if (inChanged.x == 33 && (inChanged.y == 16 || inChanged.y == 18) && layerChanged == Layers.metal1Trace && inSample.name != "N6859613") b = false;*/ if (inSample.name == Material.blankName) return true; string curName = inSample.name; List<string> deletedNames = new List<string>(); ContactSimple curPoint = new ContactSimple(inChanged, layerChanged); List<ContactSimple> cntArround = curPoint.GetArroundPoints(wide); List<PairInt> cntArea = inChanged.GetBigArround(wide); cntArea.Add(inChanged); foreach (ContactSimple cntUnit in cntArround) { string unitName = GetPoint(cntUnit).name; if (unitName != curName && unitName!= Material.blankName && unitName != Material.diffusionName) { /*if (cntUnit.x == 33 && (cntUnit.y == 16 || cntUnit.y == 18) && cntUnit.layer == Layers.metal1Trace) b = false;*/ if (deletedNames.FindIndex(el => el == unitName) >= 0) { bool rem = CheckNebors(new ContactSimple(cntUnit, cntUnit.layer)); if (!rem) { layoutMap[cntUnit.x][cntUnit.y][cntUnit.layer].isReplace = rem; return false; } } deletedNames.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) cntArea.Add(smp); //cntArea.Add(GetSourceContacts //GetNearSource(cntUnit)); } //List<PairInt> cntForCheck = new List<PairInt>(); 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;*/ if ((GetPoint(cnt).name != curName) && (cntArea.FindIndex(el => el == cnt) < 0)) { cntArea.Add(cnt); //cntForCheck.Add(cnt); } } } } 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; foreach (PairInt cntUnit in cntArea) { foreach (int lay in Params.LayersRange[layerChanged]) { layoutMap[cntUnit.x][cntUnit.y][lay].isReplace = CheckNebors(new ContactSimple(cntUnit, lay)); } /*bool b; if (cntUnit.x == 20 && cntUnit.y == 16) b = true; layoutMap[cntUnit.x][cntUnit.y][Layers.metal1Trace].isReplace = CheckNebors(new ContactSimple(cntUnit, Layers.metal1Trace)); layoutMap[cntUnit.x][cntUnit.y][Layers.siliconTrace].isReplace = CheckNebors(new ContactSimple(cntUnit, Layers.siliconTrace));*/ } return true; }