MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / string_to_kernel

Function string_to_kernel

ibtk/src/lagrangian/LEInteractor.cpp:1923–2016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1921};
1922
1923KernelType
1924string_to_kernel(const std::string& kernel_fcn)
1925{
1926 // Some IBAMR applications want to call this function *a lot*, e.g., ideally
1927 // we would call this on every element in a finite element mesh instead of
1928 // batching with huge temporary arrays. Hence doing all these string
1929 // comparisons can get surprisingly expensive. Chop them up first with a
1930 // switch statement.
1931#ifndef NDEBUG
1932 if (!LEInteractor::isKnownKernel(kernel_fcn))
1933 {
1934 TBOX_ERROR("Unknown kernel function " << kernel_fcn << std::endl);
1935 return INVALID;
1936 }
1937#endif
1938 switch (kernel_fcn.front())
1939 {
1940 // BSPLINE family
1941 case 'B':
1942 {
1943 switch (kernel_fcn.back())
1944 {
1945 case '3':
1946 return BSPLINE_3;
1947 case '4':
1948 return BSPLINE_4;
1949 case '5':
1950 return BSPLINE_5;
1951 case '6':
1952 return BSPLINE_6;
1953 }
1954 break;
1955 }
1956 // COMPOSITE_BSPLINE family
1957 case 'C':
1958 {
1959 switch (kernel_fcn.back())
1960 {
1961 case '2':
1962 return COMPOSITE_BSPLINE_32;
1963 case '3':
1964 return kernel_fcn[18] == '4' ? COMPOSITE_BSPLINE_43 : COMPOSITE_BSPLINE_23;
1965 case '4':
1966 return kernel_fcn[18] == '5' ? COMPOSITE_BSPLINE_54 : COMPOSITE_BSPLINE_34;
1967 case '5':
1968 return kernel_fcn[18] == '6' ? COMPOSITE_BSPLINE_65 : COMPOSITE_BSPLINE_45;
1969 case '6':
1970 return COMPOSITE_BSPLINE_56;
1971 }
1972 break;
1973 }
1974 // DISCONTINUOUS family
1975 case 'D':
1976 {
1977 return DISCONTINUOUS_LINEAR;
1978 }
1979 // PIECEWISE family
1980 case 'P':

Callers 3

getStencilSizeMethod · 0.85
interpolateMethod · 0.85
spreadMethod · 0.85

Calls 3

frontMethod · 0.45
backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected