|
|
@@ -1303,7 +1303,7 @@ namespace OTSModelSharp
|
|
|
areaPercentage = p;
|
|
|
eleData = e;
|
|
|
}
|
|
|
- double areaPercentage;
|
|
|
+ public double areaPercentage;
|
|
|
CElementChemistry eleData;
|
|
|
};
|
|
|
public bool MergeBigBoundaryParticles(List<COTSParticle> mergedParts)
|
|
|
@@ -1315,7 +1315,7 @@ namespace OTSModelSharp
|
|
|
var FldMgr = new CFieldMgr();
|
|
|
FldMgr.SetSEMDataMsr(this.GetSample().GetSEMDataMsr());
|
|
|
|
|
|
- Dictionary<List<COTSParticle>, List<COTSParticle>> mapMergeParticles = new Dictionary<List<COTSParticle>, List<COTSParticle>>();//hold up all the boundary connected particles. the pair's first is also the member of these particles.
|
|
|
+ Dictionary<COTSParticle, List<COTSParticle>> mapMergeParticles = new Dictionary<COTSParticle, List<COTSParticle>>();//hold up all the boundary connected particles. the pair's first is also the member of these particles.
|
|
|
Dictionary<COTSParticle, List<COTSSegment>> mapMergedSegments;//hold up all the segment's corresponding clone in the connected particles.
|
|
|
|
|
|
foreach (var centerfld in allFields)
|
|
|
@@ -1347,7 +1347,7 @@ namespace OTSModelSharp
|
|
|
{
|
|
|
leftp.headerParticle = rightp;
|
|
|
|
|
|
- mapMergeParticles[rightp].push_back(leftp);
|
|
|
+ mapMergeParticles[rightp].Add(leftp);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1379,18 +1379,18 @@ namespace OTSModelSharp
|
|
|
|
|
|
if (upprt.headerParticle != null)
|
|
|
{
|
|
|
- if (downprt[0].headerParticle == null)
|
|
|
+ if (downprt.headerParticle == null)
|
|
|
{
|
|
|
- downprt[0].headerParticle = upprt.headerParticle;
|
|
|
- mapMergeParticles[upprt.headerParticle].Add(downprt[0]);
|
|
|
+ downprt.headerParticle = upprt.headerParticle;
|
|
|
+ mapMergeParticles[upprt.headerParticle].Add(downprt);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (downprt[0].headerParticle != null)
|
|
|
+ if (downprt.headerParticle != null)
|
|
|
{
|
|
|
- upprt.headerParticle = downprt[0].headerParticle;
|
|
|
+ upprt.headerParticle = downprt.headerParticle;
|
|
|
mapMergeParticles[downprt].Add(upprt);
|
|
|
}
|
|
|
else
|
|
|
@@ -1441,7 +1441,7 @@ namespace OTSModelSharp
|
|
|
{
|
|
|
downprt.headerParticle = downprt;
|
|
|
upprt.headerParticle = downprt;
|
|
|
- mapMergeParticles[downprt].push_back(upprt);
|
|
|
+ mapMergeParticles[downprt].Add(upprt);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1479,7 +1479,7 @@ namespace OTSModelSharp
|
|
|
if (leftprt.headerParticle != null)
|
|
|
{
|
|
|
rightprt.headerParticle = leftprt.headerParticle;
|
|
|
- mapMergeParticles[leftprt.headerParticle].Add(rightprt[0]);
|
|
|
+ mapMergeParticles[leftprt.headerParticle].Add(rightprt);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1503,25 +1503,28 @@ namespace OTSModelSharp
|
|
|
|
|
|
var newPart = new COTSParticle();
|
|
|
List<COTSSegment> newSegs = new List<COTSSegment>();
|
|
|
- var p = pair.First();
|
|
|
+ int[] aa = { 100, 229, 44, 3, 2, 1 };
|
|
|
+ aa.First();
|
|
|
+
|
|
|
+ var p = pair.Key;
|
|
|
|
|
|
//firstly,we sum up all the merged particles's area and get the represent string.
|
|
|
- List<string> partsStr = p.GetFieldId() + ":" + p->GetAnalysisId();
|
|
|
+ string partsStr = p.GetFieldId() + ":" + p.GetAnalysisId();
|
|
|
double allPartArea = p.GetArea();//Get the first particle's area.
|
|
|
|
|
|
|
|
|
- foreach (var other in pair.second)// Get the total area of all these particles for the use of ele calcu.
|
|
|
+ foreach (var other in pair.Value)// Get the total area of all these particles for the use of ele calcu.
|
|
|
{
|
|
|
- partsStr += "," + other->GetFieldId() + ":" + other->GetAnalysisId();//Get the subparticles string such as "1:1,2:1" etc.
|
|
|
- allPartArea += other->GetArea();//Get other particle's area
|
|
|
+ partsStr += "," + other.GetFieldId() + ":" + other.GetAnalysisId();//Get the subparticles string such as "1:1,2:1" etc.
|
|
|
+ allPartArea += other.GetArea();//Get other particle's area
|
|
|
|
|
|
}
|
|
|
// calculate all the new segment's position.
|
|
|
List<COTSParticle> allSubParts = new List<COTSParticle>();
|
|
|
allSubParts.Add(p);
|
|
|
- foreach (var other in pair.second)// Get the total area of all these particles for the use of ele calcu.
|
|
|
+ foreach (var other in pair.Value)// Get the total area of all these particles for the use of ele calcu.
|
|
|
{
|
|
|
- allSubParts.Add(other.get());
|
|
|
+ allSubParts.Add(other);
|
|
|
}
|
|
|
foreach (var subp in allSubParts)
|
|
|
{
|
|
|
@@ -1562,16 +1565,15 @@ namespace OTSModelSharp
|
|
|
CPosXray pXray1 = p.GetXrayInfo();
|
|
|
foreach (var ele in pXray1.GetElementQuantifyData())
|
|
|
{
|
|
|
- mapEleData[ele.GetName()].Add(EleAreaPercentage(p.GetArea() / allPartArea, ele));
|
|
|
+ mapEleData[ele.GetName()].Add(EleAreaPercentage(p.GetArea() / allPartArea, ele));
|
|
|
}
|
|
|
|
|
|
- foreach (var other in pair.second)
|
|
|
+ foreach (var other in pair.Value)
|
|
|
{
|
|
|
var otherXray = other.GetXrayInfo();
|
|
|
- foreach (var eledata in otherXray->GetElementQuantifyData())
|
|
|
+ foreach (var eledata in otherXray.GetElementQuantifyData())
|
|
|
{
|
|
|
- mapEleData[eledata.GetName().GetBuffer()].Add(EleAreaPercentage(other.GetArea() / allPartArea, eledata));
|
|
|
-
|
|
|
+ mapEleData[eledata.GetName()].Add(EleAreaPercentage(other.GetArea() / allPartArea, eledata));
|
|
|
}
|
|
|
}
|
|
|
// third,we calculate all the element's new percentage data and get a new element chemistry list.
|
|
|
@@ -1580,9 +1582,9 @@ namespace OTSModelSharp
|
|
|
foreach (var eledata in mapEleData)
|
|
|
{
|
|
|
CElementChemistry newEleche = new CElementChemistry();
|
|
|
- newEleche.SetName(eledata.first);
|
|
|
+ newEleche.SetName(eledata.Key);
|
|
|
double newPercentage = 0;
|
|
|
- foreach (var d in eledata.second)
|
|
|
+ foreach (var d in eledata.Value)
|
|
|
{
|
|
|
newPercentage += d.areaPercentage;
|
|
|
}
|
|
|
@@ -1593,12 +1595,12 @@ namespace OTSModelSharp
|
|
|
CPosXray xray = new CPosXray();
|
|
|
xray.SetElementQuantifyData(newCheList);
|
|
|
newPart.SetXrayInfo(xray);
|
|
|
- newPart.SetSubParticles(partsStr[0]);
|
|
|
+ newPart.SetSubParticles(partsStr);
|
|
|
newPart.SetArea(allPartArea);
|
|
|
newPart.SetTagId(mergedParts.Count);
|
|
|
newPart.SetAnalysisId(mergedParts.Count);
|
|
|
- List<string> name = p.TypeName();
|
|
|
- newPart.TypeName(name[0]);
|
|
|
+ string name = p.TypeName();
|
|
|
+ newPart.TypeName(name);
|
|
|
newPart.TypeColor(p.TypeColor());
|
|
|
mergedParts.Add(newPart);
|
|
|
}
|