Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Julia Docampo Sanchez
Nektar
Commits
72cad2e3
Commit
72cad2e3
authored
Aug 01, 2017
by
Julia Docampo Sanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed to work with latest nektar version
parent
49ab3b77
Changes
74
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
74 changed files
with
46759 additions
and
2 deletions
+46759
-2
library/CMakeLists.txt
library/CMakeLists.txt
+1
-1
library/LSIAC/BSplines.h
library/LSIAC/BSplines.h
+96
-0
library/LSIAC/CMakeLists.txt
library/LSIAC/CMakeLists.txt
+77
-0
library/LSIAC/CMakeLists.txt.user
library/LSIAC/CMakeLists.txt.user
+63
-0
library/LSIAC/CentralBSplines.cpp
library/LSIAC/CentralBSplines.cpp
+55
-0
library/LSIAC/CentralBSplines.h
library/LSIAC/CentralBSplines.h
+46
-0
library/LSIAC/GeneralBSplines.cpp
library/LSIAC/GeneralBSplines.cpp
+160
-0
library/LSIAC/GeneralBSplines.h
library/LSIAC/GeneralBSplines.h
+64
-0
library/LSIAC/HandleMesh.h
library/LSIAC/HandleMesh.h
+31
-0
library/LSIAC/HandleNekMesh.cpp
library/LSIAC/HandleNekMesh.cpp
+413
-0
library/LSIAC/HandleNekMesh.h
library/LSIAC/HandleNekMesh.h
+309
-0
library/LSIAC/HandleNekMesh1D.cpp
library/LSIAC/HandleNekMesh1D.cpp
+186
-0
library/LSIAC/HandleNekMesh1D.h
library/LSIAC/HandleNekMesh1D.h
+39
-0
library/LSIAC/HandleNekMesh2D.cpp
library/LSIAC/HandleNekMesh2D.cpp
+159
-0
library/LSIAC/HandleNekMesh2D.h
library/LSIAC/HandleNekMesh2D.h
+56
-0
library/LSIAC/HandleNekMesh3D.cpp
library/LSIAC/HandleNekMesh3D.cpp
+444
-0
library/LSIAC/HandleNekMesh3D.h
library/LSIAC/HandleNekMesh3D.h
+94
-0
library/LSIAC/LSIACPostProcessor.cpp
library/LSIAC/LSIACPostProcessor.cpp
+171
-0
library/LSIAC/LSIACPostProcessor.h
library/LSIAC/LSIACPostProcessor.h
+60
-0
library/LSIAC/LocDifferentiation.cpp
library/LSIAC/LocDifferentiation.cpp
+182
-0
library/LSIAC/LocDifferentiation.h
library/LSIAC/LocDifferentiation.h
+21
-0
library/LSIAC/OneSidedKernel.cpp
library/LSIAC/OneSidedKernel.cpp
+108
-0
library/LSIAC/OneSidedKernel.h
library/LSIAC/OneSidedKernel.h
+47
-0
library/LSIAC/SIACFilter.cpp
library/LSIAC/SIACFilter.cpp
+360
-0
library/LSIAC/SIACFilter.h
library/LSIAC/SIACFilter.h
+114
-0
library/LSIAC/SIACFilter1D.cpp
library/LSIAC/SIACFilter1D.cpp
+51
-0
library/LSIAC/SIACFilter1D.h
library/LSIAC/SIACFilter1D.h
+33
-0
library/LSIAC/SIACFilter2D.cpp
library/LSIAC/SIACFilter2D.cpp
+112
-0
library/LSIAC/SIACFilter2D.h
library/LSIAC/SIACFilter2D.h
+54
-0
library/LSIAC/SIACFilter3D.cpp
library/LSIAC/SIACFilter3D.cpp
+125
-0
library/LSIAC/SIACFilter3D.h
library/LSIAC/SIACFilter3D.h
+75
-0
library/LSIAC/SIACKernel.cpp
library/LSIAC/SIACKernel.cpp
+249
-0
library/LSIAC/SIACKernel.h
library/LSIAC/SIACKernel.h
+112
-0
library/LSIAC/SIACenumerators.h
library/LSIAC/SIACenumerators.h
+124
-0
library/LSIAC/SIACpostprocessor.h
library/LSIAC/SIACpostprocessor.h
+25
-0
library/LSIAC/SmoothieSIAC_debug.cpp
library/LSIAC/SmoothieSIAC_debug.cpp
+385
-0
library/LSIAC/SymmetricKernel.cpp
library/LSIAC/SymmetricKernel.cpp
+125
-0
library/LSIAC/SymmetricKernel.h
library/LSIAC/SymmetricKernel.h
+42
-0
library/LSIAC/fieldDerivatives.cpp
library/LSIAC/fieldDerivatives.cpp
+80
-0
library/LSIAC/mk2.txt
library/LSIAC/mk2.txt
+68
-0
library/LSIAC/ppio.cpp
library/LSIAC/ppio.cpp
+76
-0
library/LibUtilities/LinearAlgebra/Lapack.hpp
library/LibUtilities/LinearAlgebra/Lapack.hpp
+3
-0
utilities/CMakeLists.txt
utilities/CMakeLists.txt
+2
-1
utilities/LSIACutil/CMakeLists.txt
utilities/LSIACutil/CMakeLists.txt
+47
-0
utilities/LSIACutil/NektarFiles/adrsolver_conditions_p1_40.xml
...ties/LSIACutil/NektarFiles/adrsolver_conditions_p1_40.xml
+59
-0
utilities/LSIACutil/NektarFiles/adrsolver_conditions_p2_40.xml
...ties/LSIACutil/NektarFiles/adrsolver_conditions_p2_40.xml
+59
-0
utilities/LSIACutil/NektarFiles/p1_40x40.fld
utilities/LSIACutil/NektarFiles/p1_40x40.fld
+16
-0
utilities/LSIACutil/NektarFiles/p1_40x40.xml
utilities/LSIACutil/NektarFiles/p1_40x40.xml
+6590
-0
utilities/LSIACutil/NektarFiles/p1_40x40_cropped_20x20.xml
utilities/LSIACutil/NektarFiles/p1_40x40_cropped_20x20.xml
+1711
-0
utilities/LSIACutil/NektarFiles/p2_40x40.fld
utilities/LSIACutil/NektarFiles/p2_40x40.fld
+16
-0
utilities/LSIACutil/NektarFiles/p2_40x40.xml
utilities/LSIACutil/NektarFiles/p2_40x40.xml
+6590
-0
utilities/LSIACutil/NektarFiles/p2_40x40_cropped_20x20.xml
utilities/LSIACutil/NektarFiles/p2_40x40_cropped_20x20.xml
+1711
-0
utilities/LSIACutil/Tests/2Dtrimesh.fld
utilities/LSIACutil/Tests/2Dtrimesh.fld
+13
-0
utilities/LSIACutil/Tests/2Dtrimesh.vtu
utilities/LSIACutil/Tests/2Dtrimesh.vtu
+3245
-0
utilities/LSIACutil/Tests/2Dtrimesh.xml
utilities/LSIACutil/Tests/2Dtrimesh.xml
+326
-0
utilities/LSIACutil/Tests/2DtrimeshNU.fld
utilities/LSIACutil/Tests/2DtrimeshNU.fld
+13
-0
utilities/LSIACutil/Tests/2DtrimeshNU.vtu
utilities/LSIACutil/Tests/2DtrimeshNU.vtu
+8573
-0
utilities/LSIACutil/Tests/2DtrimeshNU.xml
utilities/LSIACutil/Tests/2DtrimeshNU.xml
+1103
-0
utilities/LSIACutil/Tests/2DtrimeshNU.xml~
utilities/LSIACutil/Tests/2DtrimeshNU.xml~
+1107
-0
utilities/LSIACutil/Tests/DG.dat
utilities/LSIACutil/Tests/DG.dat
+3024
-0
utilities/LSIACutil/Tests/DG.fld
utilities/LSIACutil/Tests/DG.fld
+13
-0
utilities/LSIACutil/Tests/DG_error.fld
utilities/LSIACutil/Tests/DG_error.fld
+13
-0
utilities/LSIACutil/Tests/LOG.dat
utilities/LSIACutil/Tests/LOG.dat
+27
-0
utilities/LSIACutil/Tests/PP.dat
utilities/LSIACutil/Tests/PP.dat
+3024
-0
utilities/LSIACutil/Tests/PP.fld
utilities/LSIACutil/Tests/PP.fld
+13
-0
utilities/LSIACutil/Tests/PP_error.fld
utilities/LSIACutil/Tests/PP_error.fld
+13
-0
utilities/LSIACutil/Tests/gmon.out
utilities/LSIACutil/Tests/gmon.out
+0
-0
utilities/LSIACutil/Tests/lsiac_filtering.tst
utilities/LSIACutil/Tests/lsiac_filtering.tst
+15
-0
utilities/LSIACutil/Tests/test2.fld
utilities/LSIACutil/Tests/test2.fld
+13
-0
utilities/LSIACutil/Tests/test2.vtu
utilities/LSIACutil/Tests/test2.vtu
+3461
-0
utilities/LSIACutil/Tests/test2.xml
utilities/LSIACutil/Tests/test2.xml
+325
-0
utilities/LSIACutil/l2_linf_errors.cpp
utilities/LSIACutil/l2_linf_errors.cpp
+205
-0
utilities/LSIACutil/lsiac_filtering.cpp
utilities/LSIACutil/lsiac_filtering.cpp
+286
-0
utilities/LSIACutil/modestest.cpp
utilities/LSIACutil/modestest.cpp
+51
-0
No files found.
library/CMakeLists.txt
View file @
72cad2e3
# Main library sub-directories, required by all of Nektar++.
SUBDIRS
(
GlobalMapping LibUtilities LocalRegions Collections MultiRegions
SpatialDomains StdRegions
)
SpatialDomains StdRegions
LSIAC
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/library
)
IF
(
NEKTAR_BUILD_UNIT_TESTS
)
...
...
library/LSIAC/BSplines.h
0 → 100644
View file @
72cad2e3
#ifndef LSIAC_BSPLINES_H
#define LSIAC_BSPLINES_H
#include <iostream>
#include <vector>
#include "LSIACPostProcessor.h"
using
namespace
std
;
/// This class is the base class for all the B-Splines.
/** This class is useful when dynmaically creating object of its subclasses.
All the BSplines need by the fitler would be subclasses of this filter.
*/
namespace
Nektar
{
namespace
LSIAC
{
class
BSplines
:
public
LSIACPostProcessor
{
protected:
public:
};
/*
class GeneralBSplines: public BSplines{
// data
public:
vector<double>* m_knotVector;
int m_Order;
// functions
public:
GeneralBSplines(const vector<double> knots,const int order)
{
m_knotVector = new vector<double>(0);
SetKnotVector(knots);
SetOrder(order);
}
bool SetKnotVector(vector<double> knots)
{
this->m_knotVector->clear();
this->m_knotVector->resize(knots.size());
this->m_knotVector->assign(knots.begin(),knots.end());
return true;
}
bool GetKnotVector ( vector<double> &knots)
{
knots = *m_knotVector;
return true; }
bool SetOrder(int order)
{
m_Order = order;
return true; }
int GetOrder() const
{return m_Order; }
bool EvaluateBSplines(const vector<double> t_pos,const vector<double> knots,
vector<double> &t_values)
{return true; }
bool EvaluateBSplines (const vector<double> t_pos, vector<double> &t_values)const
{return true; }
};
int main()
{
cout << " Enterend into main functions " << endl;
double mydoubles[] = { 0.0, 1.0, 2.0, 3.0, 4.0};
vector<double> knots(mydoubles, mydoubles + sizeof(mydoubles)/sizeof(double));
GeneralBSplines gsp(knots, 3);
cout << gsp.m_knotVector->at(3)<< endl;
cout << knots.size()<< endl;
vector<double> *knotsout;
gsp.GetKnotVector(*knotsout);
knotsout->at(3) = 10;
cout << knotsout->size()<< endl;
cout << knotsout->at(0)<< endl;
cout << knotsout->at(1)<< endl;
cout << knotsout->at(2)<< endl;
cout << knotsout->at(3)<< endl;
cout << gsp.m_knotVector->at(3)<< endl;
return 1;
}
*/
}
}
#endif
library/LSIAC/CMakeLists.txt
0 → 100644
View file @
72cad2e3
SET
(
LSIAC_SOURCES
fieldDerivatives.cpp
LSIACPostProcessor.cpp
GeneralBSplines.cpp
CentralBSplines.cpp
SIACKernel.cpp
SymmetricKernel.cpp
OneSidedKernel.cpp
HandleNekMesh.cpp
HandleNekMesh1D.cpp
HandleNekMesh2D.cpp
HandleNekMesh3D.cpp
SIACFilter.cpp
SIACFilter1D.cpp
SIACFilter2D.cpp
SIACFilter3D.cpp
ppio.cpp
)
SET
(
LSIAC_HEADERS
LSIACPostProcessor.h
SIACenumerators.h
GeneralBSplines.h
CentralBSplines.h
SIACKernel.h
SymmetricKernel.h
OneSidedKernel.h
HandleMesh.h
HandleNekMesh.h
HandleNekMesh1D.h
HandleNekMesh2D.h
HandleNekMesh3D.h
SIACpostprocessor.h
SIACFilter.h
SIACFilter1D.h
SIACFilter2D.h
SIACFilter3D.h
)
ADD_DEFINITIONS
(
-DLSIAC_EXPORTS
)
ADD_NEKTAR_LIBRARY
(
LSIAC
SOURCES
${
LSIAC_SOURCES
}
HEADERS
${
LSIAC_HEADERS
}
SUMMARY
"LSIAC Filtering library"
DESCRIPTION
"This library implements the LSIAC postprocessor for 2D and 3D fields. Contains the kernel class aswell as the mesh interaction functions."
)
#TARGET_LINK_LIBRARIES(LSIAC LINK_PUBLIC Collections)
INSTALL
(
DIRECTORY ./ DESTINATION
${
NEKTAR_INCLUDE_DIR
}
/LSIAC COMPONENT dev FILES_MATCHING PATTERN
"*.h"
PATTERN
"*.hpp"
)
library/LSIAC/CMakeLists.txt.user
0 → 100644
View file @
72cad2e3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2017-07-05T11:26:18. -->
<qtcreator>
<data>
<variable>
ProjectExplorer.Project.ActiveTarget
</variable>
<value
type=
"int"
>
-1
</value>
</data>
<data>
<variable>
ProjectExplorer.Project.EditorSettings
</variable>
<valuemap
type=
"QVariantMap"
>
<value
type=
"bool"
key=
"EditorConfiguration.AutoIndent"
>
true
</value>
<value
type=
"bool"
key=
"EditorConfiguration.AutoSpacesForTabs"
>
false
</value>
<value
type=
"bool"
key=
"EditorConfiguration.CamelCaseNavigation"
>
true
</value>
<valuemap
type=
"QVariantMap"
key=
"EditorConfiguration.CodeStyle.0"
>
<value
type=
"QString"
key=
"language"
>
Cpp
</value>
<valuemap
type=
"QVariantMap"
key=
"value"
>
<value
type=
"QByteArray"
key=
"CurrentPreferences"
>
CppGlobal
</value>
</valuemap>
</valuemap>
<valuemap
type=
"QVariantMap"
key=
"EditorConfiguration.CodeStyle.1"
>
<value
type=
"QString"
key=
"language"
>
QmlJS
</value>
<valuemap
type=
"QVariantMap"
key=
"value"
>
<value
type=
"QByteArray"
key=
"CurrentPreferences"
>
QmlJSGlobal
</value>
</valuemap>
</valuemap>
<value
type=
"int"
key=
"EditorConfiguration.CodeStyle.Count"
>
2
</value>
<value
type=
"QByteArray"
key=
"EditorConfiguration.Codec"
>
UTF-8
</value>
<value
type=
"bool"
key=
"EditorConfiguration.ConstrainTooltips"
>
false
</value>
<value
type=
"int"
key=
"EditorConfiguration.IndentSize"
>
4
</value>
<value
type=
"bool"
key=
"EditorConfiguration.KeyboardTooltips"
>
false
</value>
<value
type=
"bool"
key=
"EditorConfiguration.MouseNavigation"
>
true
</value>
<value
type=
"int"
key=
"EditorConfiguration.PaddingMode"
>
1
</value>
<value
type=
"bool"
key=
"EditorConfiguration.ScrollWheelZooming"
>
true
</value>
<value
type=
"int"
key=
"EditorConfiguration.SmartBackspaceBehavior"
>
1
</value>
<value
type=
"bool"
key=
"EditorConfiguration.SpacesForTabs"
>
true
</value>
<value
type=
"int"
key=
"EditorConfiguration.TabKeyBehavior"
>
2
</value>
<value
type=
"int"
key=
"EditorConfiguration.TabSize"
>
8
</value>
<value
type=
"bool"
key=
"EditorConfiguration.UseGlobal"
>
true
</value>
<value
type=
"int"
key=
"EditorConfiguration.Utf8BomBehavior"
>
1
</value>
<value
type=
"bool"
key=
"EditorConfiguration.addFinalNewLine"
>
true
</value>
<value
type=
"bool"
key=
"EditorConfiguration.cleanIndentation"
>
true
</value>
<value
type=
"bool"
key=
"EditorConfiguration.cleanWhitespace"
>
true
</value>
<value
type=
"bool"
key=
"EditorConfiguration.inEntireDocument"
>
false
</value>
</valuemap>
</data>
<data>
<variable>
ProjectExplorer.Project.PluginSettings
</variable>
<valuemap
type=
"QVariantMap"
/>
</data>
<data>
<variable>
ProjectExplorer.Project.TargetCount
</variable>
<value
type=
"int"
>
0
</value>
</data>
<data>
<variable>
ProjectExplorer.Project.Updater.EnvironmentId
</variable>
<value
type=
"QByteArray"
>
{a578d475-18b0-40f9-843f-5eee755f73a3}
</value>
</data>
<data>
<variable>
ProjectExplorer.Project.Updater.FileVersion
</variable>
<value
type=
"int"
>
15
</value>
</data>
</qtcreator>
library/LSIAC/CentralBSplines.cpp
0 → 100644
View file @
72cad2e3
#include "CentralBSplines.h"
namespace
Nektar
{
namespace
LSIAC
{
CentralBSplines
::
CentralBSplines
(
int
Order
,
NekDouble
Shift
,
NekDouble
scale
)
:
GeneralBSplines
(
Order
),
m_shift
(
Shift
),
m_scale
(
scale
)
{
Array
<
OneD
,
NekDouble
>
knots
(
Order
+
1
,
0.0
);
for
(
int
i
=
0
;
i
<
Order
+
1
;
i
++
)
{
knots
[
i
]
=
-
Order
/
2.0
+
i
;
}
this
->
SetKnotVector
(
knots
);
GeneralBSplines
::
SetKnotVector
(
knots
);
}
CentralBSplines
::
CentralBSplines
(
int
Order
)
:
GeneralBSplines
(
Order
),
m_shift
(
0.0
),
m_scale
(
1.0
)
{
Array
<
OneD
,
NekDouble
>
knots
(
Order
+
1
,
0.0
);
for
(
int
i
=
0
;
i
<
Order
+
1
;
i
++
)
{
knots
[
i
]
=
-
Order
/
2.0
+
i
;
}
this
->
SetKnotVector
(
knots
);
GeneralBSplines
::
SetKnotVector
(
knots
);
}
CentralBSplines
::
CentralBSplines
(
int
Order
,
NekDouble
shift
)
:
GeneralBSplines
(
Order
),
m_shift
(
shift
),
m_scale
(
1.0
)
{
Array
<
OneD
,
NekDouble
>
knots
(
Order
+
1
,
0.0
);
for
(
int
i
=
0
;
i
<
Order
+
1
;
i
++
)
{
knots
[
i
]
=
-
Order
/
2.0
+
i
;
}
this
->
SetKnotVector
(
knots
);
GeneralBSplines
::
SetKnotVector
(
knots
);
}
bool
CentralBSplines
::
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
Array
<
OneD
,
NekDouble
>
&
t_val
,
const
NekDouble
shift
,
const
NekDouble
meshScaling
)
const
{
//For central BSplines. The j is always zero.
//The spline needs to be shifted and evaluated at x_pos locations.
int
nq
=
t_pos
.
num_elements
();
GeneralBSplines
::
EvaluateBSplines
(
t_pos
,
0
,
t_val
,
shift
,
meshScaling
);
return
true
;
}
}
}
library/LSIAC/CentralBSplines.h
0 → 100644
View file @
72cad2e3
#ifndef LSIAC_CENTRALBSPLINES_H
#define LSIAC_CENTRALBSPLINES_H
#include "GeneralBSplines.h"
/// The class evaluates CentralB-Splines at given locations.
/** This calss automatically calculates knot positions, when using the order specified.
All the knot positions calcualted will range -(k+1)/2 to k+1)/2
*/
namespace
Nektar
{
namespace
LSIAC
{
class
CentralBSplines
:
public
GeneralBSplines
{
private:
protected:
public:
NekDouble
m_shift
;
NekDouble
m_scale
;
CentralBSplines
(
int
Order
);
CentralBSplines
(
int
Order
,
NekDouble
shift
);
CentralBSplines
(
int
Order
,
NekDouble
shift
,
NekDouble
scale
);
bool
GetShift
(
NekDouble
&
shift
)
const
;
bool
SetShift
(
NekDouble
shift
);
bool
GetScale
(
NekDouble
&
scale
)
const
;
bool
SetScale
(
NekDouble
scale
);
bool
SetOrder
(
int
Order
);
int
GetOrder
(
)
const
;
// bool EvaluateBSplines( const Array<OneD,NekDouble> &t_pos,const NekDouble shift, Array<OneD,NekDouble> &t_vals)const;
bool
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
Array
<
OneD
,
NekDouble
>
&
t_vals
,
const
NekDouble
shift
=
0.0
,
const
NekDouble
meshScaling
=
1.0
)
const
;
// bool EvaluateBSplines( Array<OneD,NekDouble> &t_pos, Array<OneD,NekDouble> &t_vals);
};
}
}
#endif
library/LSIAC/GeneralBSplines.cpp
0 → 100644
View file @
72cad2e3
#include "GeneralBSplines.h"
namespace
Nektar
{
namespace
LSIAC
{
GeneralBSplines
::
GeneralBSplines
(
const
int
order
)
{
this
->
SetOrder
(
order
);
}
GeneralBSplines
::
GeneralBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
knots
,
const
int
order
)
{
this
->
SetKnotVector
(
knots
);
this
->
SetOrder
(
order
);
}
bool
GeneralBSplines
::
SetKnotVector
(
const
Array
<
OneD
,
NekDouble
>
&
knots
)
{
this
->
m_knotVector
=
knots
;
return
true
;
}
bool
GeneralBSplines
::
GetKnotVector
(
Array
<
OneD
,
NekDouble
>
&
knots
)
{
knots
=
this
->
m_knotVector
;
return
true
;
}
int
GeneralBSplines
::
GetOrder
()
const
{
return
this
->
m_order
;
}
bool
GeneralBSplines
::
SetOrder
(
const
int
order
)
{
this
->
m_order
=
order
;
return
true
;
}
bool
GeneralBSplines
::
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
std
::
vector
<
NekDouble
>
&
kvec
,
const
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
,
const
NekDouble
shift
,
const
NekDouble
meshScaling
)
const
{
return
BSplinesBasis
(
t_pos
,
kvec
,
m_order
-
1
,
j_th
,
t_values
,
shift
,
meshScaling
);
}
bool
GeneralBSplines
::
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
,
const
NekDouble
shift
,
const
NekDouble
meshScaling
)
const
{
BSplinesBasis
(
t_pos
,
m_order
-
1
,
j_th
,
t_values
,
shift
,
meshScaling
);
return
true
;
}
bool
GeneralBSplines
::
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
Array
<
OneD
,
NekDouble
>
&
knots
,
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
)
{
cout
<<
"This is stub. Need to be coded."
<<
endl
;
return
true
;
}
bool
GeneralBSplines
::
BSplinesBasis
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
int
k
,
const
int
j
,
Array
<
OneD
,
NekDouble
>
&
t_val
,
const
NekDouble
shift
,
const
NekDouble
meshScaling
)
const
{
// Note here Order of BSplines are k+1.
// This is done to follow the paper. Sorry if causes confusion.
if
(
0
==
k
)
{
if
(
j
>=
0
&&
m_knotVector
.
num_elements
()
-
1
){
for
(
int
i
=
0
;
i
<
t_pos
.
num_elements
();
i
++
)
{
//if( (t_pos[i]/meshScaling-shift >= m_knotVector[j]) & (t_pos[i]/meshScaling-shift < m_knotVector[j+1]))
if
(
(
(
t_pos
[
i
]
-
shift
)
/
meshScaling
>=
m_knotVector
[
j
])
&
(
(
t_pos
[
i
]
-
shift
)
/
meshScaling
<
m_knotVector
[
j
+
1
]))
{
t_val
[
i
]
=
1.0
;
}
else
{
t_val
[
i
]
=
0.0
;
}
}
}
else
{
//Add Assert here. Should not come here.
printf
(
"Add Asset here"
);
}
}
else
{
NekDouble
x_eval
,
w_jlt
,
w_jlt1
;
Array
<
OneD
,
NekDouble
>
Bspl_k1_j
,
Bspl_k1_j1
;
Bspl_k1_j
=
Array
<
OneD
,
NekDouble
>
(
t_pos
.
num_elements
(),
0.0
);
Bspl_k1_j1
=
Array
<
OneD
,
NekDouble
>
(
t_pos
.
num_elements
(),
0.0
);
this
->
BSplinesBasis
(
t_pos
,
k
-
1
,
j
,
Bspl_k1_j
,
shift
,
meshScaling
);
this
->
BSplinesBasis
(
t_pos
,
k
-
1
,
j
+
1
,
Bspl_k1_j1
,
shift
,
meshScaling
);
for
(
int
i
=
0
;
i
<
t_pos
.
num_elements
();
i
++
)
{
//x_eval = t_pos[i]/meshScaling-shift;
x_eval
=
(
t_pos
[
i
]
-
shift
)
/
meshScaling
;
if
(
abs
(
m_knotVector
[
j
+
k
]
-
m_knotVector
[
j
])
<=
1e-8
){
w_jlt
=
0.0
;
}
else
{
w_jlt
=
(
x_eval
-
m_knotVector
[
j
]
)
/
(
m_knotVector
[
j
+
k
]
-
m_knotVector
[
j
]);
}
if
(
abs
(
m_knotVector
[
j
+
k
+
1
]
-
m_knotVector
[
j
+
1
])
<=
1e-8
){
w_jlt1
=
0.0
;
}
else
{
w_jlt1
=
(
x_eval
-
m_knotVector
[
j
+
1
]
)
/
(
m_knotVector
[
j
+
k
+
1
]
-
m_knotVector
[
j
+
1
]);
}
t_val
[
i
]
=
w_jlt
*
Bspl_k1_j
[
i
]
+
(
1
-
w_jlt1
)
*
Bspl_k1_j1
[
i
];
}
}
return
true
;
}
bool
GeneralBSplines
::
BSplinesBasis
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
vector
<
NekDouble
>
&
kVec
,
const
int
k
,
const
int
j
,
Array
<
OneD
,
NekDouble
>
&
t_val
,
const
NekDouble
shift
,
const
NekDouble
meshScaling
)
const
{
// Note here Order of BSplines are k+1.
// This is done to follow the paper. Sorry if causes confusion.
if
(
0
==
k
)
{
if
(
j
>=
0
&&
kVec
.
size
()
-
1
){
for
(
int
i
=
0
;
i
<
t_pos
.
num_elements
();
i
++
)
{
if
(
(
(
t_pos
[
i
]
-
shift
)
/
meshScaling
>=
kVec
[
j
])
&
(
(
t_pos
[
i
]
-
shift
)
/
meshScaling
<
kVec
[
j
+
1
]))
{
t_val
[
i
]
=
1.0
;
}
else
{
t_val
[
i
]
=
0.0
;
}
}
}
else
{
//Add Assert here. Should not come here.
printf
(
"Add Asset here"
);
}
}
else
{
NekDouble
x_eval
,
w_jlt
,
w_jlt1
;
Array
<
OneD
,
NekDouble
>
Bspl_k1_j
,
Bspl_k1_j1
;
Bspl_k1_j
=
Array
<
OneD
,
NekDouble
>
(
t_pos
.
num_elements
(),
0.0
);
Bspl_k1_j1
=
Array
<
OneD
,
NekDouble
>
(
t_pos
.
num_elements
(),
0.0
);
this
->
BSplinesBasis
(
t_pos
,
kVec
,
k
-
1
,
j
,
Bspl_k1_j
,
shift
,
meshScaling
);
this
->
BSplinesBasis
(
t_pos
,
kVec
,
k
-
1
,
j
+
1
,
Bspl_k1_j1
,
shift
,
meshScaling
);
for
(
int
i
=
0
;
i
<
t_pos
.
num_elements
();
i
++
)
{
//x_eval = t_pos[i]/meshScaling-shift;
x_eval
=
(
t_pos
[
i
]
-
shift
)
/
meshScaling
;
if
(
abs
(
kVec
[
j
+
k
]
-
kVec
[
j
])
<=
1e-8
){
w_jlt
=
0.0
;
}
else
{
w_jlt
=
(
x_eval
-
kVec
[
j
]
)
/
(
kVec
[
j
+
k
]
-
kVec
[
j
]);
}
if
(
abs
(
kVec
[
j
+
k
+
1
]
-
kVec
[
j
+
1
])
<=
1e-8
){
w_jlt1
=
0.0
;
}
else
{
w_jlt1
=
(
x_eval
-
kVec
[
j
+
1
]
)
/
(
kVec
[
j
+
k
+
1
]
-
kVec
[
j
+
1
]);
}
t_val
[
i
]
=
w_jlt
*
Bspl_k1_j
[
i
]
+
(
1
-
w_jlt1
)
*
Bspl_k1_j1
[
i
];
}
}
return
true
;
}
}
}
library/LSIAC/GeneralBSplines.h
0 → 100644
View file @
72cad2e3
#ifndef LSIAC_GENERALBSPLINES_H
#define LSIAC_GENERALBSPLINES_H
#include <iostream>
#include <vector>
#include "BSplines.h"
/// This class evaluates any general BSplines at given location when knots and order are specified.
/** To evaluate General BSplines at any location, one needs knots and Order of Bsplines.
*/
namespace
Nektar
{
namespace
LSIAC
{
class
GeneralBSplines
:
public
BSplines
{
// data
public:
Array
<
OneD
,
NekDouble
>
m_knotVector
;
int
m_order
;
// functions
private:
bool
BSplinesBasis
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
int
k
,
const
int
j
,
Array
<
OneD
,
NekDouble
>
&
t_val
,
const
NekDouble
scaling
=
0.0
,
const
NekDouble
meshScaling
=
1.0
)
const
;
bool
BSplinesBasis
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
vector
<
NekDouble
>
&
kvector
,
const
int
k
,
const
int
j
,
Array
<
OneD
,
NekDouble
>
&
t_val
,
const
NekDouble
scaling
=
0.0
,
const
NekDouble
meshScaling
=
1.0
)
const
;
protected:
public:
GeneralBSplines
(
const
int
order
);
GeneralBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
knots
,
const
int
order
);
bool
SetKnotVector
(
const
Array
<
OneD
,
NekDouble
>
&
knots
);
bool
GetKnotVector
(
Array
<
OneD
,
NekDouble
>
&
knots
);
bool
SetOrder
(
const
int
order
);
int
GetOrder
()
const
;
//Not used yet!
bool
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
Array
<
OneD
,
NekDouble
>
&
knots
,
const
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
);
//Not used yet!
bool
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
Array
<
OneD
,
NekDouble
>
&
knots
,
const
int
j_th
,
const
NekDouble
shift
,
Array
<
OneD
,
NekDouble
>
&
t_values
);
bool
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
,
const
NekDouble
shift
=
0.0
,
const
NekDouble
meshScaling
=
1.0
)
const
;
bool
EvaluateBSplines
(
const
Array
<
OneD
,
NekDouble
>
&
t_pos
,
const
std
::
vector
<
NekDouble
>
&
kvec
,
const
int
j_th
,
Array
<
OneD
,
NekDouble
>
&
t_values
,
const
NekDouble
shift
=
0.0
,
const
NekDouble
meshScaling
=
1.0
)
const
;
};
}
}
#endif
library/LSIAC/HandleMesh.h
0 → 100644
View file @
72cad2e3
#ifndef HANDLEMESH_H
#define HANDLEMESH_H
#include <iostream>
#include <vector>
#include <string>