рефакторинг. подготовка к переводу регионов на json
This commit is contained in:
12
.idea/workspace.xml
generated
12
.idea/workspace.xml
generated
@@ -7,17 +7,17 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/FileRegionLinesJson.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/AlignRuleWidthJson.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/RegionLinesJson.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/RegionsJson.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ModifyArrayDistribution.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ModifyArrayDistribution.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ModifyArrayDistribution.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ModifyArrayDistribution.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/AlignRule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/AlignRule.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/AlignRule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/AlignRule.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/DataDirective.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/DataDirective.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/DataDirective.java" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/Dimension.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Dimension.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/Distribution/Directive.java" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/ParallelRegion.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/ParallelRegion.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/ParallelRegion.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/ParallelRegion.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Regions/RegionLinesJson.java" beforeDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
|
|||||||
import _VisualDVM.Global;
|
import _VisualDVM.Global;
|
||||||
import _VisualDVM.Passes.PassCode;
|
import _VisualDVM.Passes.PassCode;
|
||||||
import _VisualDVM.Passes.Sapfor.SapforModification;
|
import _VisualDVM.Passes.Sapfor.SapforModification;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.Dimension;
|
import _VisualDVM.ProjectData.SapforData.Arrays.Dimension;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
||||||
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
||||||
import _VisualDVM.ProjectData.SapforData.Regions.UI.ArrayAlignmentBar;
|
import _VisualDVM.ProjectData.SapforData.Regions.UI.ArrayAlignmentBar;
|
||||||
|
|||||||
@@ -505,8 +505,8 @@ public class db_project_info extends DBObject {
|
|||||||
if (templates.size() > 0) {
|
if (templates.size() > 0) {
|
||||||
for (ParallelRegion p : parallelRegions.Data.values()) {
|
for (ParallelRegion p : parallelRegions.Data.values()) {
|
||||||
DefaultMutableTreeNode pn = new DefaultMutableTreeNode(p);
|
DefaultMutableTreeNode pn = new DefaultMutableTreeNode(p);
|
||||||
p.dataDirectives.genRules(p.arraysMap);
|
p.genRules(p.arraysMap);
|
||||||
for (String r : p.dataDirectives.rules)
|
for (String r : p.rules)
|
||||||
pn.add(new DefaultMutableTreeNode(r));
|
pn.add(new DefaultMutableTreeNode(r));
|
||||||
maxdim = Math.max(maxdim, p.maxdim);
|
maxdim = Math.max(maxdim, p.maxdim);
|
||||||
align_rules_root.add(pn);
|
align_rules_root.add(pn);
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
package _VisualDVM.ProjectData.SapforData.Arrays.Distribution;
|
package _VisualDVM.ProjectData.SapforData.Arrays;
|
||||||
import Common.Utils.Index;
|
import Common.Utils.Index;
|
||||||
|
import Common.Utils.IntegerPairJson;
|
||||||
import Common.Utils.Pair;
|
import Common.Utils.Pair;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
|
||||||
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class AlignRule {
|
public class AlignRule {
|
||||||
|
@Expose
|
||||||
|
public String packed_alignArray_address;
|
||||||
|
@Expose
|
||||||
|
public String packed_alignWith_address;
|
||||||
|
@Expose
|
||||||
|
public Vector<IntegerPairJson> alignRule;
|
||||||
|
@Expose
|
||||||
|
public Vector<AlignRuleWidthJson> alignRuleWith = new Vector<>();
|
||||||
|
//----
|
||||||
public BigInteger alignArray_address;
|
public BigInteger alignArray_address;
|
||||||
public BigInteger alignWith_address;
|
public BigInteger alignWith_address;
|
||||||
public ParallelRegion parent_region = null;
|
public ParallelRegion parent_region = null;
|
||||||
public Vector<Pair<Integer, Integer>> alignRule;
|
|
||||||
public Vector<Pair<Integer, Pair<Integer, Integer>>> alignRuleWith = new Vector<>();
|
|
||||||
public AlignRule(String[] splited, Index idx) {
|
public AlignRule(String[] splited, Index idx) {
|
||||||
alignArray_address = new BigInteger((splited[idx.Inc()]));
|
alignArray_address = new BigInteger((splited[idx.Inc()]));
|
||||||
alignWith_address = new BigInteger(splited[idx.Inc()]);
|
alignWith_address = new BigInteger(splited[idx.Inc()]);
|
||||||
@@ -20,17 +28,27 @@ public class AlignRule {
|
|||||||
for (int i = 0; i < alignRule_size; ++i) {
|
for (int i = 0; i < alignRule_size; ++i) {
|
||||||
int first = Integer.parseInt(splited[idx.Inc()]);
|
int first = Integer.parseInt(splited[idx.Inc()]);
|
||||||
int second = Integer.parseInt(splited[idx.Inc()]);
|
int second = Integer.parseInt(splited[idx.Inc()]);
|
||||||
alignRule.add(new Pair<>(first, second));
|
alignRule.add(new IntegerPairJson(first, second));
|
||||||
}
|
}
|
||||||
int alignRuleWith_size = Integer.parseInt(splited[idx.Inc()]);
|
int alignRuleWith_size = Integer.parseInt(splited[idx.Inc()]);
|
||||||
alignRuleWith = new Vector<>(alignRuleWith_size);
|
alignRuleWith = new Vector<>(alignRuleWith_size);
|
||||||
for (int i = 0; i < alignRuleWith_size; ++i) {
|
for (int k = 0; k < alignRuleWith_size; ++k) {
|
||||||
int first = Integer.parseInt(splited[idx.Inc()]);
|
int dimNum = Integer.parseInt(splited[idx.Inc()]);
|
||||||
int first_ = Integer.parseInt(splited[idx.Inc()]);
|
int a = Integer.parseInt(splited[idx.Inc()]);
|
||||||
int second_ = Integer.parseInt(splited[idx.Inc()]);
|
int b = Integer.parseInt(splited[idx.Inc()]);
|
||||||
alignRuleWith.add(new Pair<>(first, new Pair<>(first_, second_)));
|
alignRuleWith.add(new AlignRuleWidthJson(dimNum, a, b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void Init(){
|
||||||
|
//--
|
||||||
|
if (packed_alignArray_address!=null)
|
||||||
|
alignArray_address = new BigInteger(packed_alignArray_address);
|
||||||
|
if (packed_alignWith_address!=null)
|
||||||
|
alignWith_address = new BigInteger(packed_alignWith_address);
|
||||||
|
//--
|
||||||
|
packed_alignArray_address = null;
|
||||||
|
packed_alignWith_address = null;
|
||||||
|
}
|
||||||
private static Pair<String, String> convertDigitToPositive(int digit) {
|
private static Pair<String, String> convertDigitToPositive(int digit) {
|
||||||
String buf = "";
|
String buf = "";
|
||||||
String sign = " + ";
|
String sign = " + ";
|
||||||
@@ -48,25 +66,25 @@ public class AlignRule {
|
|||||||
public ProjectArray getAlignWith() {
|
public ProjectArray getAlignWith() {
|
||||||
return parent_region.arraysMap.get(alignWith_address);
|
return parent_region.arraysMap.get(alignWith_address);
|
||||||
}
|
}
|
||||||
String genStringExpr(String letter, Pair<Integer, Integer> expr) {
|
String genStringExpr(String letter, int a, int b) {
|
||||||
String retVal = "";
|
String retVal = "";
|
||||||
if (expr.getKey() == 0 && expr.getValue() == 0)
|
if (a == 0 && b == 0)
|
||||||
retVal = "*";
|
retVal = "*";
|
||||||
else if (expr.getValue() == 0) {
|
else if (b == 0) {
|
||||||
if (expr.getKey() == 1)
|
if (a == 1)
|
||||||
retVal = letter;
|
retVal = letter;
|
||||||
else {
|
else {
|
||||||
Pair<String, String> digit2 = convertDigitToPositive(expr.getKey());
|
Pair<String, String> digit2 = convertDigitToPositive(a);
|
||||||
if (digit2.getKey() == " - ")
|
if (digit2.getKey() == " - ")
|
||||||
retVal = "(-" + digit2.getValue() + ")" + " * " + letter;
|
retVal = "(-" + digit2.getValue() + ")" + " * " + letter;
|
||||||
else retVal = digit2.getValue() + " * " + letter;
|
else retVal = digit2.getValue() + " * " + letter;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Pair<String, String> digit1 = convertDigitToPositive(expr.getValue());
|
Pair<String, String> digit1 = convertDigitToPositive(b);
|
||||||
if (expr.getKey() == 1)
|
if (a == 1)
|
||||||
retVal = letter + digit1.getKey() + digit1.getValue();
|
retVal = letter + digit1.getKey() + digit1.getValue();
|
||||||
else {
|
else {
|
||||||
Pair<String, String> digit2 = convertDigitToPositive(expr.getKey());
|
Pair<String, String> digit2 = convertDigitToPositive(a);
|
||||||
if (digit2.getKey() == " - ")
|
if (digit2.getKey() == " - ")
|
||||||
retVal = "(-" + digit2.getValue() + ")" + " * " + letter + digit1.getKey() + digit1.getValue();
|
retVal = "(-" + digit2.getValue() + ")" + " * " + letter + digit1.getKey() + digit1.getValue();
|
||||||
else
|
else
|
||||||
@@ -79,7 +97,7 @@ public class AlignRule {
|
|||||||
String val = "";
|
String val = "";
|
||||||
val += getAlignArray().shortName + "(";
|
val += getAlignArray().shortName + "(";
|
||||||
for (int i = 0; i < alignRule.size(); ++i) {
|
for (int i = 0; i < alignRule.size(); ++i) {
|
||||||
val += genStringExpr(ProjectArray.alignNames[i], alignRule.get(i));
|
val += genStringExpr(ProjectArray.alignNames[i], alignRule.get(i).getKey(), alignRule.get(i).getValue());
|
||||||
if (i != alignRule.size() - 1)
|
if (i != alignRule.size() - 1)
|
||||||
val += ",";
|
val += ",";
|
||||||
}
|
}
|
||||||
@@ -99,7 +117,7 @@ public class AlignRule {
|
|||||||
retVal += getAlignArray().TypeString() + " ";
|
retVal += getAlignArray().TypeString() + " ";
|
||||||
arrayString += getAlignArray().shortName + "(";
|
arrayString += getAlignArray().shortName + "(";
|
||||||
for (int i = 0; i < alignRule.size(); ++i) {
|
for (int i = 0; i < alignRule.size(); ++i) {
|
||||||
arrayString += genStringExpr(ProjectArray.alignNames[i], alignRule.get(i));
|
arrayString += genStringExpr(ProjectArray.alignNames[i], alignRule.get(i).getKey(),alignRule.get(i).getValue() );
|
||||||
if (i != alignRule.size() - 1)
|
if (i != alignRule.size() - 1)
|
||||||
arrayString += ",";
|
arrayString += ",";
|
||||||
}
|
}
|
||||||
@@ -124,13 +142,14 @@ public class AlignRule {
|
|||||||
for (int i = 0; i < alignEachDim.capacity(); ++i)
|
for (int i = 0; i < alignEachDim.capacity(); ++i)
|
||||||
alignEachDim.add("*");
|
alignEachDim.add("*");
|
||||||
for (int i = 0; i < alignRuleWith.size(); ++i) {
|
for (int i = 0; i < alignRuleWith.size(); ++i) {
|
||||||
if (alignRuleWith.get(i).getKey() != -1) {
|
if (alignRuleWith.get(i).getDimNum() != -1) {
|
||||||
alignEachDim.set(alignRuleWith.get(i).getKey(), genStringExpr(ProjectArray.alignNames[i], alignRuleWith.get(i).getValue()));
|
alignEachDim.set(alignRuleWith.get(i).getDimNum(),
|
||||||
|
genStringExpr(ProjectArray.alignNames[i], alignRuleWith.get(i).getA(),alignRuleWith.get(i).getB() ));
|
||||||
//коэццициенты находятся здесь!!------------------------------------------------------------------->>
|
//коэццициенты находятся здесь!!------------------------------------------------------------------->>
|
||||||
getAlignArray().ac_current.put(i,
|
getAlignArray().ac_current.put(i,
|
||||||
new Dimension(i,
|
new Dimension(i,
|
||||||
alignRuleWith.get(i).getValue().getKey(),
|
alignRuleWith.get(i).getA(),
|
||||||
alignRuleWith.get(i).getValue().getValue()
|
alignRuleWith.get(i).getB()
|
||||||
));
|
));
|
||||||
} else getAlignArray().ac_current.put(i, new Dimension(i));
|
} else getAlignArray().ac_current.put(i, new Dimension(i));
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package _VisualDVM.ProjectData.SapforData.Arrays;
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
public class AlignRuleWidthJson {
|
||||||
|
@Expose
|
||||||
|
public int dimNum;
|
||||||
|
@Expose
|
||||||
|
public int a;
|
||||||
|
@Expose
|
||||||
|
public int b;
|
||||||
|
//dim -> a * dim_t + b
|
||||||
|
public int getDimNum(){
|
||||||
|
return dimNum;
|
||||||
|
}
|
||||||
|
public int getA(){
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
public int getB(){
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
public AlignRuleWidthJson(){
|
||||||
|
|
||||||
|
}
|
||||||
|
public AlignRuleWidthJson(int i_in, int a_in, int b_in){
|
||||||
|
dimNum = i_in;
|
||||||
|
a = a_in;
|
||||||
|
b = b_in;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package _VisualDVM.ProjectData.SapforData.Arrays.Distribution;
|
package _VisualDVM.ProjectData.SapforData.Arrays;
|
||||||
import Common.Database.Objects.DBObject;
|
import Common.Database.Objects.DBObject;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
|
||||||
public class Dimension extends DBObject {
|
public class Dimension extends DBObject {
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
public int num; //номер измерения.
|
public int num; //номер измерения.
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package _VisualDVM.ProjectData.SapforData.Arrays.Distribution;
|
|
||||||
import Common.Utils.Pair;
|
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ArrayLocation;
|
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Vector;
|
|
||||||
public class DataDirective extends Directive {
|
|
||||||
public Vector<AlignRule> alignRules;
|
|
||||||
public String rules_ = "";
|
|
||||||
public Vector<String> rules = new Vector<>();
|
|
||||||
public void genRules(LinkedHashMap<BigInteger, ProjectArray> Arrays) {
|
|
||||||
rules.clear();
|
|
||||||
int maxLen = 0;
|
|
||||||
for (AlignRule a : alignRules)
|
|
||||||
maxLen = Math.max(maxLen, a.GetLenString());
|
|
||||||
LinkedHashMap<String, Vector<String>> toPrint = new LinkedHashMap<>();
|
|
||||||
for (AlignRule a : alignRules) {
|
|
||||||
if (Arrays.get(a.alignArray_address).getLocation() != ArrayLocation.parameter) {
|
|
||||||
Pair<String, String> result = a.GenRule(maxLen);
|
|
||||||
if (!toPrint.containsKey(result.getKey()))
|
|
||||||
toPrint.put(result.getKey(), new Vector<>());
|
|
||||||
toPrint.get(result.getKey()).add(result.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Vector<String> v : toPrint.values())
|
|
||||||
for (String r : v)
|
|
||||||
rules.add(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package _VisualDVM.ProjectData.SapforData.Arrays.Distribution;
|
|
||||||
import _VisualDVM.ProjectData.LanguageName;
|
|
||||||
public class Directive {
|
|
||||||
public LanguageName langType = LanguageName.fortran;
|
|
||||||
public String file = "";
|
|
||||||
public int line = -1;
|
|
||||||
public int col = -1;
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ import _VisualDVM.Global;
|
|||||||
import _VisualDVM.Passes.PassCode;
|
import _VisualDVM.Passes.PassCode;
|
||||||
import _VisualDVM.ProjectData.DBArray.DBArray;
|
import _VisualDVM.ProjectData.DBArray.DBArray;
|
||||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.Dimension;
|
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimension;
|
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimension;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimensionState;
|
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimensionState;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateLink;
|
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateLink;
|
||||||
@@ -57,57 +56,52 @@ public class ProjectArray extends DBObject {
|
|||||||
//--
|
//--
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
public static final String[] alignNames = {"i", "j", "k", "l", "m", "n", "q", "r", "s", "t", "u", "w", "x", "y", "z"};
|
public static final String[] alignNames = {"i", "j", "k", "l", "m", "n", "q", "r", "s", "t", "u", "w", "x", "y", "z"};
|
||||||
//json-------------------
|
|
||||||
public String UniqKey;
|
public String UniqKey;
|
||||||
public BigInteger address;
|
public BigInteger address;
|
||||||
public void print(){
|
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
|
||||||
|
//<editor-fold desc="Функционал шаблона">
|
||||||
|
public Vector<BigInteger> regIDs;
|
||||||
|
public Vector<TemplateDimension> dimensions;
|
||||||
|
public LinkedHashMap<Long, ProjectArray> links;
|
||||||
|
public ProjectArray align_template = null; //ссылка на шаблон на который идет выравнивание.
|
||||||
|
public String spaces_shift = ""; //смещение из пробелов
|
||||||
|
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
|
||||||
|
//ИЗМЕНЕНИЕ РАСПРЕДЕЛЕНИЯ
|
||||||
|
//текущие
|
||||||
|
public LinkedHashMap<Integer, Dimension> ac_current;
|
||||||
|
//кандидаты на замену.
|
||||||
|
public LinkedHashMap<Integer, Dimension> ac_new;
|
||||||
|
//https://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell
|
||||||
|
public ArrayAlignmentBar bar = null;
|
||||||
|
//------
|
||||||
|
public void print() {
|
||||||
Vector<String> res = new Vector<>();
|
Vector<String> res = new Vector<>();
|
||||||
res.add(">");
|
res.add(">");
|
||||||
res.add("id="+id);
|
res.add("id=" + id);
|
||||||
res.add("packed_address="+ packed_address);
|
res.add("packed_address=" + packed_address);
|
||||||
res.add("name="+name);
|
res.add("name=" + name);
|
||||||
res.add("shortName="+shortName);
|
res.add("shortName=" + shortName);
|
||||||
res.add("dimSize="+dimSize);
|
res.add("dimSize=" + dimSize);
|
||||||
res.add("typeSize="+typeSize);
|
res.add("typeSize=" + typeSize);
|
||||||
res.add("state="+state);
|
res.add("state=" + state);
|
||||||
res.add("location="+location);
|
res.add("location=" + location);
|
||||||
res.add("locName="+locName);
|
res.add("locName=" + locName);
|
||||||
res.add("isTempFlag="+isTemplFlag);
|
res.add("isTempFlag=" + isTemplFlag);
|
||||||
res.add("isLoopArrayFlag="+isLoopArrayFlag);
|
res.add("isLoopArrayFlag=" + isLoopArrayFlag);
|
||||||
res.add("<");
|
res.add("<");
|
||||||
System.out.println(String.join("\n",res));
|
System.out.println(String.join("\n", res));
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
public ArrayState getState() {
|
public ArrayState getState() {
|
||||||
return ArrayState.fromInt(state);
|
return ArrayState.fromInt(state);
|
||||||
}
|
}
|
||||||
public void setState(ArrayState state_in){
|
public void setState(ArrayState state_in) {
|
||||||
state = state_in.ordinal();
|
state = state_in.ordinal();
|
||||||
}
|
}
|
||||||
public ArrayLocation getLocation() {
|
public ArrayLocation getLocation() {
|
||||||
return ArrayLocation.fromInt(location);
|
return ArrayLocation.fromInt(location);
|
||||||
}
|
}
|
||||||
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
|
|
||||||
public Vector<TemplateDimension> dimensions = new Vector<>();
|
|
||||||
//------
|
//------
|
||||||
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
|
|
||||||
//связи->
|
|
||||||
public LinkedHashMap<Long, ProjectArray> links = new LinkedHashMap<>();
|
|
||||||
//------>
|
|
||||||
public ProjectArray align_template = null; //ссылка на шаблон на который идет выравнивание.
|
|
||||||
public String spaces_shift = ""; //смещение из пробелов
|
|
||||||
//ИЗМЕНЕНИЕ РАСПРЕДЕЛЕНИЯ
|
|
||||||
//------------------------------------------------------------------------------------------------------>
|
|
||||||
//текущие
|
|
||||||
public LinkedHashMap<Integer, Dimension> ac_current = new LinkedHashMap<>();
|
|
||||||
//кандидаты на замену.
|
|
||||||
public LinkedHashMap<Integer, Dimension> ac_new = new LinkedHashMap<>();
|
|
||||||
//https://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell
|
|
||||||
public ArrayAlignmentBar bar = null;
|
|
||||||
//------------------------------------------------------------------------------------------------------>
|
|
||||||
//<editor-fold desc="Функционал шаблона">
|
|
||||||
public Vector<BigInteger> regIDs = new Vector<>();
|
|
||||||
//--
|
|
||||||
public ProjectArray(String[] infoF, Index idx, BigInteger address_in) {
|
public ProjectArray(String[] infoF, Index idx, BigInteger address_in) {
|
||||||
id = Integer.parseInt(infoF[idx.Inc()]); //+
|
id = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||||
name = infoF[idx.Inc()]; //+
|
name = infoF[idx.Inc()]; //+
|
||||||
@@ -130,7 +124,6 @@ public class ProjectArray extends DBObject {
|
|||||||
sizes_size = Integer.parseInt(infoF[idx.Inc()]);
|
sizes_size = Integer.parseInt(infoF[idx.Inc()]);
|
||||||
for (int i = 0; i < sizes_size; ++i)
|
for (int i = 0; i < sizes_size; ++i)
|
||||||
mappedDims.add(Integer.parseInt(infoF[idx.Inc()])); //+
|
mappedDims.add(Integer.parseInt(infoF[idx.Inc()])); //+
|
||||||
|
|
||||||
//todo удалить после перехода на json
|
//todo удалить после перехода на json
|
||||||
int templateInfo_size = Integer.parseInt(infoF[idx.Inc()]);
|
int templateInfo_size = Integer.parseInt(infoF[idx.Inc()]);
|
||||||
for (int i = 0; i < templateInfo_size; ++i) {
|
for (int i = 0; i < templateInfo_size; ++i) {
|
||||||
@@ -157,12 +150,19 @@ public class ProjectArray extends DBObject {
|
|||||||
regions.add(localSplited[idxPl++]); //++
|
regions.add(localSplited[idxPl++]); //++
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
public void Init(){
|
public void Init() {
|
||||||
// address = packed_address !=null ? new BigInteger(packed_address):BigInteger.ONE;
|
|
||||||
//короткое имя+ функция/модуль/комон+ размерность
|
//короткое имя+ функция/модуль/комон+ размерность
|
||||||
UniqKey = shortName + locName + dimSize;
|
UniqKey = shortName + locName + dimSize;
|
||||||
for (ArrayDecl arrayDecl: declPlaces)
|
if (packed_address != null) address = new BigInteger(packed_address);
|
||||||
|
for (ArrayDecl arrayDecl : declPlaces)
|
||||||
arrayDecl.file = Utils_.toW(arrayDecl.file);
|
arrayDecl.file = Utils_.toW(arrayDecl.file);
|
||||||
|
//-- полей нет в json поэтому они null
|
||||||
|
regIDs = new Vector<>();
|
||||||
|
dimensions = new Vector<>();
|
||||||
|
links = new LinkedHashMap<>();
|
||||||
|
ac_current = new LinkedHashMap<>();
|
||||||
|
ac_new = new LinkedHashMap<>();
|
||||||
|
//--
|
||||||
}
|
}
|
||||||
public static String fill_binary(int d, String binary) {
|
public static String fill_binary(int d, String binary) {
|
||||||
int delta = Math.abs(binary.length() - d);
|
int delta = Math.abs(binary.length() - d);
|
||||||
@@ -405,7 +405,7 @@ public class ProjectArray extends DBObject {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ImageIcon GetDisabledIcon() {
|
public ImageIcon GetDisabledIcon() {
|
||||||
return Utils_.getIcon("/icons/Arrays/" +getState().toString() + ".png");
|
return Utils_.getIcon("/icons/Arrays/" + getState().toString() + ".png");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void select(boolean flag) {
|
public void select(boolean flag) {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import Common.Utils.Pair;
|
|||||||
import Common.Utils.Utils_;
|
import Common.Utils.Utils_;
|
||||||
import _VisualDVM.Global;
|
import _VisualDVM.Global;
|
||||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.AlignRule;
|
import _VisualDVM.ProjectData.SapforData.Arrays.AlignRule;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.DataDirective;
|
import _VisualDVM.ProjectData.SapforData.Arrays.ArrayLocation;
|
||||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
|
|
||||||
@@ -22,21 +22,41 @@ public class ParallelRegion extends DBObject {
|
|||||||
@Expose
|
@Expose
|
||||||
public String originalName;
|
public String originalName;
|
||||||
@Expose
|
@Expose
|
||||||
public List<ProjectArray> arrays=new Vector<>();
|
public List<ProjectArray> packed_arrays;
|
||||||
@Expose
|
@Expose
|
||||||
public RegionLinesJson packed_lines;
|
public List<FileRegionLinesJson> regionsLines;
|
||||||
|
@Expose
|
||||||
|
public Vector<AlignRule> alignRules;
|
||||||
|
//----
|
||||||
|
public Vector<String> rules = new Vector<>();
|
||||||
|
public void genRules(LinkedHashMap<BigInteger, ProjectArray> Arrays) {
|
||||||
|
rules.clear();
|
||||||
|
int maxLen = 0;
|
||||||
|
for (AlignRule a : alignRules)
|
||||||
|
maxLen = Math.max(maxLen, a.GetLenString());
|
||||||
|
LinkedHashMap<String, Vector<String>> toPrint = new LinkedHashMap<>();
|
||||||
|
for (AlignRule a : alignRules) {
|
||||||
|
if (Arrays.get(a.alignArray_address).getLocation() != ArrayLocation.parameter) {
|
||||||
|
Pair<String, String> result = a.GenRule(maxLen);
|
||||||
|
if (!toPrint.containsKey(result.getKey()))
|
||||||
|
toPrint.put(result.getKey(), new Vector<>());
|
||||||
|
toPrint.get(result.getKey()).add(result.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Vector<String> v : toPrint.values())
|
||||||
|
for (String r : v)
|
||||||
|
rules.add(r);
|
||||||
|
}
|
||||||
//--
|
//--
|
||||||
public BigInteger regionId;
|
public BigInteger regionId;
|
||||||
//name in program
|
//name in program
|
||||||
|
|
||||||
// file -> <start, end> lines
|
// file -> <start, end> lines
|
||||||
public LinkedHashMap<String, List<IntegerPairJson>> lines;
|
public LinkedHashMap<String, List<IntegerPairJson>> lines; //+
|
||||||
//ключ - адрес. меняем
|
//ключ - адрес. меняем
|
||||||
public LinkedHashMap<BigInteger, ProjectArray> arraysMap;
|
public LinkedHashMap<BigInteger, ProjectArray> arraysMap; //+
|
||||||
//for directive creating
|
//for directive creating
|
||||||
public DataDirective dataDirectives;
|
|
||||||
public int maxdim = 0;
|
public int maxdim = 0;
|
||||||
public Vector<String> fragments = new Vector<>();
|
public Vector<String> fragments; //+
|
||||||
public int lines_count = 0;
|
public int lines_count = 0;
|
||||||
public int loops_count = 0;
|
public int loops_count = 0;
|
||||||
public int arrays_count = 0;
|
public int arrays_count = 0;
|
||||||
@@ -48,7 +68,8 @@ public class ParallelRegion extends DBObject {
|
|||||||
String[] localSplited = splited[idx.Inc()].split("\\|");
|
String[] localSplited = splited[idx.Inc()].split("\\|");
|
||||||
int lines_size = Integer.parseInt(localSplited[0]);
|
int lines_size = Integer.parseInt(localSplited[0]);
|
||||||
lines = new LinkedHashMap<>(lines_size);
|
lines = new LinkedHashMap<>(lines_size);
|
||||||
//распаковка Lines -----------------------------------------------
|
fragments = new Vector<>();
|
||||||
|
//распаковка Lines -ArrayALignmentBar-----------
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
for (int i = 0; i < lines_size; ++i) {
|
for (int i = 0; i < lines_size; ++i) {
|
||||||
String line_file = Utils_.toW(localSplited[1]);
|
String line_file = Utils_.toW(localSplited[1]);
|
||||||
@@ -79,12 +100,11 @@ public class ParallelRegion extends DBObject {
|
|||||||
} else if (new_array.isLoopArrayFlag != 1) arrays_count++;
|
} else if (new_array.isLoopArrayFlag != 1) arrays_count++;
|
||||||
}
|
}
|
||||||
int dataDirectives_alignRules_size = Integer.parseInt(splited[idx.Inc()]);
|
int dataDirectives_alignRules_size = Integer.parseInt(splited[idx.Inc()]);
|
||||||
dataDirectives = new DataDirective();
|
alignRules = new Vector<>(dataDirectives_alignRules_size);
|
||||||
dataDirectives.alignRules = new Vector<>(dataDirectives_alignRules_size);
|
|
||||||
for (int i = 0; i < dataDirectives_alignRules_size; ++i)
|
for (int i = 0; i < dataDirectives_alignRules_size; ++i)
|
||||||
dataDirectives.alignRules.add(new AlignRule(splited, idx));
|
alignRules.add(new AlignRule(splited, idx));
|
||||||
for (int i = 0; i < dataDirectives.alignRules.size(); ++i)
|
for (int i = 0; i < alignRules.size(); ++i)
|
||||||
dataDirectives.alignRules.get(i).parent_region = this;
|
alignRules.get(i).parent_region = this;
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
lines_count = 0;
|
lines_count = 0;
|
||||||
loops_count = 0;
|
loops_count = 0;
|
||||||
@@ -99,7 +119,32 @@ public class ParallelRegion extends DBObject {
|
|||||||
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
|
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------------------
|
}
|
||||||
|
public void Init() {
|
||||||
|
arraysMap = new LinkedHashMap<>();
|
||||||
|
lines = new LinkedHashMap<>();
|
||||||
|
fragments = new Vector<>();
|
||||||
|
//--
|
||||||
|
if (packed_region_id != null)
|
||||||
|
regionId = new BigInteger(packed_region_id);
|
||||||
|
for (ProjectArray array : packed_arrays) {
|
||||||
|
array.Init();//имена и адреса.
|
||||||
|
arraysMap.put(array.address, array);
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
for (FileRegionLinesJson fr : regionsLines) {
|
||||||
|
lines.put(fr.file, fr.lines);
|
||||||
|
for (IntegerPairJson l : fr.lines) {
|
||||||
|
fragments.add(fr.file + ": " + l.getKey() + "-" + l.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
packed_region_id = null;
|
||||||
|
packed_arrays.clear();
|
||||||
|
packed_arrays = null;
|
||||||
|
regionsLines.clear();
|
||||||
|
regionsLines = null;
|
||||||
|
//--
|
||||||
}
|
}
|
||||||
public boolean ArrayBelongsToRegion(long id) {
|
public boolean ArrayBelongsToRegion(long id) {
|
||||||
return arraysMap.values().stream().anyMatch(array -> array.id == id);
|
return arraysMap.values().stream().anyMatch(array -> array.id == id);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package _VisualDVM.ProjectData.SapforData.Regions;
|
|
||||||
import com.google.gson.annotations.Expose;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Vector;
|
|
||||||
public class RegionLinesJson {
|
|
||||||
@Expose
|
|
||||||
public List<FileRegionLinesJson> allLines = new Vector<>();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user