Skip to content

Commit a419bf8

Browse files
committed
Change setSolverConfig to setModelConfig for webWorkers
1 parent 20df350 commit a419bf8

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

src/workers/workerScript.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export class FEAScriptWorker {
3030
}
3131

3232
/**
33-
* Function to initialize the web worker and wrap it using Comlink.
33+
* Function to initialize the web worker and wrap it using Comlink
3434
* @private
35-
* @throws Will throw an error if the worker fails to initialize.
35+
* @throws Will throw an error if the worker fails to initialize
3636
*/
3737
async _initWorker() {
3838
try {
@@ -55,10 +55,10 @@ export class FEAScriptWorker {
5555
}
5656

5757
/**
58-
* Function to ensure that the worker is ready before performing any operations.
58+
* Function to ensure that the worker is ready before performing any operations
5959
* @private
60-
* @returns {Promise<void>} Resolves when the worker is ready.
61-
* @throws Will throw an error if the worker is not ready within the timeout period.
60+
* @returns {Promise<void>} Resolves when the worker is ready
61+
* @throws Will throw an error if the worker is not ready within the timeout period
6262
*/
6363
async _ensureReady() {
6464
if (this.isReady) return Promise.resolve();
@@ -82,20 +82,20 @@ export class FEAScriptWorker {
8282
}
8383

8484
/**
85-
* Function to set the solver configuration in the worker.
86-
* @param {string} solverConfig - The solver configuration to set.
87-
* @returns {Promise<boolean>} Resolves when the configuration is set.
85+
* Function to set the model configuration in the worker
86+
* @param {string} modelConfig - The model configuration to set
87+
* @returns {Promise<boolean>} Resolves when the configuration is set
8888
*/
89-
async setSolverConfig(solverConfig) {
89+
async setModelConfig(modelConfig) {
9090
await this._ensureReady();
91-
basicLog(`FEAScriptWorker: Setting solver config to: ${solverConfig}`);
92-
return this.feaWorker.setSolverConfig(solverConfig);
91+
basicLog(`FEAScriptWorker: Setting model config to: ${modelConfig}`);
92+
return this.feaWorker.setModelConfig(modelConfig);
9393
}
9494

9595
/**
96-
* Sets the mesh configuration in the worker.
97-
* @param {object} meshConfig - The mesh configuration to set.
98-
* @returns {Promise<boolean>} Resolves when the configuration is set.
96+
* Function to set the mesh configuration in the worker
97+
* @param {object} meshConfig - The mesh configuration to set
98+
* @returns {Promise<boolean>} Resolves when the configuration is set
9999
*/
100100
async setMeshConfig(meshConfig) {
101101
await this._ensureReady();
@@ -104,10 +104,10 @@ export class FEAScriptWorker {
104104
}
105105

106106
/**
107-
* Adds a boundary condition to the worker.
108-
* @param {string} boundaryKey - The key identifying the boundary.
109-
* @param {array} condition - The boundary condition to add.
110-
* @returns {Promise<boolean>} Resolves when the boundary condition is added.
107+
* Function to add a boundary condition to the worker
108+
* @param {string} boundaryKey - The key identifying the boundary
109+
* @param {array} condition - The boundary condition to add
110+
* @returns {Promise<boolean>} Resolves when the boundary condition is added
111111
*/
112112
async addBoundaryCondition(boundaryKey, condition) {
113113
await this._ensureReady();
@@ -116,9 +116,9 @@ export class FEAScriptWorker {
116116
}
117117

118118
/**
119-
* Sets the solver method in the worker.
120-
* @param {string} solverMethod - The solver method to set.
121-
* @returns {Promise<boolean>} Resolves when the solver method is set.
119+
* Function to set the solver method in the worker
120+
* @param {string} solverMethod - The solver method to set
121+
* @returns {Promise<boolean>} Resolves when the solver method is set
122122
*/
123123
async setSolverMethod(solverMethod) {
124124
await this._ensureReady();
@@ -127,8 +127,8 @@ export class FEAScriptWorker {
127127
}
128128

129129
/**
130-
* Requests the worker to solve the problem.
131-
* @returns {Promise<object>} Resolves with the solution result.
130+
* Function to request the worker to solve the problem
131+
* @returns {Promise<object>} Resolves with the solution result
132132
*/
133133
async solve() {
134134
await this._ensureReady();
@@ -143,25 +143,25 @@ export class FEAScriptWorker {
143143
}
144144

145145
/**
146-
* Retrieves model information from the worker.
147-
* @returns {Promise<object>} Resolves with the model information.
146+
* Function to retrieve model information from the worker
147+
* @returns {Promise<object>} Resolves with the model information
148148
*/
149149
async getModelInfo() {
150150
await this._ensureReady();
151151
return this.feaWorker.getModelInfo();
152152
}
153153

154154
/**
155-
* Sends a ping request to the worker to check its availability.
156-
* @returns {Promise<boolean>} Resolves if the worker responds.
155+
* Function to send a ping request to the worker to check its availability
156+
* @returns {Promise<boolean>} Resolves if the worker responds
157157
*/
158158
async ping() {
159159
await this._ensureReady();
160160
return this.feaWorker.ping();
161161
}
162162

163163
/**
164-
* Terminates the worker and cleans up resources.
164+
* Function to terminate the worker and clean up resources
165165
*/
166166
terminate() {
167167
if (this.worker) {

src/workers/wrapperScript.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,26 @@ class workerWrapper {
3737
}
3838

3939
/**
40-
* Function to set the solver configuration in the FEAScriptModel.
41-
* @param {string} solverConfig - The solver configuration to set.
42-
* @returns {boolean} Returns true if the configuration is set successfully.
43-
* @throws Will throw an error if the configuration fails to set.
40+
* Function to set the model configuration in the FEAScriptModel
41+
* @param {string} modelConfig - The model configuration to set
42+
* @returns {boolean} Returns true if the configuration is set successfully
43+
* @throws Will throw an error if the configuration fails to set
4444
*/
45-
setSolverConfig(solverConfig) {
45+
setModelConfig(modelConfig) {
4646
try {
47-
this.model.setSolverConfig(solverConfig);
47+
this.model.setModelConfig(modelConfig);
4848
return true;
4949
} catch (error) {
50-
console.error("FEA Worker: Error in setSolverConfig", error);
50+
console.error("FEA Worker: Error in setModelConfig", error);
5151
throw error;
5252
}
5353
}
5454

5555
/**
56-
* Function to set the mesh configuration in the FEAScriptModel.
57-
* @param {object} meshConfig - The mesh configuration to set.
58-
* @returns {boolean} Returns true if the configuration is set successfully.
59-
* @throws Will throw an error if the configuration fails to set.
56+
* Function to set the mesh configuration in the FEAScriptModel
57+
* @param {object} meshConfig - The mesh configuration to set
58+
* @returns {boolean} Returns true if the configuration is set successfully
59+
* @throws Will throw an error if the configuration fails to set
6060
*/
6161
setMeshConfig(meshConfig) {
6262
try {
@@ -69,11 +69,11 @@ class workerWrapper {
6969
}
7070

7171
/**
72-
* Function to add a boundary condition to the FEAScriptModel.
73-
* @param {string} boundaryKey - The key identifying the boundary.
74-
* @param {array} condition - The boundary condition to add.
75-
* @returns {boolean} Returns true if the boundary condition is added successfully.
76-
* @throws Will throw an error if the boundary condition fails to add.
72+
* Function to add a boundary condition to the FEAScriptModel
73+
* @param {string} boundaryKey - The key identifying the boundary
74+
* @param {array} condition - The boundary condition to add
75+
* @returns {boolean} Returns true if the boundary condition is added successfully
76+
* @throws Will throw an error if the boundary condition fails to add
7777
*/
7878
addBoundaryCondition(boundaryKey, condition) {
7979
try {
@@ -86,10 +86,10 @@ class workerWrapper {
8686
}
8787

8888
/**
89-
* Function to set the solver method in the FEAScriptModel.
90-
* @param {string} solverMethod - The solver method to set.
91-
* @returns {boolean} Returns true if the solver method is set successfully.
92-
* @throws Will throw an error if the solver method fails to set.
89+
* Function to set the solver method in the FEAScriptModel
90+
* @param {string} solverMethod - The solver method to set
91+
* @returns {boolean} Returns true if the solver method is set successfully
92+
* @throws Will throw an error if the solver method fails to set
9393
*/
9494
setSolverMethod(solverMethod) {
9595
try {
@@ -102,9 +102,9 @@ class workerWrapper {
102102
}
103103

104104
/**
105-
* Function to solve the problem using the FEAScriptModel.
106-
* @returns {object} Returns the solution result, including the solution vector, node coordinates, solver configuration, and mesh dimension.
107-
* @throws Will throw an error if the solve operation fails.
105+
* Function to solve the problem using the FEAScriptModel
106+
* @returns {object} Returns the solution result, including the solution vector, node coordinates, solver configuration, and mesh dimension
107+
* @throws Will throw an error if the solve operation fails
108108
*/
109109
solve() {
110110
try {
@@ -123,9 +123,9 @@ class workerWrapper {
123123
}
124124

125125
/**
126-
* Function to retrieve model information from the FEAScriptModel.
127-
* @returns {object} Returns the model information, including solver configuration, mesh configuration, boundary conditions, and solver method.
128-
* @throws Will throw an error if the model information fails to retrieve.
126+
* Function to retrieve model information from the FEAScriptModel
127+
* @returns {object} Returns the model information, including solver configuration, mesh configuration, boundary conditions, and solver method
128+
* @throws Will throw an error if the model information fails to retrieve
129129
*/
130130
getModelInfo() {
131131
try {
@@ -142,8 +142,8 @@ class workerWrapper {
142142
}
143143

144144
/**
145-
* Function to perform a simple ping to check if the worker is responsive.
146-
* @returns {boolean} Returns true to indicate the worker is available.
145+
* Function to perform a simple ping to check if the worker is responsive
146+
* @returns {boolean} Returns true to indicate the worker is available
147147
*/
148148
ping() {
149149
try {

0 commit comments

Comments
 (0)