49 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
| // This file is part of BUDEES, a software that allows fast simulation of bubble dynamics in electrolyzers and their interactions with electrical parameters. 
 | |
| // 
 | |
| // Copyright (C) 2024 <CNRS-ENS Rennes-Université de Rennes-CY Cergy Paris Université-Université Paris Saclay-CNAM Paris-ENS Paris-Saclay>
 | |
| // 
 | |
| // This program is free software: you can redistribute it and/or modify
 | |
| // it under the terms of the GNU General Public License as published by
 | |
| // the Free Software Foundation, either version 3 of the License, or
 | |
| // (at your option) any later version.
 | |
| // 
 | |
| // This program is distributed in the hope that it will be useful,
 | |
| // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
| // GNU General Public License for more details.
 | |
| // 
 | |
| // You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/
 | |
| 
 | |
| void readConfigurationTopology(Configuration& configuration, Topology& topology, double* args) {
 | |
| 	int pos = 0, count;
 | |
| 	/* -------- Parameters -------- */
 | |
| 	// System dimensions [m]
 | |
| 	configuration.L[0] = args[pos++];
 | |
| 	configuration.L[1] = args[pos++];
 | |
| 	// Current density [A/m2]
 | |
| 	configuration.J = args[pos++];
 | |
| 	// Simulation duration [s]
 | |
| 	configuration.tf = args[pos++];
 | |
| 	/* --------- Topology --------- */
 | |
| 	// Polygon count
 | |
| 	topology.polygonCount[0] = args[pos++];
 | |
| 	topology.polygonCount[1] = args[pos++];
 | |
| 	// Polygon indexs
 | |
| 	count = topology.polygonCount[0]+1;
 | |
| 	topology.polygonIndex[0] = new int[count];
 | |
| 	for (int i = 0; i < count; i++) {
 | |
| 		topology.polygonIndex[0][i] = args[pos++];
 | |
| 	}
 | |
| 	count = topology.polygonCount[1]+1;
 | |
| 	topology.polygonIndex[1] = new int[count];
 | |
| 	for (int i = 0; i < count; i++) {
 | |
| 		topology.polygonIndex[1][i] = args[pos++];
 | |
| 	}
 | |
| 	// Polygon defs
 | |
| 	count = topology.polygonIndex[1][topology.polygonCount[1]];
 | |
| 	topology.polygonDefinitions = new Point[count];
 | |
| 	for (int i = 0; i < count; i++) {
 | |
| 		topology.polygonDefinitions[i] = {args[pos++], args[pos++]};
 | |
| 	}
 | |
| }
 |