CHLNDDEV / OceanMesh2D

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).
https://github.com/sponsors/krober10nd
GNU General Public License v3.0
178 stars 64 forks source link

Unrecognized function or variable 'annmex'. #310

Closed soloyant closed 3 months ago

soloyant commented 3 months ago

Describe the bug Missing function "annmex" when running various functions including meshgen(), and plus().

>> RunTests

Read shapefile with shaperead
Partitioning the boundary into islands, mainland, ocean
Smoothing coastline with 5 point window
Read shapefile with shaperead
Partitioning the boundary into islands, mainland, ocean
    {'Read in meshing boundary: '}    {'GSHHS_f_L1'}

Building feature size function...
Memory management: number of loops in dpoly = 1
man, no medial points!
--------------------------------------------------
Releasing individual edge functions from memory...
--------------------------------------------------
Relaxing the mesh size gradient
Gradient relaxing converged!
Finalized edge function!
Warning: No itmax specified, itmax set to 100 
> In meshgen (line 422)
In Example_1_NZ (line 31)
In run (line 99)
In TestSanity (line 3)
In RunTests (line 13) 
Current mapping parameters -
 Projection: Transverse Mercator  (function: mp_tmerc)
 longitudes: 165.0991      176.9009 (centered at 171) 
 latitudes: -48.9009     -39.0991                     
 Rectangular border: off                              
Unrecognized function or variable 'annmex'.

Error in get_data_class (line 3)
d = annmex();

Error in ann (line 108)
[anno.ccls anno.cfun] = get_data_class();

Error in meshgen/createANN (line 632)
                dmy = ann(dataset');

Error in meshgen (line 512)
            obj = createANN(obj) ;

Error in Example_1_NZ (line 31)
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1,'nscreen',5,'proj','trans');

Error in run (line 99)
evalin('caller', strcat(script, ';'));

Error in TestSanity (line 3)
run('../Examples/Example_1_NZ.m')

Error in RunTests (line 13)
   TestSanity

To Reproduce run Tests/RunTests.m on a new installation

Configuration (please complete the following information):

Additional context Happened after updating to the latest available version of the package. Tried backing up and re-installing - following the guide instructions - multiple times without success.

krober10nd commented 3 months ago

Hi @soloyant I think you need to recompile the Approximate Nearest Neighbor mex file.

You can follow the instructions here

https://github.com/CHLNDDEV/OceanMesh2D/tree/Projection/%40ann

soloyant commented 3 months ago

Hi @krober10nd, thank you for the quick reply.

I did try recompiling the ANN mex file, but if it solved the Unrecognized function or variable 'annmex' error, it led matlab to consistently crash when annmex was called. The crash log mentioned a segmentation violation error, I pasted a sample of the log below in case it is useful. I downgraded Matlab to its previous version (2023a) and it seems to have fixed my issue.

MATLAB Log File: /Users/matlab_crash_dump.56205-1

------------------------------------------------
MATLAB Log File
------------------------------------------------ 

--------------------------------------------------------------------------------
          Segmentation violation detected at 2024-03-27 12:59:08 -0700
--------------------------------------------------------------------------------

Configuration:
  Crash Decoding           : Disabled - No sandbox or build area path
  Crash Mode               : continue (default)
  Default Encoding         : UTF-8
  Deployed                 : false
  Graphics Driver          : Apple Apple M1 Max Version 2.1 Metal - 88
  MATLAB Architecture      : maca64
   MATLAB Version           : 23.2.0.2428915 (R2023b) Update 4
  Operating System         : Mac OS Version 14.4
  Processor ID             : ABI64 ARM ARM64E FIRESTORM_ICESTORM

Fault Count: 1

Abnormal termination:
Segmentation violation

[...]

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.