|
19 | 19 | #include "TempestRemapAPI.h" |
20 | 20 | #include "OfflineMap.h" |
21 | 21 | #include "netcdfcpp.h" |
| 22 | +#include "GridElements.h" |
| 23 | +#include "FiniteElementTools.h" |
22 | 24 |
|
23 | 25 | #include <fstream> |
24 | 26 |
|
@@ -273,14 +275,79 @@ try { |
273 | 275 | AnnounceStartBlock("Applying first offline map to data"); |
274 | 276 | } |
275 | 277 | */ |
| 278 | + |
| 279 | + DataArray3D<int> dataGLLNodesIn; |
| 280 | + DataArray3D<double> dataGLLJacobianIn; |
| 281 | + |
| 282 | + DataArray3D<int> dataGLLNodesOut; |
| 283 | + DataArray3D<double> dataGLLJacobianOut; |
| 284 | + |
| 285 | + DataArray3D<int> * pdataGLLNodesIn = NULL; |
| 286 | + |
| 287 | + DataArray3D<int> * pdataGLLNodesOut = NULL; |
| 288 | + |
| 289 | + Mesh meshOverlap; |
| 290 | + Mesh meshSource; |
| 291 | + Mesh meshTarget; |
| 292 | + |
| 293 | + Mesh * pmeshSource = NULL; |
| 294 | + Mesh * pmeshOverlap = NULL; |
| 295 | + |
| 296 | + |
| 297 | + if(optsApply.strInputMesh != ""){ |
| 298 | + |
| 299 | + //If the source mesh is finite volume, we need the source mesh for local p bounds preservation |
| 300 | + |
| 301 | + meshSource.Read(optsApply.strInputMesh); |
| 302 | + meshSource.ConstructReverseNodeArray(); |
| 303 | + meshSource.ConstructEdgeMap(); |
| 304 | + pmeshSource = &meshSource; |
| 305 | + |
| 306 | + |
| 307 | + //If the source mesh is finite element, we need dataGLLNodes for local bounds preservation |
| 308 | + if(optsApply.fgll){ |
| 309 | + |
| 310 | + double dTotalAreaInput = meshSource.CalculateFaceAreas(optsApply.fContainsConcaveFaces); |
| 311 | + double dNumericalAreaIn = GenerateMetaData(meshSource,optsApply.nPin,false,dataGLLNodesIn,dataGLLJacobianIn); |
| 312 | + |
| 313 | + pdataGLLNodesIn = &dataGLLNodesIn; |
| 314 | + |
| 315 | + } |
| 316 | + |
| 317 | + } |
| 318 | + |
| 319 | + if(optsApply.strOverlapMesh != ""){ |
| 320 | + |
| 321 | + meshOverlap.Read(optsApply.strOverlapMesh); |
| 322 | + meshOverlap.RemoveZeroEdges(); |
| 323 | + pmeshOverlap = &meshOverlap; |
| 324 | + |
| 325 | + } |
| 326 | + |
| 327 | + //If the target mesh is finite element, get dataGLLNodesOut |
| 328 | + if(optsApply.strOutputMesh != ""){ |
| 329 | + |
| 330 | + meshTarget.Read(optsApply.strOutputMesh); |
| 331 | + meshTarget.ConstructReverseNodeArray(); |
| 332 | + meshTarget.ConstructEdgeMap(); |
| 333 | + |
| 334 | + double dTotalAreaOutput = meshTarget.CalculateFaceAreas(optsApply.fContainsConcaveFaces); |
| 335 | + double dNumericalAreaOut = GenerateMetaData(meshTarget,optsApply.nPout,false,dataGLLNodesOut,dataGLLJacobianOut); |
| 336 | + |
| 337 | + pdataGLLNodesOut = &dataGLLNodesOut; |
| 338 | + |
| 339 | + } |
| 340 | + |
276 | 341 | // OfflineMap |
277 | 342 | AnnounceStartBlock("Loading offline map"); |
278 | 343 |
|
279 | 344 | OfflineMap mapRemap; |
280 | 345 | mapRemap.Read(strInputMap); |
281 | 346 | mapRemap.SetFillValueOverrideDbl(optsApply.dFillValueOverride); |
282 | 347 | mapRemap.SetFillValueOverride(static_cast<float>(optsApply.dFillValueOverride)); |
283 | | - mapRemap.SetEnforcementBounds(optsApply.strEnforceBounds); |
| 348 | + mapRemap.SetEnforcementBounds(optsApply.strEnforceBounds,pmeshSource,pmeshOverlap,pdataGLLNodesIn, |
| 349 | + pdataGLLNodesOut,optsApply.nPin); |
| 350 | + //mapRemap.SetEnforcementBounds(optsApply.strEnforceBounds); |
284 | 351 |
|
285 | 352 | AnnounceEndBlock("Done"); |
286 | 353 |
|
|
0 commit comments