patnr / fm Goto Github PK
View Code? Open in Web Editor NEWFast Marching (FM) method implementation in Matlab and C++
License: MIT License
Fast Marching (FM) method implementation in Matlab and C++
License: MIT License
Hi, Patrick! When I run CompileMexFile.m. The error shows in the following.
/home/users3/fx592/3D eikonal equation/utils.cpp: In function ‘mxArray* myCreateIntScalar()’:
/home/users3/fx592/3D eikonal equation/utils.cpp:129:67: error: cannot convert ‘int*’ to ‘const mwSize* {aka const
long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray_730(mwSize, const mwSize*, mxClassID,
mxComplexity)’
return mxCreateNumericArray(1,dimsOfAScalar,mxINT32_CLASS,mxREAL);
I revise the function into the following
mxArray * myCreateIntScalar() {
mwSize dimsOfAScalar[2] = {1,1};
return mxCreateNumericArray(1,dimsOfAScalar,mxINT32_CLASS,mxREAL);
}
I change int into mwSize. Finallly, I can get through it.
Could you confirm and explain this? I just want to make sure.
Thank you
Timothy
Hi I am trying to run the example TS_strata.m but I get the following error:
Error in fm (line 208)
[T eFlag] = fm2dc(F,SourcePoints,dy,dx,opts.order);
Error in TS_strata (line 26)
T4 = fm(F,SPs,Dxyz,struct('implementation','C++','order',2));
I am using Matlab 2021b
There appears to be a unit issue in the algorithm. The expression "time = min(xmin1, ymin1) + 1/Fij" implies that 1/Fij has the same units as the other quantities, which it does not. A possible correction is time = xmin1 + dx / Fij or time = ymin1 + dy / Fij, depending on whether xmin1 or ymin1 is smaller.
Line 312 in 029218c
Hi, I am running the following code (based on TS_maze.m example). It is a medium with varying velocity at the layers. The wavefields are calculated nicely. However, the ray trace function doesn't find the travelled path between the source and the receiver. I am I missing something?
The code is attached below.
`% code source: https://github.com/patnr/FM
%% Inputs
clc; clear;
addpath('./functions'); % Add path of functions for FMM
%% Meshing
h = 0.0041; % Step h
nx = 161; % Depth (z) nodes #
nz = 166; % Length (x) nodes #
lx = (nx-1)h; % LZ length m
lz = (nz-1)h; % LX Length (m)
%% Anisotropic velocity field
v0 = 1752.85; % Phase velocity
matrix = ones(nx,nz);
th = linspace(-180,180,nx);
alpha = (0.329ones(1,length(th))+ ... %Anisotropy parameter
0.1055cosd(th))./...
(0.329ones(1,length(th))+ 0.1055ones(1,length(th)));
V = (v0./alpha)'.*matrix; % Velocity field
SPs = [83;81]; % Source
RPs = [166;81]; % Receiver
%% Calculations V
T1 = fm(V,SPs,[1 1],struct('implementation','Matlab','order',2));
settings = struct('useFD',1,'stepSize',2);
path1 = rayTrace(T1,SPs,RPs,settings);
%% Plot
figure
contourf(flipud(T1),'DisplayName','Wavefronts');
hold on;
plot(path1(2,:),path1(1,:),'k','LineWidth',1,'DisplayName','Ray path');
plot(RPs(1),RPs(2),'sk','MarkerFaceColor','k','MarkerSize',14,'DisplayName','Receiver')
plot(SPs(1),SPs(2),'ok','MarkerFaceColor','k','MarkerSize',18,'DisplayName','Source')
lgd = legend;
lgd.NumColumns = 1;
lgd.Location='southeast';
hold off;
title('Wave fronts in an anisotropic medium');
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.