Browse Source

check code -- 40%

VSbuild_required
郑敬润 9 months ago
parent
commit
6ba600cb86
  1. 4
      WireRouting_DLL/Astar.cpp
  2. 2
      WireRouting_DLL/BVH.cpp
  3. 2
      WireRouting_DLL/BVH.h
  4. 6
      WireRouting_DLL/BasicChannel.cpp
  5. 16
      WireRouting_DLL/BasicChannel.h
  6. 4
      WireRouting_DLL/BasicEdge.cpp
  7. 8
      WireRouting_DLL/BasicEdge.h
  8. 17
      WireRouting_DLL/BranchPoint.cpp
  9. 4
      WireRouting_DLL/BranchPoint.h
  10. 2
      WireRouting_DLL/BranchTree.cpp
  11. 2
      WireRouting_DLL/BranchTree.h
  12. 1
      WireRouting_DLL/Path.cpp
  13. 1
      WireRouting_DLL/Path.h
  14. 2
      WireRouting_DLL/WireRouting_DLL.vcxproj
  15. 6
      WireRouting_DLL/WireRouting_DLL.vcxproj.filters

4
WireRouting_DLL/Astar.cpp

@ -404,6 +404,8 @@ void Astar::search()
bool updatePreBranchPoint = false;
bool updateNextBranchPoint = false;
double tempPos1 = 0, tempPos2 = 0;
// 特殊处理分支点
if (points[xs].type == 1 || points[xs].type == 2)
{
int bid = points[xs].ref;
@ -460,7 +462,7 @@ void Astar::search()
}
int top = 0;
int tag = T * 2;
while (pre[tag])
while (pre[tag]) // pre[tag] 值为0导致无结果,
{
st[++top] = tag;
tag = pre[tag];

2
WireRouting_DLL/BVH.cpp

@ -1,6 +1,8 @@
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "BVH.h"
BVH bvh;
bool PointInTri(Point3 &P, Point3 &P0, Point3 &P1, Point3 &P2)
{
double area1 = Area2(P, P0, P1);

2
WireRouting_DLL/BVH.h

@ -72,3 +72,5 @@ struct BVH_API BVH
void read_stl(string filename);
};
extern BVH_API BVH bvh;

6
WireRouting_DLL/BasicChannel.cpp

@ -1,6 +1,8 @@
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "BasicChannel.h"
BasicChannel basicChannel;
// 仅仅根据卡箍的相对位置创建近似的通道
void BasicChannel::createChannel()
{
@ -570,8 +572,12 @@ void BasicChannel::printSingleBundle(int i, ofstream &ofs)
}
if (inOut != 0)
tp.reverse();
//------------------------mark------------------------
ofs << tp.x << " " << tp.y << " " << tp.z << " ";
ofs << tp.dx << " " << tp.dy << " " << tp.dz << endl;
// for blender input
// ofs << tp.x * 100 << " " << tp.y * 100 << " " << tp.z * 100 << " ";
// ofs << tp.dx * 100 << " " << tp.dy * 100 << " " << tp.dz * 100 << endl;
}
ofs << partBranchPoint.size() << endl;
for (int j = 0; j < partBranchPoint.size(); j++)

16
WireRouting_DLL/BasicChannel.h

@ -30,6 +30,13 @@ struct BASIC_CHANNEL_API BasicChannel
int basicChannelNum; // 基本通道数量
map<int, BundleNode *> PointConnectedTobranchPoint[MAXPointNum]; // 连接到分支点的点
vector<vector<pair<int, int>>> resClip;
vector<vector<int>> resBranchPoint;
vector<int> startBranchPoint;
vector<int> endBranchPoint;
vector<int> BundleConnectedToBranchPoint[MAXPointNum]; // 连接到分支点的通道
int Out[N];
// 仅仅根据卡箍的相对位置创建近似的通道
void createChannel();
@ -88,15 +95,10 @@ struct BASIC_CHANNEL_API BasicChannel
// 加入一条路径来更新通道数据
void addPath(Path path);
vector<vector<pair<int, int>>> resClip;
vector<vector<int>> resBranchPoint;
vector<int> startBranchPoint;
vector<int> endBranchPoint;
vector<int> BundleConnectedToBranchPoint[MAXPointNum]; // 连接到分支点的通道
int Out[N];
void printSingleBundle(int i, ofstream &ofs);
// 把bundle信息按格式要求打印出来
void printBundle(string resultfile, bool basic = false);
};
extern BASIC_CHANNEL_API BasicChannel basicChannel;

4
WireRouting_DLL/BasicEdge.cpp

@ -1,9 +1,7 @@
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "BasicEdge.h"
BVH bvh;
BasicChannel basicChannel;
BasicEdge basicEdge;
// 预处理分支点和卡箍之间的连线关系
void BasicEdge::buildEdgeBetweenClipAndBranchPoint()

8
WireRouting_DLL/BasicEdge.h

@ -20,10 +20,6 @@
#include <sstream>
using namespace std;
extern BVH BASIC_EDGE_API bvh;
extern BasicChannel BASIC_EDGE_API basicChannel;
// 存储卡箍与卡箍之间,卡箍与分支点之间,分支点与分支点之间的边关系
struct BASIC_EDGE_API BasicEdge
{
@ -69,4 +65,6 @@ public:
// 根据新的路径更新边信息
public:
void addPath(Path path);
};
};
extern BASIC_EDGE_API BasicEdge basicEdge;

17
WireRouting_DLL/BranchPoint.cpp

@ -1,6 +1,8 @@
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "BranchPoint.h"
BranchPointSet branchPointSet;
void BranchPoint::init()
{
l = 0;
@ -87,6 +89,14 @@ void BranchPoint::fix()
return;
fixed = true;
t = tempt[mode];
/*
if(pb1!=NULL){
pb1->pushL(t*Dis+MinBranchPointDistance-r*Dis);
}
if(pb2!=NULL){
pb2->pushR(l*Dis-(t*Dis-MinBranchPointDistance));
}
*/
cout << "***********";
if (!Equal(t, l) && !Equal(t, r))
cout << "-------";
@ -153,11 +163,14 @@ double BranchPoint::computeWeight(P &p, int inOut, bool reverse)
// 记录分支点最优位置
void BranchPoint::recordPos(int mode)
{
// if(!Equal(t,l)&&!Equal(t,r))cout<<"-------"<<endl;
// else t=(l+r)/2;
tempt[mode] = t;
}
void BranchPoint::check(int i)
{
// if(!Equal(t,l)&&!Equal(t,r))cout<<"--"<<i<<"--"<<endl;
}
BranchPointSet::BranchPointSet()
@ -166,7 +179,7 @@ BranchPointSet::BranchPointSet()
}
// 添加一个分支点,并返回指向它的指针
BranchPoint *BranchPointSet::addBranchPoint(Clip *pc1, Clip *pc2, int bundleNodeID)
BranchPoint* BranchPointSet::addBranchPoint(Clip* pc1, Clip* pc2, int bundleNodeID)
{
branchPointNum++;
b[branchPointNum] = BranchPoint(pc1, pc2);
@ -178,7 +191,7 @@ BranchPoint *BranchPointSet::addBranchPoint(Clip *pc1, Clip *pc2, int bundleNode
}
// 获取指向编号为id的分支点的指针
BranchPoint *BranchPointSet::getBranchPointPointer(int id)
BranchPoint* BranchPointSet::getBranchPointPointer(int id)
{
assert(id >= 1 && id <= branchPointNum);
return &b[id];

4
WireRouting_DLL/BranchPoint.h

@ -99,4 +99,6 @@ struct BRANCH_POINT_API BranchPointSet
// 获取指向编号为id的分支点的指针
BranchPoint *getBranchPointPointer(int id);
};
};
extern BRANCH_POINT_API BranchPointSet branchPointSet;

2
WireRouting_DLL/BasicTree.cpp → WireRouting_DLL/BranchTree.cpp

@ -1,8 +1,6 @@
#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "BranchTree.h"
BasicEdge basicEdge;
void Edge::clear()
{
to = 0;

2
WireRouting_DLL/BranchTree.h

@ -20,8 +20,6 @@
#include <sstream>
using namespace std;
extern BasicEdge BRANCH_TREE_API basicEdge;
struct BRANCH_TREE_API Edge
{
vector<string> wirenames;

1
WireRouting_DLL/Path.cpp

@ -2,7 +2,6 @@
#include "Path.h"
ClipSet clipSet;
BranchPointSet branchPointSet;
P dirP(P &A)
{

1
WireRouting_DLL/Path.h

@ -23,7 +23,6 @@
using namespace std;
extern ClipSet PATH_API clipSet;
extern BranchPointSet PATH_API branchPointSet;
extern P PATH_API dirP(P &A);

2
WireRouting_DLL/WireRouting_DLL.vcxproj

@ -166,8 +166,8 @@
<ClCompile Include="Astar.cpp" />
<ClCompile Include="BasicChannel.cpp" />
<ClCompile Include="BasicEdge.cpp" />
<ClCompile Include="BasicTree.cpp" />
<ClCompile Include="BranchPoint.cpp" />
<ClCompile Include="BranchTree.cpp" />
<ClCompile Include="Bundle.cpp" />
<ClCompile Include="BVH.cpp" />
<ClCompile Include="Clip.cpp" />

6
WireRouting_DLL/WireRouting_DLL.vcxproj.filters

@ -116,14 +116,14 @@
<ClCompile Include="BasicEdge.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="BasicTree.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="BasicChannel.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Astar.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="BranchTree.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
Loading…
Cancel
Save