-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b808c0d
commit 869ba96
Showing
19 changed files
with
151 additions
and
26 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/*************************** | ||
@Author: Chunel | ||
@Contact: [email protected] | ||
@File: test-functional-03.cpp | ||
@Time: 2023/12/29 22:13 | ||
@Desc: | ||
***************************/ | ||
|
||
|
||
#include "../_Materials/TestInclude.h" | ||
|
||
using namespace CGraph; | ||
|
||
void test_functional_03() { | ||
CStatus status; | ||
GPipelinePtr pipeline = GPipelineFactory::create(); | ||
GElementPtr a, b_cluster, c, d_region, e = nullptr; | ||
|
||
b_cluster = pipeline->createGGroup<GCluster>({ | ||
pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo("nodeB1", 1)), // 创建名为nodeB1的node信息,并将其放入b_cluster中 | ||
pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo("nodeB2", 3)), // 创建名为nodeB2且自循环3次的node信息,并将其放入b_cluster中 | ||
pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo("nodeB3", 1)) | ||
}); | ||
|
||
GElementPtr d1, d2, d3, d4, d23_cluster = nullptr; | ||
d1 = pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo({}, "nodeD1", 1)); | ||
d2 = pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo("nodeD2", 1)); // 创建node,稍后放入cluster中 | ||
d3 = pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo("nodeD3", 1)); | ||
d23_cluster = pipeline->createGGroup<GCluster>({d2, d3}, {d1}, "clusterD23", 1); | ||
d4 = pipeline->createGNode<TestMaterialAdd1GNode>(GNodeInfo({d1}, "nodeD4", 1)); | ||
d_region = pipeline->createGGroup<GRegion>({d1, d23_cluster, d4}); // 创建名为d_region的region信息,并将{d1,d23_cluster,d4}放入其中 | ||
|
||
status += pipeline->registerGElement<TestMaterialAdd1GNode>(&a, {}, "nodeA", 1); | ||
status += pipeline->registerGGroup(&b_cluster, {}, "clusterB", 1); | ||
status += pipeline->registerGElement<TestMaterialAdd1GNode>(&c, {a, b_cluster}, "nodeC", 1); | ||
status += pipeline->registerGGroup(&d_region, {a, b_cluster}, "regionD", 2); // 将名为regionD,依赖{a,b_cluster}执行且自循环2次的region信息,注册入pipeline中 | ||
status += pipeline->registerGElement<TestMaterialAdd1GNode>(&e, {c, d_region}, "nodeE", 1); | ||
if (!status.isOK()) { | ||
return; | ||
} | ||
|
||
{ | ||
UTimeCounter counter("test_functional_03"); | ||
pipeline->addGAspect<TestMaterialAdd1GAspect>(); | ||
status = pipeline->process(50000); | ||
} | ||
|
||
if (g_test_node_cnt % 58 != 0) { | ||
// 58 是单次执行本测例的情况下,i++的次数。包含 aspect和 element | ||
std::cout << g_test_node_cnt << " num can not divide 58." << std::endl; | ||
} | ||
|
||
if (status.isErr()) { | ||
std::cout << status.getInfo() << std::endl; | ||
} | ||
GPipelineFactory::remove(pipeline); | ||
} | ||
|
||
|
||
int main() { | ||
test_functional_03(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*************************** | ||
@Author: Chunel | ||
@Contact: [email protected] | ||
@File: TestCommonDefine.h | ||
@Time: 2023/12/29 22:00 | ||
@Desc: | ||
***************************/ | ||
|
||
#ifndef CGRAPH_TESTCOMMONDEFINE_H | ||
#define CGRAPH_TESTCOMMONDEFINE_H | ||
|
||
#include <atomic> | ||
|
||
#include "CGraph.h" | ||
|
||
std::atomic<unsigned int> g_test_node_cnt = {0}; | ||
|
||
#endif //CGRAPH_TESTCOMMONDEFINE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*************************** | ||
@Author: Chunel | ||
@Contact: [email protected] | ||
@File: TestGAspects.h | ||
@Time: 2023/12/29 21:59 | ||
@Desc: | ||
***************************/ | ||
|
||
#ifndef CGRAPH_TESTGASPECTS_H | ||
#define CGRAPH_TESTGASPECTS_H | ||
|
||
#include "TestCommonDefine.h" | ||
|
||
class TestMaterialAdd1GAspect : public CGraph::GAspect { | ||
public: | ||
CStatus beginRun() override { | ||
g_test_node_cnt++; | ||
return CStatus(); | ||
} | ||
|
||
CVoid finishRun(const CStatus& curStatus) override { | ||
g_test_node_cnt++; | ||
} | ||
}; | ||
|
||
|
||
#endif //CGRAPH_TESTGASPECTS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*************************** | ||
@Author: Chunel | ||
@Contact: [email protected] | ||
@File: TestInclude.h | ||
@Time: 2023/12/29 22:01 | ||
@Desc: | ||
***************************/ | ||
|
||
#ifndef CGRAPH_TESTINCLUDE_H | ||
#define CGRAPH_TESTINCLUDE_H | ||
|
||
#include "TestCommonDefine.h" | ||
#include "TestGNodes.h" | ||
#include "TestGAspects.h" | ||
|
||
#endif //CGRAPH_TESTINCLUDE_H |