[asl] 06/177: Initial commit

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository asl.

commit c39215b9f5e7f36d6cdb33dbf6705011b121d95b
Author: Avtech Scientific <z.pekar at gmail.com>
Date:   Thu May 21 14:42:50 2015 +0300

    Initial commit
---
 CMakeLists.txt                                     |   47 +
 DefineFunctions.cmake                              |   26 +
 DefineOptions.cmake                                |    6 +
 LICENSE                                            |  661 +++++++
 README.md                                          |   51 +
 cmake/Modules/CMakeParseArguments.cmake            |  181 ++
 cmake/Modules/FindMATIO.cmake                      |  100 +
 cmake/Modules/FindOpenCL.cmake                     |  156 ++
 cmake/Modules/FindPackageHandleStandardArgs.cmake  |  402 ++++
 cmake/Modules/FindPackageMessage.cmake             |   77 +
 doc/Developer-Guide/Doxyfile.in                    | 1935 ++++++++++++++++++++
 src/CMakeLists.txt                                 |  106 ++
 src/acl/CMakeLists.txt                             |   67 +
 src/acl/DataTypes/aclArray.cxx                     |   44 +
 src/acl/DataTypes/aclArray.h                       |  136 ++
 src/acl/DataTypes/aclConstant.cxx                  |   83 +
 src/acl/DataTypes/aclConstant.h                    |   91 +
 src/acl/DataTypes/aclGroupID.cxx                   |   70 +
 src/acl/DataTypes/aclGroupID.h                     |   46 +
 src/acl/DataTypes/aclIndex.cxx                     |   70 +
 src/acl/DataTypes/aclIndex.h                       |   46 +
 src/acl/DataTypes/aclIndexExt.cxx                  |   82 +
 src/acl/DataTypes/aclIndexExt.h                    |   57 +
 src/acl/DataTypes/aclLocalArray.cxx                |   44 +
 src/acl/DataTypes/aclLocalArray.h                  |  121 ++
 src/acl/DataTypes/aclMemBlock.cxx                  |  152 ++
 src/acl/DataTypes/aclMemBlock.h                    |   79 +
 src/acl/DataTypes/aclPrivateArray.cxx              |   44 +
 src/acl/DataTypes/aclPrivateArray.h                |  131 ++
 src/acl/DataTypes/aclPrivateVariable.cxx           |   46 +
 src/acl/DataTypes/aclPrivateVariable.h             |  109 ++
 src/acl/DataTypes/aclSubvector.cxx                 |   46 +
 src/acl/DataTypes/aclSubvector.h                   |  143 ++
 src/acl/DataTypes/aclVariable.cxx                  |   58 +
 src/acl/DataTypes/aclVariable.h                    |  111 ++
 src/acl/DataTypes/aclVariableReference.cxx         |   61 +
 src/acl/DataTypes/aclVariableReference.h           |   97 +
 src/acl/DataTypes/aclVariableSP.cxx                |   58 +
 src/acl/DataTypes/aclVariableSP.h                  |   96 +
 src/acl/Kernels/aclExpressionContainer.cxx         |  103 ++
 src/acl/Kernels/aclExpressionContainer.h           |   69 +
 src/acl/Kernels/aclKernel.cxx                      |  362 ++++
 src/acl/Kernels/aclKernel.h                        |  116 ++
 src/acl/Kernels/aclKernelConfiguration.cxx         |   70 +
 src/acl/Kernels/aclKernelConfiguration.h           |   52 +
 .../Kernels/aclKernelConfigurationTemplates.cxx    |   36 +
 src/acl/Kernels/aclKernelConfigurationTemplates.h  |   45 +
 src/acl/Kernels/aclKernelMerger.cxx                |  184 ++
 src/acl/Kernels/aclKernelMerger.h                  |   76 +
 src/acl/Operators/CMakeLists.txt                   |   61 +
 src/acl/Operators/aclElementAssignmentSafe.cxx     |   53 +
 src/acl/Operators/aclElementAssignmentSafe.h       |   41 +
 src/acl/Operators/aclElementConvert.cxx            |   53 +
 src/acl/Operators/aclElementConvert.h              |   52 +
 src/acl/Operators/aclElementCos.cxx                |   45 +
 src/acl/Operators/aclElementCos.h                  |   43 +
 src/acl/Operators/aclElementDivision.cxx           |   53 +
 src/acl/Operators/aclElementDivision.h             |   42 +
 src/acl/Operators/aclElementExcerpt.cxx            |  101 +
 src/acl/Operators/aclElementExcerpt.h              |   55 +
 src/acl/Operators/aclElementFor.cxx                |  139 ++
 src/acl/Operators/aclElementFor.h                  |   55 +
 src/acl/Operators/aclElementGenericBinary.cxx      |   52 +
 src/acl/Operators/aclElementGenericBinary.h        |   55 +
 src/acl/Operators/aclElementGenericUnary.cxx       |   69 +
 src/acl/Operators/aclElementGenericUnary.h         |   53 +
 src/acl/Operators/aclElementIfElse.cxx             |  152 ++
 src/acl/Operators/aclElementIfElse.h               |   55 +
 src/acl/Operators/aclElementMad.cxx                |   37 +
 src/acl/Operators/aclElementMad.h                  |   43 +
 src/acl/Operators/aclElementParser.cxx             |  121 ++
 src/acl/Operators/aclElementParser.h               |   57 +
 src/acl/Operators/aclElementProduct.cxx            |   54 +
 src/acl/Operators/aclElementProduct.h              |   42 +
 src/acl/Operators/aclElementSelect.cxx             |   37 +
 src/acl/Operators/aclElementSelect.h               |   43 +
 src/acl/Operators/aclElementSin.cxx                |   44 +
 src/acl/Operators/aclElementSin.h                  |   42 +
 src/acl/Operators/aclElementSqrt.cxx               |   44 +
 src/acl/Operators/aclElementSqrt.h                 |   42 +
 src/acl/Operators/aclElementSubtraction.cxx        |   53 +
 src/acl/Operators/aclElementSubtraction.h          |   42 +
 src/acl/Operators/aclElementSum.cxx                |   53 +
 src/acl/Operators/aclElementSum.h                  |   41 +
 src/acl/Operators/aclElementSyncCopy.cxx           |  130 ++
 src/acl/Operators/aclElementSyncCopy.h             |   61 +
 src/acl/Operators/aclGenericAtomicFunction.cxx     |   45 +
 src/acl/Operators/aclGenericAtomicFunction.h       |   43 +
 src/acl/Operators/aclOperatorBinary.cxx            |   88 +
 src/acl/Operators/aclOperatorBinary.h              |   48 +
 src/acl/Operators/aclOperatorGeneric.cxx           |   74 +
 src/acl/Operators/aclOperatorGeneric.h             |   48 +
 src/acl/Operators/aclOperatorTernary.cxx           |   97 +
 src/acl/Operators/aclOperatorTernary.h             |   49 +
 src/acl/Operators/aclOperatorUnary.cxx             |   78 +
 src/acl/Operators/aclOperatorUnary.h               |   48 +
 src/acl/acl.cxx                                    |  726 ++++++++
 src/acl/acl.h                                      |  487 +++++
 src/acl/aclElementBase.cxx                         |   73 +
 src/acl/aclElementBase.h                           |   77 +
 src/acl/aclGenerators.cxx                          |  611 ++++++
 src/acl/aclGenerators.h                            |  190 ++
 src/acl/aclHardware.cxx                            |  246 +++
 src/acl/aclHardware.h                              |  151 ++
 src/acl/aclMath/CMakeLists.txt                     |   31 +
 src/acl/aclMath/aclBarycentric.cxx                 |  109 ++
 src/acl/aclMath/aclBarycentric.h                   |   57 +
 src/acl/aclMath/aclComplexNumOfElements.cxx        |  100 +
 src/acl/aclMath/aclComplexNumOfElements.h          |   81 +
 src/acl/aclMath/aclMathAlg.cxx                     |   97 +
 src/acl/aclMath/aclMathAlg.h                       |   75 +
 src/acl/aclMath/aclMatrixOfElements.cxx            |  538 ++++++
 src/acl/aclMath/aclMatrixOfElements.h              |  223 +++
 src/acl/aclMath/aclQuaternionOfElements.cxx        |  129 ++
 src/acl/aclMath/aclQuaternionOfElements.h          |   91 +
 src/acl/aclMath/aclReductionAlgGenerator.cxx       |  372 ++++
 src/acl/aclMath/aclReductionAlgGenerator.h         |   77 +
 src/acl/aclMath/aclVectorOfElements.h              |   31 +
 src/acl/aclMath/aclVectorOfElementsDef.cxx         |  184 ++
 src/acl/aclMath/aclVectorOfElementsDef.h           |  126 ++
 src/acl/aclMath/aclVectorOfElementsOperations.cxx  | 1248 +++++++++++++
 src/acl/aclMath/aclVectorOfElementsOperations.h    |  759 ++++++++
 src/acl/aclStdIncludes.h                           |   35 +
 src/acl/aclTypes.h                                 |   48 +
 src/acl/aclTypesList.h                             |   34 +
 src/acl/aclUtilities.cxx                           |  151 ++
 src/acl/aclUtilities.h                             |  132 ++
 src/aslDataInc.cxx                                 |   43 +
 src/aslDataInc.h                                   |   42 +
 src/aslGenerators.cxx                              |  158 ++
 src/aslGenerators.h                                |  129 ++
 src/aslGeomInc.cxx                                 |  223 +++
 src/aslGeomInc.h                                   |  154 ++
 src/aslUtilities.cxx                               |  123 ++
 src/aslUtilities.h                                 |  259 +++
 src/data/CMakeLists.txt                            |   26 +
 src/data/aslBlocks.cxx                             |   39 +
 src/data/aslBlocks.h                               |  240 +++
 src/data/aslDataUtilities.cxx                      |  136 ++
 src/data/aslDataUtilities.h                        |   58 +
 src/data/aslDataWithGhostNodes.cxx                 |   71 +
 src/data/aslDataWithGhostNodes.h                   |  171 ++
 src/data/aslDataWrapper.cxx                        |   58 +
 src/data/aslDataWrapper.h                          |  147 ++
 src/data/aslMemElement.cxx                         |   60 +
 src/data/aslMemElement.h                           |   78 +
 src/data/aslProbe.cxx                              |  191 ++
 src/data/aslProbe.h                                |  151 ++
 src/doxygenDefinitions.h                           |  214 +++
 src/math/CMakeLists.txt                            |   41 +
 src/math/aslBarycentric.cxx                        |  100 +
 src/math/aslBarycentric.h                          |   55 +
 src/math/aslDistanceFunction.cxx                   |  195 ++
 src/math/aslDistanceFunction.h                     |  193 ++
 src/math/aslDistanceFunctionAlg.cxx                |  307 ++++
 src/math/aslDistanceFunctionAlg.h                  |  102 ++
 src/math/aslIndex2Position.cxx                     |  111 ++
 src/math/aslIndex2Position.h                       |   58 +
 src/math/aslInterpolation.h                        |  136 ++
 src/math/aslMatrices.cxx                           |  442 +++++
 src/math/aslMatrices.h                             |  354 ++++
 src/math/aslPositionFunction.cxx                   |  205 +++
 src/math/aslPositionFunction.h                     |  227 +++
 src/math/aslProbeTemplates.cxx                     |   53 +
 src/math/aslProbeTemplates.h                       |   88 +
 src/math/aslTemplateVE.cxx                         |  314 ++++
 src/math/aslTemplateVE.h                           |  155 ++
 src/math/aslTemplateVEExtras.cxx                   |   76 +
 src/math/aslTemplateVEExtras.h                     |   55 +
 src/math/aslTemplates.cxx                          |  277 +++
 src/math/aslTemplates.h                            |  853 +++++++++
 src/math/aslTemplatesExtras.cxx                    |  182 ++
 src/math/aslTemplatesExtras.h                      |  127 ++
 src/math/aslVectors.h                              |   40 +
 src/math/aslVectorsDynamicLength.h                 |  235 +++
 src/math/aslVectorsDynamicLengthOperations.h       |  410 +++++
 src/math/aslVectorsUtilities.h                     |  116 ++
 src/num/CMakeLists.txt                             |   72 +
 src/num/aslBCond.cxx                               |  682 +++++++
 src/num/aslBCond.h                                 |  353 ++++
 src/num/aslBasicBC.cxx                             |  635 +++++++
 src/num/aslBasicBC.h                               |  335 ++++
 src/num/aslBasicBC2.cxx                            |  273 +++
 src/num/aslBasicBC2.h                              |  121 ++
 src/num/aslCrystalGrowthBC.cxx                     |  470 +++++
 src/num/aslCrystalGrowthBC.h                       |  204 +++
 src/num/aslDFOptimizer.cxx                         |  100 +
 src/num/aslDFOptimizer.h                           |   86 +
 src/num/aslDataResampling.cxx                      |  145 ++
 src/num/aslDataResampling.h                        |  137 ++
 src/num/aslElasticity.dox                          |  146 ++
 src/num/aslFDAdvectionDiffusion.cxx                |  229 +++
 src/num/aslFDAdvectionDiffusion.h                  |  173 ++
 src/num/aslFDAdvectionDiffusion2.cxx               |  146 ++
 src/num/aslFDAdvectionDiffusion2.h                 |  109 ++
 src/num/aslFDAdvectionDiffusionBC.cxx              |  142 ++
 src/num/aslFDAdvectionDiffusionBC.h                |   70 +
 src/num/aslFDAdvectionDiffusionInhomogeneous.cxx   |   92 +
 src/num/aslFDAdvectionDiffusionInhomogeneous.h     |   82 +
 src/num/aslFDElChemKinetics.cxx                    |  137 ++
 src/num/aslFDElChemKinetics.h                      |  147 ++
 src/num/aslFDElasticity.cxx                        |  365 ++++
 src/num/aslFDElasticity.h                          |  261 +++
 src/num/aslFDElasticityBC.cxx                      |  579 ++++++
 src/num/aslFDElasticityBC.h                        |  290 +++
 src/num/aslFDMultiPhase.cxx                        |  154 ++
 src/num/aslFDMultiPhase.h                          |  153 ++
 src/num/aslFDPoroElasticity.cxx                    |  197 ++
 src/num/aslFDPoroElasticity.h                      |  165 ++
 src/num/aslFDPoroElasticityBC.cxx                  |  231 +++
 src/num/aslFDPoroElasticityBC.h                    |  126 ++
 src/num/aslFDStefanMaxwell.cxx                     |  338 ++++
 src/num/aslFDStefanMaxwell.h                       |  220 +++
 src/num/aslInterfaceTracking.dox                   |   50 +
 src/num/aslInterfaceTrackingAlg1.cxx               |   83 +
 src/num/aslInterfaceTrackingAlg1.h                 |   62 +
 src/num/aslLBGK.cxx                                |  358 ++++
 src/num/aslLBGK.dox                                |   62 +
 src/num/aslLBGK.h                                  |  209 +++
 src/num/aslLBGKBC.cxx                              |  893 +++++++++
 src/num/aslLBGKBC.h                                |  340 ++++
 src/num/aslLSFacetedGrowth.cxx                     |  284 +++
 src/num/aslLSFacetedGrowth.h                       |  117 ++
 src/num/aslLSNormalGrowth.cxx                      |  127 ++
 src/num/aslLSNormalGrowth.h                        |   62 +
 src/num/aslLevelSet.cxx                            |  230 +++
 src/num/aslLevelSet.h                              |  153 ++
 src/num/aslLevelSetLinear.cxx                      |  202 ++
 src/num/aslLevelSetLinear.h                        |   62 +
 src/num/aslNumMethod.cxx                           |   34 +
 src/num/aslNumMethod.h                             |   82 +
 src/num/aslNumMethodsMerger.cxx                    |   66 +
 src/num/aslNumMethodsMerger.h                      |   70 +
 src/num/aslSingleKernelNM.cxx                      |   95 +
 src/num/aslSingleKernelNM.h                        |   90 +
 src/num/aslTimeContinuations.cxx                   |  206 +++
 src/num/aslTimeContinuations.h                     |  138 ++
 src/numExtend/CMakeLists.txt                       |   16 +
 src/numExtend/aslFDAdvectionDiffusionExtended.cxx  |  145 ++
 src/numExtend/aslFDAdvectionDiffusionExtended.h    |  104 ++
 src/pics/grids/2Dconcatination-crop.pdf            |  Bin 0 -> 6324 bytes
 src/pics/grids/2Dconcatination.tex                 |   18 +
 src/pics/grids/t15.png                             |  Bin 0 -> 34208 bytes
 src/pics/grids/t15.svg                             | 1063 +++++++++++
 src/pics/grids/t19.png                             |  Bin 0 -> 39668 bytes
 src/pics/grids/t19.svg                             | 1083 +++++++++++
 src/pics/grids/t27.png                             |  Bin 0 -> 57310 bytes
 src/pics/grids/t27.svg                             | 1290 +++++++++++++
 src/pics/grids/t2ec.png                            |  Bin 0 -> 3045 bytes
 src/pics/grids/t2ec.svg                            |  190 ++
 src/pics/grids/t3.png                              |  Bin 0 -> 3622 bytes
 src/pics/grids/t3.svg                              |  216 +++
 src/pics/grids/t4ec.png                            |  Bin 0 -> 7868 bytes
 src/pics/grids/t4ec.svg                            |  274 +++
 src/pics/grids/t5.png                              |  Bin 0 -> 9527 bytes
 src/pics/grids/t5.svg                              |  236 +++
 src/pics/grids/t7.png                              |  Bin 0 -> 15395 bytes
 src/pics/grids/t7.svg                              |  436 +++++
 src/pics/grids/t8ec.png                            |  Bin 0 -> 15322 bytes
 src/pics/grids/t8ec.svg                            |  699 +++++++
 src/pics/mainDiagram.dot                           |   42 +
 src/readers/aslVTKFormatReaders.cxx                |  388 ++++
 src/readers/aslVTKFormatReaders.h                  |   85 +
 src/utilities/aslGlobalSpace.h                     |   52 +
 src/utilities/aslMATLABCasters.cxx                 |  179 ++
 src/utilities/aslMATLABCasters.h                   |   81 +
 src/utilities/aslParametersManager.cxx             |  427 +++++
 src/utilities/aslParametersManager.h               |  145 ++
 src/utilities/aslSmartPtrUtils.h                   |   39 +
 src/utilities/aslTimeStamp.cxx                     |   30 +
 src/utilities/aslTimeStamp.h                       |   60 +
 src/utilities/aslTimer.h                           |   70 +
 src/utilities/aslUValue.h                          |   68 +
 src/utilities/aslVTKCasters.cxx                    |  613 +++++++
 src/utilities/aslVTKCasters.h                      |  174 ++
 src/utilities/aslVTKDataGenerators.cxx             |   45 +
 src/utilities/aslVTKDataGenerators.h               |   59 +
 src/writers/aslABDFormat.cxx                       |   86 +
 src/writers/aslABDFormat.h                         |  247 +++
 src/writers/aslMATFormat.cxx                       |   95 +
 src/writers/aslMATFormat.h                         |   82 +
 src/writers/aslVTKFormatWriters.cxx                |  150 ++
 src/writers/aslVTKFormatWriters.h                  |   59 +
 src/writers/aslWriter.cxx                          |  184 ++
 src/writers/aslWriter.h                            |   76 +
 test/CMakeLists.txt                                |    6 +
 test/input_data/asl.ini                            |    8 +
 test/input_data/bus.stl                            |  Bin 0 -> 1971284 bytes
 test/input_data/locomotive.stl                     |  Bin 0 -> 9262484 bytes
 test/testABD/CMakeLists.txt                        |    6 +
 test/testABD/testABDFormat.cc                      |  135 ++
 test/testACL/CMakeLists.txt                        |   25 +
 test/testACL/testHardware.cc                       |  116 ++
 test/testACL/testKernel.cc                         |  436 +++++
 test/testACL/testKernelMerger.cc                   |   90 +
 test/testACL/testMatrixOfElements.cc               |  138 ++
 test/testACL/testOperators.cc                      |  162 ++
 test/testACL/testPerformance.cc                    |  372 ++++
 test/testACL/testPrivateVar.cc                     |  137 ++
 test/testACL/testVectorOfElements.cc               |  118 ++
 test/testAGL/CMakeLists.txt                        |    6 +
 test/testAGL/testVTK_IO.cc                         |   80 +
 test/testMath/CMakeLists.txt                       |   11 +
 test/testMath/testASLData.cc                       |  152 ++
 test/testMath/testDistanceFunction.cc              |  383 ++++
 test/testMath/testReductionFunction.cc             |  115 ++
 test/testPhysics/CMakeLists.txt                    |    6 +
 test/testPhysics/elastic/CMakeLists.txt            |   23 +
 test/testPhysics/elastic/acousticWaves.cc          |  255 +++
 test/testPhysics/elastic/cubeGravity.cc            |  139 ++
 .../elastic/cubeIncompressibleGravity.cc           |  143 ++
 test/testPhysics/elastic/cubePoroelasticGravity.cc |  149 ++
 test/testPhysics/elastic/poroelastic.cc            |  165 ++
 test/testPhysics/flow/CMakeLists.txt               |   54 +
 test/testPhysics/flow/bus_wind.cc                  |  146 ++
 test/testPhysics/flow/compressor.cc                |  164 ++
 test/testPhysics/flow/flow.cc                      |  142 ++
 test/testPhysics/flow/flow2.cc                     |  186 ++
 test/testPhysics/flow/flow3.cc                     |  164 ++
 test/testPhysics/flow/flowAroundObject.cc          |  173 ++
 test/testPhysics/flow/flowKDPGrowth.cc             |  344 ++++
 test/testPhysics/flow/flowRotatingCylinders.cc     |  162 ++
 test/testPhysics/flow/locomotive_in_tunnel.cc      |  173 ++
 test/testPhysics/flow/locomotive_stability.cc      |  170 ++
 test/testPhysics/flow/multicomponent_flow.cc       |  268 +++
 test/testPhysics/flow/multiphase_flow.cc           |  254 +++
 test/testPhysics/flow/pitot_tube_ice.cc            |  254 +++
 test/testPhysics/heatTransfer/CMakeLists.txt       |    7 +
 test/testPhysics/heatTransfer/surfaceFlux.cc       |  132 ++
 test/testPhysics/jumpingObjects/CMakeLists.txt     |    7 +
 test/testPhysics/jumpingObjects/jumpingBox.cc      |  133 ++
 test/testPhysics/levelSet/CMakeLists.txt           |   15 +
 test/testPhysics/levelSet/levelSetBasic.cc         |  112 ++
 test/testPhysics/levelSet/levelSetFacetedGrowth.cc |  124 ++
 test/testPhysics/levelSet/levelSetNormalGrowth.cc  |  117 ++
 test/testPhysics/massTransferSM/CMakeLists.txt     |   19 +
 test/testPhysics/massTransferSM/testSMDiff.cc      |  125 ++
 test/testPhysics/massTransferSM/testSMDiff3C.cc    |  135 ++
 test/testPhysics/massTransferSM/testSMPhi.cc       |  145 ++
 test/testPhysics/massTransferSM/testSMPhiBV.cc     |  171 ++
 340 files changed, 54267 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..bc9b3cb
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,47 @@
+project(asl)
+
+# After switching to 3.1 - remove FindOpenCL.cmake from the distribution
+# since it is supported by the cmake itself.
+cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
+
+# Set version number
+set(ASL_VERSION_MAJOR 0)
+set(ASL_VERSION_MINOR 1)
+set(ASL_VERSION_PATCH 0)
+set(ASL_VERSION ${ASL_VERSION_MAJOR}.${ASL_VERSION_MINOR}.${ASL_VERSION_PATCH})
+
+# Add definitions
+include(DefineOptions.cmake)
+include(DefineFunctions.cmake)
+
+# Configure Doxyfile
+configure_file(
+	"${PROJECT_SOURCE_DIR}/doc/Developer-Guide/Doxyfile.in"
+	"${PROJECT_BINARY_DIR}/doc/Developer-Guide/Doxyfile"
+)
+
+# Enable supplied cmake Modules
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+
+# Find dependencies
+find_package(OpenCL 1.1 REQUIRED)
+# ToDo: check - system component might be not needed any longer on new versions of Boost
+find_package(Boost 1.49 REQUIRED COMPONENTS program_options filesystem system)
+find_package(VTK 5.8 REQUIRED)
+
+include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS})
+
+set(CMAKE_CXX_FLAGS "-Wall -O3 -std=c++11")
+
+add_subdirectory(src)
+add_subdirectory(test)
+
+# Packaging
+set(CPACK_GENERATOR "TGZ")
+set(CPACK_SOURCE_GENERATOR "TGZ")
+set(CPACK_PACKAGE_VERSION_MAJOR ${ASL_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${ASL_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${ASL_VERSION_PATCH})
+set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
+set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
+include(CPack)
diff --git a/DefineFunctions.cmake b/DefineFunctions.cmake
new file mode 100644
index 0000000..583a276
--- /dev/null
+++ b/DefineFunctions.cmake
@@ -0,0 +1,26 @@
+# Installs sublibraries - binaries and
+# public headers (preserving source tree structure)
+function(INSTALL_SUBLIB _SUBLIB _SUBLIB_PUBLIC_HEADERS)
+	# ToDo: add COMPONENT headers
+	install(TARGETS
+		${_SUBLIB}
+		RUNTIME DESTINATION bin
+		LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib
+	)
+
+	# Install public headers preserving the source tree structure
+	foreach(header ${${_SUBLIB_PUBLIC_HEADERS}})
+		# Determine relative path from ${CMAKE_SOURCE_DIR}/src to ${header}
+		file(RELATIVE_PATH relative_path ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/${header})
+		# Extract directories of the relative path
+		# ToDo: replace PATH with DIRECTORY for cmake > 2.8.11
+		get_filename_component(directories ${relative_path} PATH)
+		# ToDo: add COMPONENT libraries
+		install(FILES
+			${header}
+			DESTINATION
+			include/${LIBRARY_NAME}/${directories}
+		)
+	endforeach()
+endfunction(INSTALL_SUBLIB)
diff --git a/DefineOptions.cmake b/DefineOptions.cmake
new file mode 100644
index 0000000..15cb4d3
--- /dev/null
+++ b/DefineOptions.cmake
@@ -0,0 +1,6 @@
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+option(WITH_MATIO "Build with MATIO (Matlab) support" OFF)
+option(WITH_INTERNAL_DOC "Compile doxygen internal documentation" OFF)
+option(WITH_TESTING "Build with unit tests" OFF)
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..dba13ed
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,661 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6bd93b7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,51 @@
+# ASL
+
+__Advanced Simulation Library (ASL)__ is a free and open source multiphysics simulation software package (and a tool for solving Partial Differential Equations). Its computational engine is based, among others, on the [Lattice Boltzmann methods](http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods) and is written in [OpenCL](http://en.wikipedia.org/wiki/OpenCL) which enable [extraordinarily efficient deployment](http://asl.org.il/benchmarks) on a variety of massively parallel architect [...]
+
+
+## License
+
+ASL is distributed under the free GNU Affero General Public License (AGPLv3) with an optional [commercial license](http://asl.org.il/licensing). Professional support and consulting services are provided by [Avtech Scientific](http://avtechscientific.com), whose team created and continues to extend the library. The company offers [advanced R&D solutions and services](http://avtechscientific.com/services) and is involved in diverse academic and industrial [collaborative projects](http://av [...]
+
+
+## Quick Start
+
+### Installation
+
+1. Install [cmake](http://cmake.org) (BSD License) and the required libraries:
+	- [OpenCL](https://www.khronos.org/opencl) (OpenCL Specification License)
+	- [C++ bindings for OpenCL](https://www.khronos.org/registry/cl/api/1.1/cl.hpp) (OpenCL Specification License)
+	- [boost](http://www.boost.org) (Boost Software License)
+	- [VTK](http://vtk.org) (BSD License)
+	- optional: [matio](https://sourceforge.net/projects/matio) (BSD License)
+2. Download
+	- and extract the [ASL source code archive](https://github.com/AvtechScientific/ASL/archive/master.zip)
+	- or "git it": `git clone https://github.com/AvtechScientific/ASL.git`
+3. Create a build directory: `mkdir build-asl; cd build-asl`
+4. Use [cmake generator](http://www.cmake.org/cmake/help/v3.2/manual/cmake-generators.7.html) to produce Makefiles: `cmake -G "Unix Makefiles" ../ASL` or project files for your IDE (Visual Studio, Xcode, Eclipse, etc.): `cmake -G "Visual Studio 10" ../ASL`
+5. Run make (as root if installing into default destination `/usr/local`): `make install`
+
+### Running an example
+
+1. Go to tests: `cd test/testPhysics/flow/locomotive_in_tunnel`
+2. Copy sample ASL configuration file: `cp ../../../../../ASL/test/input_data/asl.ini .`
+3. Copy the .stl input file: `cp ../../../../../ASL/test/input_data/locomotive.stl .`
+4. Run: `./locomotive_in_tunnel`
+5. Post-processing: [step by step example](https://github.com/AvtechScientific/ASL/wiki/User-Guide#post-processing).
+
+### Writing your own code using ASL
+
+1. Take a look on examples, e.g. `test/testPhysics/flow/locomotive_in_tunnel.cc`
+2. To build your program using `cmake` see e.g. `test/testPhysics/flow/CMakeLists.txt`
+3. To build your program with tools others than `cmake` run `make VERBOSE=1` and/or consult `CMakeCache.txt` to get better understanding of the compiler flags, library paths and dependencies involved. The output of `make install` shows the location of installed public include headers and libraries (by default: `/usr/local/include/asl-X.Y.Z` and `/usr/local/lib`).
+
+
+## Media files
+
+Some examples require input files (like `asl.ini` or .stl) that can be found in `test/input_data`.
+All .stl files were obtained from [GrabCAD](https://grabcad.com/) and are subject to their [Terms of Service](https://grabcad.com/terms); the rest of files, and specifically the images in `src/pics` are part of the ASL project and are covered by its license (see above) except where stated otherwise (`cmake/Modules`).
+
+
+## Further information
+
+For more information, please visit <http://asl.org.il>.
diff --git a/cmake/Modules/CMakeParseArguments.cmake b/cmake/Modules/CMakeParseArguments.cmake
new file mode 100644
index 0000000..cb22c0a
--- /dev/null
+++ b/cmake/Modules/CMakeParseArguments.cmake
@@ -0,0 +1,181 @@
+#.rst:
+# CMakeParseArguments
+# -------------------
+#
+#
+#
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords>
+# <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions
+# for parsing the arguments given to that macro or function.  It
+# processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e.  keywords which can be used when calling the macro without any
+# value following, like e.g.  the OPTIONAL keyword of the install()
+# command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g.  DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this
+# macro which can be followed by more than one value, like e.g.  the
+# TARGETS or FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.  These
+# variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see
+# whether your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments
+# as the real install() command:
+#
+# ::
+#
+#    function(MY_INSTALL)
+#      set(options OPTIONAL FAST)
+#      set(oneValueArgs DESTINATION RENAME)
+#      set(multiValueArgs TARGETS CONFIGURATIONS)
+#      cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
+#                            "${multiValueArgs}" ${ARGN} )
+#      ...
+#
+#
+#
+# Assume my_install() has been called like this:
+#
+# ::
+#
+#    my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+#
+#
+# After the cmake_parse_arguments() call the macro will have set the
+# following variables:
+#
+# ::
+#
+#    MY_INSTALL_OPTIONAL = TRUE
+#    MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+#    MY_INSTALL_DESTINATION = "bin"
+#    MY_INSTALL_RENAME = "" (was not used)
+#    MY_INSTALL_TARGETS = "foo;bar"
+#    MY_INSTALL_CONFIGURATIONS = "" (was not used)
+#    MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+#
+#
+# You can then continue and process these variables.
+#
+# Keywords terminate lists of values, e.g.  if directly after a
+# one_value_keyword another recognized keyword follows, this is
+# interpreted as the beginning of the new option.  E.g.
+# my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION
+# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf at kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# 
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+#
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+  return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+  # first set all result variables to empty/FALSE
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+    set(${prefix}_${arg_name})
+  endforeach()
+
+  foreach(option ${_optionNames})
+    set(${prefix}_${option} FALSE)
+  endforeach()
+
+  set(${prefix}_UNPARSED_ARGUMENTS)
+
+  set(insideValues FALSE)
+  set(currentArgName)
+
+  # now iterate over all arguments and fill the result variables
+  foreach(currentArg ${ARGN})
+    list(FIND _optionNames "${currentArg}" optionIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _singleArgNames "${currentArg}" singleArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _multiArgNames "${currentArg}" multiArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+
+    if(${optionIndex} EQUAL -1  AND  ${singleArgIndex} EQUAL -1  AND  ${multiArgIndex} EQUAL -1)
+      if(insideValues)
+        if("${insideValues}" STREQUAL "SINGLE")
+          set(${prefix}_${currentArgName} ${currentArg})
+          set(insideValues FALSE)
+        elseif("${insideValues}" STREQUAL "MULTI")
+          list(APPEND ${prefix}_${currentArgName} ${currentArg})
+        endif()
+      else()
+        list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+      endif()
+    else()
+      if(NOT ${optionIndex} EQUAL -1)
+        set(${prefix}_${currentArg} TRUE)
+        set(insideValues FALSE)
+      elseif(NOT ${singleArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "SINGLE")
+      elseif(NOT ${multiArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "MULTI")
+      endif()
+    endif()
+
+  endforeach()
+
+  # propagate the result variables to the caller:
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+    set(${prefix}_${arg_name}  ${${prefix}_${arg_name}} PARENT_SCOPE)
+  endforeach()
+  set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction()
diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake
new file mode 100644
index 0000000..81e6a29
--- /dev/null
+++ b/cmake/Modules/FindMATIO.cmake
@@ -0,0 +1,100 @@
+# FindMATIO
+#
+# Try to find MATIO library
+#
+# Once done this will define:
+#
+#  MATIO_FOUND		- True if MATIO found.
+#  MATIO_LIBRARIES	- MATIO libraries.
+#  MATIO_INCLUDE_DIRS - where to find matio.h, etc..
+#  MATIO_VERSION_STRING - version number as a string (e.g.: "1.3.4")
+# 
+#=============================================================================
+# Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# 
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+#
+
+# Look for the header file.
+find_path(MATIO_INCLUDE_DIR NAMES matio.h DOC "The MATIO include directory")
+
+# Look for the library.
+find_library(MATIO_LIBRARY NAMES matio DOC "The MATIO library")
+
+if(MATIO_INCLUDE_DIR)
+	# ---------------------------------------------------
+	#  Extract version information from MATIO
+	# ---------------------------------------------------
+
+	# If the file is missing, set all values to 0
+	set(MATIO_MAJOR_VERSION 0)
+	set(MATIO_MINOR_VERSION 0)
+	set(MATIO_RELEASE_LEVEL 0)
+
+	# new versions of MATIO have `matio_pubconf.h`
+	if(EXISTS ${MATIO_INCLUDE_DIR}/matio_pubconf.h)
+		set(MATIO_CONFIG_FILE "matio_pubconf.h")
+	else()
+		set(MATIO_CONFIG_FILE "matioConfig.h")
+	endif()
+
+	if(MATIO_CONFIG_FILE)
+
+		# Read and parse MATIO config header file for version number
+		file(STRINGS "${MATIO_INCLUDE_DIR}/${MATIO_CONFIG_FILE}" _matio_HEADER_CONTENTS REGEX "#define MATIO_((MAJOR|MINOR)_VERSION)|(RELEASE_LEVEL) ")
+
+		foreach(line ${_matio_HEADER_CONTENTS})
+			if(line MATCHES "#define ([A-Z_]+) ([0-9]+)")
+				set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
+			endif()
+		endforeach()
+
+		unset(_matio_HEADER_CONTENTS)
+	endif()
+
+	set(MATIO_VERSION_STRING "${MATIO_MAJOR_VERSION}.${MATIO_MINOR_VERSION}.${MATIO_RELEASE_LEVEL}")
+endif ()
+
+#==================
+
+mark_as_advanced(MATIO_INCLUDE_DIR MATIO_LIBRARY)
+
+# handle the QUIETLY and REQUIRED arguments and set MATIO_FOUND to TRUE if 
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MATIO REQUIRED_VARS MATIO_LIBRARY MATIO_INCLUDE_DIR VERSION_VAR MATIO_VERSION_STRING)
+
+if(MATIO_FOUND)
+  set(MATIO_LIBRARIES ${MATIO_LIBRARY})
+  set(MATIO_INCLUDE_DIRS ${MATIO_INCLUDE_DIR})
+else(MATIO_FOUND)
+  set(MATIO_LIBRARIES)
+  set(MATIO_INCLUDE_DIRS)
+endif(MATIO_FOUND)
diff --git a/cmake/Modules/FindOpenCL.cmake b/cmake/Modules/FindOpenCL.cmake
new file mode 100644
index 0000000..2ce5c88
--- /dev/null
+++ b/cmake/Modules/FindOpenCL.cmake
@@ -0,0 +1,156 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define::
+#
+#   OpenCL_FOUND          - True if OpenCL was found
+#   OpenCL_INCLUDE_DIRS   - include directories for OpenCL
+#   OpenCL_LIBRARIES      - link against this library to use OpenCL
+#   OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+#   OpenCL_VERSION_MAJOR  - The major version of the OpenCL implementation
+#   OpenCL_VERSION_MINOR  - The minor version of the OpenCL implementation
+#
+# The module will also define two cache variables::
+#
+#   OpenCL_INCLUDE_DIR    - the OpenCL include directory
+#   OpenCL_LIBRARY        - the path to the OpenCL library
+#
+# 
+#=============================================================================
+# Copyright 2014 Matthaeus G. Chajdas
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# 
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+#
+
+function(_FIND_OPENCL_VERSION)
+  include(CheckSymbolExists)
+  include(CMakePushCheckState)
+  set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
+
+  CMAKE_PUSH_CHECK_STATE()
+  foreach(VERSION "2_0" "1_2" "1_1" "1_0")
+    set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+    if(APPLE)
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    else()
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    endif()
+
+    if(OPENCL_VERSION_${VERSION})
+      string(REPLACE "_" "." VERSION "${VERSION}")
+      set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
+      string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
+      list(GET version_components 0 major_version)
+      list(GET version_components 1 minor_version)
+      set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
+      set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
+      break()
+    endif()
+  endforeach()
+  CMAKE_POP_CHECK_STATE()
+endfunction()
+
+find_path(OpenCL_INCLUDE_DIR
+  NAMES
+    CL/cl.h OpenCL/cl.h
+  PATHS
+    ENV "PROGRAMFILES(X86)"
+    ENV AMDAPPSDKROOT
+    ENV INTELOCLSDKROOT
+    ENV NVSDKCOMPUTE_ROOT
+    ENV CUDA_PATH
+    ENV ATISTREAMSDKROOT
+  PATH_SUFFIXES
+    include
+    OpenCL/common/inc
+    "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+if(WIN32)
+  if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    find_library(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS
+        ENV "PROGRAMFILES(X86)"
+        ENV AMDAPPSDKROOT
+        ENV INTELOCLSDKROOT
+        ENV CUDA_PATH
+        ENV NVSDKCOMPUTE_ROOT
+        ENV ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86"
+        lib/x86
+        lib/Win32
+        OpenCL/common/lib/Win32)
+  elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    find_library(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS
+        ENV "PROGRAMFILES(X86)"
+        ENV AMDAPPSDKROOT
+        ENV INTELOCLSDKROOT
+        ENV CUDA_PATH
+        ENV NVSDKCOMPUTE_ROOT
+        ENV ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86_64"
+        lib/x86_64
+        lib/x64
+        OpenCL/common/lib/x64)
+  endif()
+else()
+  find_library(OpenCL_LIBRARY
+    NAMES OpenCL)
+endif()
+
+set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(
+  OpenCL
+  FOUND_VAR OpenCL_FOUND
+  REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
+  VERSION_VAR OpenCL_VERSION_STRING)
+
+mark_as_advanced(
+  OpenCL_INCLUDE_DIR
+  OpenCL_LIBRARY)
diff --git a/cmake/Modules/FindPackageHandleStandardArgs.cmake b/cmake/Modules/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 0000000..f7fb0bf
--- /dev/null
+++ b/cmake/Modules/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,402 @@
+#.rst:
+# FindPackageHandleStandardArgs
+# -----------------------------
+#
+#
+#
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ...  )
+#
+# This function is intended to be used in FindXXX.cmake modules files.
+# It handles the REQUIRED, QUIET and version-related arguments to
+# find_package().  It also sets the <packagename>_FOUND variable.  The
+# package is considered found if all variables <var1>...  listed contain
+# valid results, e.g.  valid filepaths.
+#
+# There are two modes of this function.  The first argument in both
+# modes is the name of the Find-module where it is called (in original
+# casing).
+#
+# The first simple mode looks like this:
+#
+# ::
+#
+#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name>
+#       (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
+#
+# If the variables <var1> to <varN> are all valid, then
+# <UPPERCASED_NAME>_FOUND will be set to TRUE.  If DEFAULT_MSG is given
+# as second argument, then the function will generate itself useful
+# success and error messages.  You can also supply a custom error
+# message for the failure case.  This is not recommended.
+#
+# The second mode is more powerful and also supports version checking:
+#
+# ::
+#
+#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME
+#       [FOUND_VAR <resultVar>]
+#       [REQUIRED_VARS <var1>...<varN>]
+#       [VERSION_VAR   <versionvar>]
+#       [HANDLE_COMPONENTS]
+#       [CONFIG_MODE]
+#       [FAIL_MESSAGE "Custom failure message"] )
+#
+# In this mode, the name of the result-variable can be set either to
+# either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the
+# FOUND_VAR option.  Other names for the result-variable are not
+# allowed.  So for a Find-module named FindFooBar.cmake, the two
+# possible names are FooBar_FOUND and FOOBAR_FOUND.  It is recommended
+# to use the original case version.  If the FOUND_VAR option is not
+# used, the default is <UPPERCASED_NAME>_FOUND.
+#
+# As in the simple mode, if <var1> through <varN> are all valid,
+# <packagename>_FOUND will be set to TRUE.  After REQUIRED_VARS the
+# variables which are required for this package are listed.  Following
+# VERSION_VAR the name of the variable can be specified which holds the
+# version of the package which has been found.  If this is done, this
+# version will be checked against the (potentially) specified required
+# version used in the find_package() call.  The EXACT keyword is also
+# handled.  The default messages include information about the required
+# version and the version which has been actually found, both if the
+# version is ok or not.  If the package supports components, use the
+# HANDLE_COMPONENTS option to enable handling them.  In this case,
+# find_package_handle_standard_args() will report which components have
+# been found and which are missing, and the <packagename>_FOUND variable
+# will be set to FALSE if any of the required components (i.e.  not the
+# ones listed after OPTIONAL_COMPONENTS) are missing.  Use the option
+# CONFIG_MODE if your FindXXX.cmake module is a wrapper for a
+# find_package(...  NO_MODULE) call.  In this case VERSION_VAR will be
+# set to <NAME>_VERSION and the macro will automatically check whether
+# the Config module was found.  Via FAIL_MESSAGE a custom failure
+# message can be specified, if this is not used, the default message
+# will be displayed.
+#
+# Example for mode 1:
+#
+# ::
+#
+#     find_package_handle_standard_args(LibXml2  DEFAULT_MSG
+#       LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
+#
+#
+#
+# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
+# LIBXML2_INCLUDE_DIR are valid.  Then also LIBXML2_FOUND is set to
+# TRUE.  If it is not found and REQUIRED was used, it fails with
+# FATAL_ERROR, independent whether QUIET was used or not.  If it is
+# found, success will be reported, including the content of <var1>.  On
+# repeated Cmake runs, the same message won't be printed again.
+#
+# Example for mode 2:
+#
+# ::
+#
+#     find_package_handle_standard_args(LibXslt
+#       FOUND_VAR LibXslt_FOUND
+#       REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
+#       VERSION_VAR LibXslt_VERSION_STRING)
+#
+# In this case, LibXslt is considered to be found if the variable(s)
+# listed after REQUIRED_VAR are all valid, i.e.  LibXslt_LIBRARIES and
+# LibXslt_INCLUDE_DIRS in this case.  The result will then be stored in
+# LibXslt_FOUND .  Also the version of LibXslt will be checked by using
+# the version contained in LibXslt_VERSION_STRING.  Since no
+# FAIL_MESSAGE is given, the default messages will be printed.
+#
+# Another example for mode 2:
+#
+# ::
+#
+#     find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
+#     find_package_handle_standard_args(Automoc4  CONFIG_MODE)
+#
+# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4
+# NO_MODULE) and adds an additional search directory for automoc4.  Here
+# the result will be stored in AUTOMOC4_FOUND.  The following
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
+# success/error message.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# 
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+#
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+
+# internal helper macro
+macro(_FPHSA_FAILURE_MESSAGE _msg)
+  if (${_NAME}_FIND_REQUIRED)
+    message(FATAL_ERROR "${_msg}")
+  else ()
+    if (NOT ${_NAME}_FIND_QUIETLY)
+      message(STATUS "${_msg}")
+    endif ()
+  endif ()
+endmacro()
+
+
+# internal helper macro to generate the failure message when used in CONFIG_MODE:
+macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
+  # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
+  if(${_NAME}_CONFIG)
+    _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
+  else()
+    # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
+    # List them all in the error message:
+    if(${_NAME}_CONSIDERED_CONFIGS)
+      set(configsText "")
+      list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
+      math(EXPR configsCount "${configsCount} - 1")
+      foreach(currentConfigIndex RANGE ${configsCount})
+        list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
+        list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
+        set(configsText "${configsText}    ${filename} (version ${version})\n")
+      endforeach()
+      if (${_NAME}_NOT_FOUND_MESSAGE)
+        set(configsText "${configsText}    Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
+      endif()
+      _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
+
+    else()
+      # Simple case: No Config-file was found at all:
+      _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
+    endif()
+  endif()
+endmacro()
+
+
+function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
+
+# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
+# new extended or in the "old" mode:
+  set(options  CONFIG_MODE  HANDLE_COMPONENTS)
+  set(oneValueArgs  FAIL_MESSAGE  VERSION_VAR  FOUND_VAR)
+  set(multiValueArgs REQUIRED_VARS)
+  set(_KEYWORDS_FOR_EXTENDED_MODE  ${options} ${oneValueArgs} ${multiValueArgs} )
+  list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
+
+  if(${INDEX} EQUAL -1)
+    set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
+    set(FPHSA_REQUIRED_VARS ${ARGN})
+    set(FPHSA_VERSION_VAR)
+  else()
+
+    CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${_FIRST_ARG} ${ARGN})
+
+    if(FPHSA_UNPARSED_ARGUMENTS)
+      message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
+    endif()
+
+    if(NOT FPHSA_FAIL_MESSAGE)
+      set(FPHSA_FAIL_MESSAGE  "DEFAULT_MSG")
+    endif()
+  endif()
+
+# now that we collected all arguments, process them
+
+  if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
+    set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
+  endif()
+
+  # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
+  # when it successfully found the config-file, including version checking:
+  if(FPHSA_CONFIG_MODE)
+    list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
+    list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
+    set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
+  endif()
+
+  if(NOT FPHSA_REQUIRED_VARS)
+    message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
+  endif()
+
+  list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
+
+  string(TOUPPER ${_NAME} _NAME_UPPER)
+  string(TOLOWER ${_NAME} _NAME_LOWER)
+
+  if(FPHSA_FOUND_VAR)
+    if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$"  OR  FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
+      set(_FOUND_VAR ${FPHSA_FOUND_VAR})
+    else()
+      message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
+    endif()
+  else()
+    set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
+  endif()
+
+  # collect all variables which were not found, so they can be printed, so the
+  # user knows better what went wrong (#6375)
+  set(MISSING_VARS "")
+  set(DETAILS "")
+  # check if all passed variables are valid
+  unset(${_FOUND_VAR})
+  foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
+    if(NOT ${_CURRENT_VAR})
+      set(${_FOUND_VAR} FALSE)
+      set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+    else()
+      set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
+    endif()
+  endforeach()
+  if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE")
+    set(${_FOUND_VAR} TRUE)
+  endif()
+
+  # component handling
+  unset(FOUND_COMPONENTS_MSG)
+  unset(MISSING_COMPONENTS_MSG)
+
+  if(FPHSA_HANDLE_COMPONENTS)
+    foreach(comp ${${_NAME}_FIND_COMPONENTS})
+      if(${_NAME}_${comp}_FOUND)
+
+        if(NOT DEFINED FOUND_COMPONENTS_MSG)
+          set(FOUND_COMPONENTS_MSG "found components: ")
+        endif()
+        set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}")
+
+      else()
+
+        if(NOT DEFINED MISSING_COMPONENTS_MSG)
+          set(MISSING_COMPONENTS_MSG "missing components: ")
+        endif()
+        set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
+
+        if(${_NAME}_FIND_REQUIRED_${comp})
+          set(${_FOUND_VAR} FALSE)
+          set(MISSING_VARS "${MISSING_VARS} ${comp}")
+        endif()
+
+      endif()
+    endforeach()
+    set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
+    set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
+  endif()
+
+  # version handling:
+  set(VERSION_MSG "")
+  set(VERSION_OK TRUE)
+  set(VERSION ${${FPHSA_VERSION_VAR}})
+
+  # check with DEFINED here as the requested or found version may be "0"
+  if (DEFINED ${_NAME}_FIND_VERSION)
+    if(DEFINED ${FPHSA_VERSION_VAR})
+
+      if(${_NAME}_FIND_VERSION_EXACT)       # exact version required
+        # count the dots in the version string
+        string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}")
+        # add one dot because there is one dot more than there are components
+        string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
+        if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
+          # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
+          # is at most 4 here. Therefore a simple lookup table is used.
+          if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
+            set(_VERSION_REGEX "[^.]*")
+          elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
+            set(_VERSION_REGEX "[^.]*\\.[^.]*")
+          elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
+            set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
+          else ()
+            set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
+          endif ()
+          string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}")
+          unset(_VERSION_REGEX)
+          if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
+            set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+            set(VERSION_OK FALSE)
+          else ()
+            set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+          endif ()
+          unset(_VERSION_HEAD)
+        else ()
+          if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION)
+            set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+            set(VERSION_OK FALSE)
+          else ()
+            set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+          endif ()
+        endif ()
+        unset(_VERSION_DOTS)
+
+      else()     # minimum version specified:
+        if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION)
+          set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
+          set(VERSION_OK FALSE)
+        else ()
+          set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
+        endif ()
+      endif()
+
+    else()
+
+      # if the package was not found, but a version was given, add that to the output:
+      if(${_NAME}_FIND_VERSION_EXACT)
+         set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
+      else()
+         set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
+      endif()
+
+    endif()
+  else ()
+    if(VERSION)
+      set(VERSION_MSG "(found version \"${VERSION}\")")
+    endif()
+  endif ()
+
+  if(VERSION_OK)
+    set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
+  else()
+    set(${_FOUND_VAR} FALSE)
+  endif()
+
+
+  # print the result:
+  if (${_FOUND_VAR})
+    FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
+  else ()
+
+    if(FPHSA_CONFIG_MODE)
+      _FPHSA_HANDLE_FAILURE_CONFIG_MODE()
+    else()
+      if(NOT VERSION_OK)
+        _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
+      else()
+        _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+      endif()
+    endif()
+
+  endif ()
+
+  set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE)
+
+endfunction()
diff --git a/cmake/Modules/FindPackageMessage.cmake b/cmake/Modules/FindPackageMessage.cmake
new file mode 100644
index 0000000..80f06cc
--- /dev/null
+++ b/cmake/Modules/FindPackageMessage.cmake
@@ -0,0 +1,77 @@
+#.rst:
+# FindPackageMessage
+# ------------------
+#
+#
+#
+# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
+#
+# This macro is intended to be used in FindXXX.cmake modules files.  It
+# will print a message once for each unique find result.  This is useful
+# for telling the user where a package was found.  The first argument
+# specifies the name (XXX) of the package.  The second argument
+# specifies the message to display.  The third argument lists details
+# about the find result so that if they change the message will be
+# displayed again.  The macro also obeys the QUIET argument to the
+# find_package command.
+#
+# Example:
+#
+# ::
+#
+#   if(X11_FOUND)
+#     FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
+#       "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
+#   else()
+#    ...
+#   endif()
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# 
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+#
+
+function(FIND_PACKAGE_MESSAGE pkg msg details)
+  # Avoid printing a message repeatedly for the same find result.
+  if(NOT ${pkg}_FIND_QUIETLY)
+    string(REPLACE "\n" "" details "${details}")
+    set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
+    if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
+      # The message has not yet been printed.
+      message(STATUS "${msg}")
+
+      # Save the find details in the cache to avoid printing the same
+      # message again.
+      set("${DETAILS_VAR}" "${details}"
+        CACHE INTERNAL "Details about finding ${pkg}")
+    endif()
+  endif()
+endfunction()
diff --git a/doc/Developer-Guide/Doxyfile.in b/doc/Developer-Guide/Doxyfile.in
new file mode 100644
index 0000000..54c7d94
--- /dev/null
+++ b/doc/Developer-Guide/Doxyfile.in
@@ -0,0 +1,1935 @@
+# Doxyfile 1.8.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed
+# in front of the TAG it is preceding .
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME           = ASL
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+#
+# Configured with CMake
+
+PROJECT_NUMBER         = @ASL_VERSION_MAJOR at .@ASL_VERSION_MINOR@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "Advanced Simulation Library"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = 
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian,
+# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic,
+# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip. Note that you specify absolute paths here, but also
+# relative paths, which will be relative from the directory where doxygen is
+# started.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 2
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "listedNote=\xrefitem lnote \"Note\" \"List of notes\"" \
+                         "strike=\htmlonly<strike>\endhtmlonly" \
+                         "endstrike=\htmlonly</strike>\endhtmlonly"
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension,
+# and language is one of the parsers supported by doxygen: IDL, Java,
+# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
+# C++. For instance to make doxygen treat .inc files as Fortran files (default
+# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
+# that for custom extensions you also need to set FILE_PATTERNS otherwise the
+# files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES (the
+# default) will make doxygen replace the get and set methods by a property in
+# the documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields or simple typedef fields will be shown
+# inline in the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO (the default), structs, classes, and unions are shown on a separate
+# page (for HTML and Man pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can
+# be an expensive process and often the same symbol appear multiple times in
+# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too
+# small doxygen will become slower. If the cache is too large, memory is wasted.
+# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid
+# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536
+# symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if section-label ... \endif
+# and \cond section-label ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path. Do not use
+# file names with spaces, bibtex cannot handle them.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = @CMAKE_SOURCE_DIR@/src @CMAKE_SOURCE_DIR@/test
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.f90 \
+                         *.f \
+                         *.vhd \
+                         *.vhdl
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = */.git/* \
+                         */.svn/* \
+                         */cmake/* \
+                         */obj/*
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           = @CMAKE_SOURCE_DIR@/test
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             = @CMAKE_SOURCE_DIR@/src/pics
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be ignored.
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C, C++ and Fortran comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+#  for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If left blank doxygen will
+# generate a default style sheet. Note that it is recommended to use
+# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
+# tag will in the future become obsolete.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
+# user-defined cascading style sheet that is included after the standard
+# style sheets created by doxygen. Using this option one can overrule
+# certain style aspects. This is preferred over using HTML_STYLESHEET
+# since it does not replace the standard style sheet and is therefor more
+# robust against future updates. Doxygen will copy the style sheet file to
+# the output directory.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
+# entries shown in the various tree structured indices initially; the user
+# can expand and collapse entries dynamically later on. Doxygen will expand
+# the tree to such a level that at most the specified number of entries are
+# visible (unless a fully collapsed tree already exceeds this amount).
+# So setting the number of entries 1 will produce a full collapsed tree by
+# default. 0 is a special value representing an infinite number of entries
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
+# identify the documentation publisher. This should be a reverse domain-name
+# style string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 14
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = YES
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
+# SVG. The default value is HTML-CSS, which is slower, but has the best
+# compatibility.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax.
+# However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     = TeX/mhchem
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript
+# pieces of code that will be used on startup of the MathJax code.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript.
+# There are two flavours of web server based search depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools.
+# See the manual for details.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain
+# the search results. Doxygen ships with an example indexer (doxyindexer) and
+# search engine (doxysearch.cgi) which are based on the open source search
+# engine library Xapian. See the manual for configuration details.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will returned the search results when EXTERNAL_SEARCH is enabled.
+# Doxygen ships with an example search engine (doxysearch) which is based on
+# the open source search engine library Xapian. See the manual for configuration
+# details.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
+# of to a relative location where the documentation can be found.
+# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4 will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = tikz
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
+# or other source files which should be copied to the LaTeX output directory.
+# Note that the files will be copied as-is; there are no commands or markers
+# available.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load style sheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
+# that can be used to generate PDF.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it. If left blank docbook will be used as the default path.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
+# doxygen is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
+# in the related pages index. If set to NO, only the current project's
+# pages will be listed.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 4
+
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
+
+DOT_FONTNAME           = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# manageable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           = @CMAKE_SOURCE_DIR@/src/pics
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..042ce02
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,106 @@
+# ToDo: recheck here and everywhere whether all listed
+# _PUBLIC_HEADERS are indeed needed and if not move them
+# to the _SOURCES (or _PRIVATE_HEADERS?)
+
+add_subdirectory(acl)
+add_subdirectory(data)
+add_subdirectory(math)
+add_subdirectory(num)
+add_subdirectory(numExtend)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/acl)
+
+
+# aslCommon
+
+set(aslCommon_PUBLIC_HEADERS
+	utilities/aslParametersManager.h
+	utilities/aslTimeStamp.h
+	aslUtilities.h
+)
+
+set(aslCommon_SOURCES
+	${aslCommon_PUBLIC_HEADERS}
+	utilities/aslParametersManager.cxx
+	utilities/aslTimeStamp.cxx
+	aslUtilities.cxx
+)
+
+add_library(aslCommon ${aslCommon_SOURCES})
+target_link_libraries(aslCommon ${Boost_LIBRARIES})
+INSTALL_SUBLIB(aslCommon aslCommon_PUBLIC_HEADERS)
+
+
+# asl
+
+set(asl_PUBLIC_HEADERS
+	aslGenerators.h
+	utilities/aslTimer.h
+	utilities/aslUValue.h
+	utilities/aslGlobalSpace.h
+	utilities/aslSmartPtrUtils.h
+	writers/aslABDFormat.h
+	writers/aslWriter.h
+	aslDataInc.h
+	aslGeomInc.h
+)
+
+set(asl_SOURCES
+	${asl_PUBLIC_HEADERS}
+	aslGenerators.cxx
+	writers/aslABDFormat.cxx
+	writers/aslWriter.cxx
+	aslDataInc.cxx
+	aslGeomInc.cxx
+)
+
+add_library(asl ${asl_SOURCES})
+target_link_libraries(asl aslCommon aslacl asldata aslmath ${Boost_LIBRARIES})
+INSTALL_SUBLIB(asl asl_PUBLIC_HEADERS)
+
+
+# aslvtk
+
+set(aslvtk_PUBLIC_HEADERS
+	utilities/aslVTKCasters.h
+	utilities/aslVTKDataGenerators.h
+	writers/aslVTKFormatWriters.h
+	readers/aslVTKFormatReaders.h
+)
+
+set(aslvtk_SOURCES
+	${aslvtk_PUBLIC_HEADERS}
+	utilities/aslVTKCasters.cxx
+	utilities/aslVTKDataGenerators.cxx
+	writers/aslVTKFormatWriters.cxx
+	readers/aslVTKFormatReaders.cxx
+)
+
+add_library(aslvtk ${aslvtk_SOURCES})
+target_link_libraries(aslvtk ${VTK_LIBRARIES} ${OpenCL_LIBRARIES})
+INSTALL_SUBLIB(aslvtk aslvtk_PUBLIC_HEADERS)
+
+
+# aslmatio
+
+if (WITH_MATIO)
+	find_package(MATIO 1.5.2 REQUIRED)
+	include_directories(SYSTEM ${MATIO_INCLUDE_DIRS} ${OpenCL_LIBRARIES})
+	set(CMAKE_CXX_FLAGS "-fpermissive -Wall -O3 -std=c++11")
+
+	set(aslmatio_PUBLIC_HEADERS
+		utilities/aslMATLABCasters.h
+		writers/aslMATFormat.h
+	)
+
+	set(aslmatio_SOURCES
+		${aslmatio_PUBLIC_HEADERS}
+		utilities/aslMATLABCasters.cxx
+		writers/aslMATFormat.cxx
+	)
+
+	add_library(aslmatio ${aslmatio_SOURCES})
+	target_link_libraries(aslmatio ${MATIO_LIBRARIES})
+	INSTALL_SUBLIB(aslmatio aslmatio_PUBLIC_HEADERS)
+endif (WITH_MATIO)
+
diff --git a/src/acl/CMakeLists.txt b/src/acl/CMakeLists.txt
new file mode 100644
index 0000000..33b0b60
--- /dev/null
+++ b/src/acl/CMakeLists.txt
@@ -0,0 +1,67 @@
+add_subdirectory(Operators)
+add_subdirectory(aclMath)
+
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslacl
+
+set(aslacl_PUBLIC_HEADERS
+	aclStdIncludes.h 
+	aclTypesList.h 
+	aclTypes.h 
+	acl.h 
+	aclHardware.h
+	aclUtilities.h
+	DataTypes/aclConstant.h
+	DataTypes/aclIndex.h 
+	DataTypes/aclGroupID.h
+	DataTypes/aclIndexExt.h 
+	DataTypes/aclPrivateVariable.h 
+	DataTypes/aclPrivateArray.h
+	DataTypes/aclLocalArray.h
+	DataTypes/aclVariable.h 
+	DataTypes/aclVariableReference.h 
+	DataTypes/aclVariableSP.h
+	DataTypes/aclMemBlock.h
+	DataTypes/aclArray.h
+	DataTypes/aclSubvector.h
+	Kernels/aclExpressionContainer.h
+	Kernels/aclKernel.h
+	Kernels/aclKernelConfiguration.h
+	Kernels/aclKernelConfigurationTemplates.h
+	Kernels/aclKernelMerger.h
+	aclElementBase.h
+	aclGenerators.h
+)
+
+set(aslacl_SOURCES
+	${aslacl_PUBLIC_HEADERS}
+	acl.cxx 
+	aclHardware.cxx
+	aclUtilities.cxx 
+	DataTypes/aclConstant.cxx
+	DataTypes/aclIndex.cxx
+	DataTypes/aclGroupID.cxx
+	DataTypes/aclIndexExt.cxx
+	DataTypes/aclPrivateVariable.cxx 
+	DataTypes/aclPrivateArray.cxx
+	DataTypes/aclLocalArray.cxx
+	DataTypes/aclVariable.cxx 
+	DataTypes/aclVariableReference.cxx 
+	DataTypes/aclVariableSP.cxx 
+	DataTypes/aclMemBlock.cxx
+	DataTypes/aclArray.cxx
+	DataTypes/aclSubvector.cxx
+	Kernels/aclExpressionContainer.cxx
+	Kernels/aclKernel.cxx
+	Kernels/aclKernelConfiguration.cxx
+	Kernels/aclKernelConfigurationTemplates.cxx
+	Kernels/aclKernelMerger.cxx
+	aclElementBase.cxx
+	aclGenerators.cxx
+)
+
+add_library(aslacl ${aslacl_SOURCES})
+target_link_libraries(aslacl aslCommon aslaclOperators aslaclMath ${OpenCL_LIBRARIES})
+INSTALL_SUBLIB(aslacl aslacl_PUBLIC_HEADERS)
diff --git a/src/acl/DataTypes/aclArray.cxx b/src/acl/DataTypes/aclArray.cxx
new file mode 100644
index 0000000..f2a1d37
--- /dev/null
+++ b/src/acl/DataTypes/aclArray.cxx
@@ -0,0 +1,44 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclArray.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+	template <> unsigned int Array<cl_int>::id(0);
+	template <> const string Array<cl_int>::prefix("a_i");
+
+	template <> unsigned int Array<cl_uint>::id(0);
+	template <> const string Array<cl_uint>::prefix("a_ui");
+
+	template <> unsigned int Array<cl_float>::id(0);
+	template <> const string Array<cl_float>::prefix("a_f");
+
+	template <> unsigned int Array<cl_double>::id(0);
+	template <> const string Array<cl_double>::prefix("a_d");
+
+	template <> unsigned int Array<cl_long>::id(0);
+	template <> const string Array<cl_long>::prefix("a_l");
+	
+}
diff --git a/src/acl/DataTypes/aclArray.h b/src/acl/DataTypes/aclArray.h
new file mode 100644
index 0000000..d1da6f7
--- /dev/null
+++ b/src/acl/DataTypes/aclArray.h
@@ -0,0 +1,136 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLARRAY_H
+#define ACLARRAY_H
+
+#include "../aclStdIncludes.h"
+#include "aclMemBlock.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+	/// Global array
+	template <typename T> class Array: public MemBlock
+	{
+		protected:
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			explicit Array(unsigned int size, CommandQueue queue_ = hardware.defaultQueue);
+			Array(unsigned int size, T *initArray, CommandQueue queue_ = hardware.defaultQueue);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getAddressSpaceQualifier() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+			/// swaps buffer values of this vector and vector \p a;
+	};
+
+	typedef shared_ptr<Array<cl_int> > ElementArrayInt;
+	typedef shared_ptr<Array<cl_float> > ElementArrayFloat;
+	typedef shared_ptr<Array<cl_double> > ElementArrayDouble;
+	typedef shared_ptr<Array<cl_long> > ElementArrayLong;
+	
+//------------------- Implementation -------------------------------
+	
+	template <typename T> Array<T>::Array(unsigned int size_, CommandQueue queue_):
+		MemBlock(size_, typeToTypeID<T>(), queue_)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> Array<T>::Array(unsigned int size_, T *initArray, CommandQueue queue_):
+		MemBlock(size_, typeToTypeID<T>(), queue_, (char*)initArray)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+
+	template <typename T> string Array<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string Array<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		if (kernelConfig.unaligned && kernelConfig.vectorWidth > 1)
+		{
+			return "vload" + numToStr(kernelConfig.vectorWidth) + "(0, &" + name + "[" + INDEX + "])";
+		}
+		else
+		{
+			return name + "[" + INDEX + "]";
+		}
+	}
+
+
+	template <typename T> string Array<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "__global " + typeToStr<T>(kernelConfig.unaligned ? 1 : kernelConfig.vectorWidth) + " *" + name;
+	}
+
+
+	template <typename T> string Array<T>::getAddressSpaceQualifier() const
+	{
+		return "__global";
+	}
+	
+
+	template <typename T> string Array<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	// Must be empty. Only operators can add arguments.
+	template <typename T> 
+	void Array<T>::addToKernelSource(vector<Element> & arguments, vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	template <typename T> 
+	void Array<T>::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+		cl_int status = 0;		
+		status = kernel.setArg(argumentIndex, *buffer);
+		errorMessage(status, "Kernel::setArg() - " + name
+		             + ", argument " + numToStr(argumentIndex));
+	}
+
+
+} // namespace acl
+
+#endif // ACLARRAY_H
diff --git a/src/acl/DataTypes/aclConstant.cxx b/src/acl/DataTypes/aclConstant.cxx
new file mode 100644
index 0000000..db0d4fe
--- /dev/null
+++ b/src/acl/DataTypes/aclConstant.cxx
@@ -0,0 +1,83 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclConstant.h"
+#include "../aclUtilities.h"
+
+#include <math.h>
+#include "aclTypesList.h"
+
+
+namespace acl
+{
+
+	template <typename T> Constant<T>::Constant(T c):
+		ElementBase(false, 0, typeToTypeID<T>()),
+		value(c)
+	{
+		stringstream s;
+		if( value < 0 )
+			s << "(" << value << ")";
+		else
+			s << value;
+		valueStr = s.str();
+	}
+
+	template <> Constant<cl_double>::Constant(cl_double c):
+		ElementBase(false, 0, typeToTypeID<cl_double>()),
+		value(c)
+	{
+		stringstream s;
+		double intp(0.);
+		if (modf(value, &intp) == 0. && std::fabs(value) < 10000)
+			s << value << ".";
+		else
+		{
+			s.precision(20);
+			s << value;
+		}
+		valueStr = s.str();
+	}
+
+	template <> Constant<cl_float>::Constant(cl_float c):
+		ElementBase(false, 0, typeToTypeID<cl_float>()),
+		value(c)
+	{
+		stringstream s;
+		float intp(0.);
+		if (modf(value, &intp) == 0. && std::fabs(value) < 10000)
+			s << value << ".";
+		else
+		{
+			s.precision(10);
+			s << value;
+		}
+		valueStr = s.str();
+	}
+
+	#define BOOST_TT_rep_expression(r,data,t) \
+		template Constant<t>::Constant(t c);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+		
+} // namespace acl
diff --git a/src/acl/DataTypes/aclConstant.h b/src/acl/DataTypes/aclConstant.h
new file mode 100644
index 0000000..09832c8
--- /dev/null
+++ b/src/acl/DataTypes/aclConstant.h
@@ -0,0 +1,91 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLCONSTANT_H
+#define ACLCONSTANT_H
+
+#include "../aclElementBase.h"
+#include "../aclUtilities.h"
+
+namespace acl
+{
+	
+	template <typename T> class Constant: public ElementBase
+	{
+		private:
+			T value;
+			string valueStr;
+		public:
+			explicit Constant(T v);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+
+
+	template <typename T> std::string Constant<T>::getName() const
+	{
+		return valueStr;
+	}
+
+
+	template <typename T> std::string Constant<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return valueStr;
+	}
+
+
+	template <typename T> void Constant<T>::addToKernelSource(vector<Element> & arguments,
+	                                                          vector<Element> & localDeclarations) const
+	{
+	}
+		
+		
+
+	template <typename T> void Constant<T>::setAsArgument(cl::Kernel & kernel,
+	                                                      unsigned int argumentIndex) const
+	{
+	}
+
+
+	template <typename T> string Constant<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> string Constant<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
+
+#endif // ACLCONSTANT_H
diff --git a/src/acl/DataTypes/aclGroupID.cxx b/src/acl/DataTypes/aclGroupID.cxx
new file mode 100644
index 0000000..b9a4100
--- /dev/null
+++ b/src/acl/DataTypes/aclGroupID.cxx
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclGroupID.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+
+	GroupID::GroupID(unsigned int s):
+		ElementBase(false, s, TYPE_UINT)
+	{
+	}
+
+
+	std::string GroupID::getName() const
+	{
+		return "";
+	}
+
+
+	std::string GroupID::str(const KernelConfiguration & kernelConfig) const
+	{
+		return string("groupID");
+	}
+
+
+	void GroupID::addToKernelSource(vector<Element> & arguments, vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	void GroupID::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string GroupID::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string GroupID::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclGroupID.h b/src/acl/DataTypes/aclGroupID.h
new file mode 100644
index 0000000..19b876e
--- /dev/null
+++ b/src/acl/DataTypes/aclGroupID.h
@@ -0,0 +1,46 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLGROUPID_H
+#define ACLGROUPID_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+	
+	class GroupID: public ElementBase
+	{
+		public:
+			GroupID(unsigned int s = 0);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+} // namespace acl
+
+#endif // ACLGROUPID_H
diff --git a/src/acl/DataTypes/aclIndex.cxx b/src/acl/DataTypes/aclIndex.cxx
new file mode 100644
index 0000000..a7771ca
--- /dev/null
+++ b/src/acl/DataTypes/aclIndex.cxx
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclIndex.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+
+	Index::Index(unsigned int s):
+		ElementBase(false, s, TYPE_UINT)
+	{
+	}
+
+
+	std::string Index::getName() const
+	{
+		return "";
+	}
+
+
+	std::string Index::str(const KernelConfiguration & kernelConfig) const
+	{
+		return string(INDEX);
+	}
+
+
+	void Index::addToKernelSource(vector<Element> & arguments, vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	void Index::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string Index::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string Index::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclIndex.h b/src/acl/DataTypes/aclIndex.h
new file mode 100644
index 0000000..6495dd5
--- /dev/null
+++ b/src/acl/DataTypes/aclIndex.h
@@ -0,0 +1,46 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLINDEX_H
+#define ACLINDEX_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+	
+	class Index: public ElementBase
+	{
+		public:
+			Index(unsigned int s = 0);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+} // namespace acl
+
+#endif // ACLINDEX_H
diff --git a/src/acl/DataTypes/aclIndexExt.cxx b/src/acl/DataTypes/aclIndexExt.cxx
new file mode 100644
index 0000000..ea2237b
--- /dev/null
+++ b/src/acl/DataTypes/aclIndexExt.cxx
@@ -0,0 +1,82 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclIndexExt.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+
+
+	IndexExt::IndexExt(unsigned int s):
+		ElementBase(false, s, TYPE_UINT)
+	{
+	}
+
+
+	std::string IndexExt::getName() const
+	{
+		return "";
+	}
+
+
+	std::string IndexExt::str(const KernelConfiguration & kernelConfig) const
+	{
+		if (kernelConfig.vectorWidth == 1)
+			return string(INDEX);
+
+		string s("(uint"+asl::numToStr(kernelConfig.vectorWidth)+")( 0u");
+		for(unsigned int i(1); i < kernelConfig.vectorWidth; ++i)
+			s+= ", " + asl::numToStr(i) + "u";
+		s+=" )";
+
+		if (kernelConfig.unaligned)
+			return "(" + INDEX + "+" + s + ")"; 
+		else
+			return "(" + asl::numToStr(kernelConfig.vectorWidth) + "*" + INDEX + "+" + s + ")"; 			
+	}
+
+
+	void IndexExt::addToKernelSource(vector<Element> & arguments, vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	void IndexExt::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string IndexExt::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string IndexExt::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclIndexExt.h b/src/acl/DataTypes/aclIndexExt.h
new file mode 100644
index 0000000..7881b7b
--- /dev/null
+++ b/src/acl/DataTypes/aclIndexExt.h
@@ -0,0 +1,57 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLINDEXEXT_H
+#define ACLINDEXEXT_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+	/**
+	 The class creates OpenCl code which corresponds to "index" for the case 
+	 with simple kernel. This means that in the case of kernel with vector length v
+	 and unaligned = false it generates code
+	 \code
+	 	{v*index, v*index+1, ... , v*index+v-1}
+	 \endcode
+	 with vector length v and unaligned = true it generates code
+	 \code
+	 	{index, index+1, ... , index+v-1}
+	 \endcode
+	 */
+	class IndexExt: public ElementBase
+	{
+		public:
+			IndexExt(unsigned int s = 0);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+} // namespace acl
+
+#endif // ACLINDEXEXT_H
diff --git a/src/acl/DataTypes/aclLocalArray.cxx b/src/acl/DataTypes/aclLocalArray.cxx
new file mode 100644
index 0000000..1e64b37
--- /dev/null
+++ b/src/acl/DataTypes/aclLocalArray.cxx
@@ -0,0 +1,44 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclLocalArray.h"
+
+namespace acl
+{
+
+	template <> unsigned int LocalArray<cl_int>::id(0);
+	template <> const string LocalArray<cl_int>::prefix("la_i");
+
+	template <> unsigned int LocalArray<cl_uint>::id(0);
+	template <> const string LocalArray<cl_uint>::prefix("la_ui");
+	
+	template <> unsigned int LocalArray<cl_float>::id(0);
+	template <> const string LocalArray<cl_float>::prefix("la_f");
+
+	template <> unsigned int LocalArray<cl_double>::id(0);
+	template <> const string LocalArray<cl_double>::prefix("la_d");
+
+	template <> unsigned int LocalArray<cl_long>::id(0);
+	template <> const string LocalArray<cl_long>::prefix("la_l");
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclLocalArray.h b/src/acl/DataTypes/aclLocalArray.h
new file mode 100644
index 0000000..6a76143
--- /dev/null
+++ b/src/acl/DataTypes/aclLocalArray.h
@@ -0,0 +1,121 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLLOCALARRAY_H
+#define ACLLOCALARRAY_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+
+	/** 
+		This Element appears in the Kernel source code as a local array.
+		It is not passed to the Kernel as an argument.
+	*/
+	template <typename T> class LocalArray: public ElementBase
+	{
+		private:
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			explicit LocalArray(unsigned int size_);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getAddressSpaceQualifier() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+	template <typename T> LocalArray<T>::LocalArray(unsigned int size_):
+		ElementBase(true, size_, typeToTypeID<T>())
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string LocalArray<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		if (kernelConfig.unaligned && kernelConfig.vectorWidth > 1)
+		{
+			return "vload" + numToStr(kernelConfig.vectorWidth) + "(0, &" + name + "[" + INDEX + "])";
+		}
+		else
+		{
+			return name + "[" + INDEX + "]";
+		}
+	}
+
+
+	template <typename T> string LocalArray<T>::getName() const
+	{
+		return name;
+	}
+		
+
+	template <typename T> string LocalArray<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> string LocalArray<T>::getAddressSpaceQualifier() const
+	{
+		return "__local";
+	}
+
+
+	template <typename T> string LocalArray<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "__local " + typeToStr<T>(kernelConfig.unaligned ? 1 : kernelConfig.vectorWidth)
+				+ " " + name + "[" + asl::numToStr(size + paddingElements(size, kernelConfig)) + "]";
+	}
+
+
+	template <typename T> void LocalArray<T>::addToKernelSource(vector<Element> & arguments,
+	                                                             vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	// can't be set as an argument
+	template <typename T> void LocalArray<T>::setAsArgument(cl::Kernel & kernel,
+	                                                         unsigned int argumentIndex) const
+	{
+	}
+
+
+} // namespace acl
+
+#endif // ACLLOCALARRAY_H
diff --git a/src/acl/DataTypes/aclMemBlock.cxx b/src/acl/DataTypes/aclMemBlock.cxx
new file mode 100644
index 0000000..06c3296
--- /dev/null
+++ b/src/acl/DataTypes/aclMemBlock.cxx
@@ -0,0 +1,152 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclMemBlock.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+
+using namespace asl;
+
+namespace acl
+{
+
+	/// class for compatibility with std::shared_ptr enssure correct unmapping \ingroup LDI
+	/// \todoIgal: maybe pass a MemBlock to the constructor instead of a buffer and a queue?
+	template <typename T> class VectorUnmapper
+	{
+			shared_ptr<cl::Buffer> buffer;
+			CommandQueue queue;
+		public:
+			VectorUnmapper(shared_ptr<cl::Buffer> buffer_, CommandQueue queue_) :
+				buffer(buffer_),
+				queue(queue_)
+			{};
+			
+			inline void operator() (T* d) const
+			{
+				cl_int status = 0;
+				cl::Event event;
+				
+				status = queue->enqueueUnmapMemObject(*buffer,
+						                              d,
+						                              NULL,
+						                              &event);
+				errorMessage(status, "enqueueUnmapMemObject()");
+				status = event.wait();
+				errorMessage(status, "Event::wait() - event");			
+				d = NULL;
+			}
+	};
+
+
+	MemBlock::MemBlock():
+		// typeID fictitious
+		ElementBase(true, 0, TYPE_INT)
+	{
+	    buffer.reset(new cl::Buffer());
+	}
+
+
+	MemBlock::MemBlock(unsigned int size_, TypeID typeID, CommandQueue queue_):
+		ElementBase(true, size_, typeID)
+	{
+		queue = queue_;
+
+		cl_int status = 0;
+
+		// allocate value in GPU memory with padding
+	    buffer.reset(new cl::Buffer(getContext(queue),
+	                                CL_MEM_READ_WRITE,
+	                                size * TYPE_SIZE[typeID] + paddingBytes(size, TYPE_SIZE[typeID], queue),
+	                                NULL,
+	                                &status));
+		errorMessage(status, "cl::Buffer()");
+	}
+
+
+	MemBlock::MemBlock(unsigned int size_, TypeID typeID, char *initArray, CommandQueue queue_):
+		ElementBase(true, size_, typeID)
+	{
+		queue = queue_;
+		
+		cl_int status = 0;
+
+		// allocate value in GPU memory with padding
+	    buffer = shared_ptr<cl::Buffer>(new cl::Buffer(getContext(queue),
+	                                                   CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
+	                                                   size * TYPE_SIZE[typeID] + paddingBytes(size, TYPE_SIZE[typeID], queue),
+	                                                   initArray,
+	                                                   &status));
+		errorMessage(status, "cl::Buffer()");
+	}
+
+
+	cl::Buffer & MemBlock::getBuffer()
+	{
+		return *buffer;
+	}
+
+
+	std::shared_ptr<void> MemBlock::map()
+	{
+		shared_ptr<void> p;
+		if (region.expired())
+		{
+			cl_int status = 0;
+			cl::Event event;
+
+			// blocking_map = CL_TRUE (second argument)
+			// read and write access (third argument)
+			p.reset(queue->enqueueMapBuffer(*buffer,
+				                            CL_TRUE,
+				                            CL_MAP_READ | CL_MAP_WRITE,
+				                            0,
+				                            size * TYPE_SIZE[typeID],
+				                            NULL,
+				                            &event,
+				                            &status),
+			         VectorUnmapper<void> (buffer, queue));
+			errorMessage(status, "enqueueMapBuffer()");
+			status = event.wait();
+			errorMessage(status, "Event::wait() - event");			
+			region = p;
+		}
+		return region.lock();
+	}
+
+
+	void MemBlock::swapBuffers(MemBlock & a)
+	{
+		if (compatible(size, queue, a.getSize(), a.getQueue()))
+		{
+			std::swap(buffer, a.buffer);
+		}
+		else
+		{
+			errorMessage("acl::Vector::swap() - operands are incompatible. \
+				 		 Either they reside on different devices or their sizes do not match: "
+			             + numToStr(size) + " and " + numToStr(a.size));
+		}
+	}
+}
diff --git a/src/acl/DataTypes/aclMemBlock.h b/src/acl/DataTypes/aclMemBlock.h
new file mode 100644
index 0000000..d274f61
--- /dev/null
+++ b/src/acl/DataTypes/aclMemBlock.h
@@ -0,0 +1,79 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLMEMBLOCK_H
+#define ACLMEMBLOCK_H
+
+#include "../aclStdIncludes.h"
+#include "../aclElementBase.h"
+#include "../aclUtilities.h"
+#include <aslUtilities.h>
+#include "../aclHardware.h"
+
+
+// using namespace asl;
+// using shared_ptr;
+namespace acl
+{
+
+	class MemBlock: public ElementBase
+	{
+		protected:
+			shared_ptr<cl::Buffer> buffer; //< pointer in gpu
+			weak_ptr<void> region;
+			MemBlock();
+			MemBlock(unsigned int size, TypeID typeID, CommandQueue queue_);
+			MemBlock(unsigned int size, TypeID typeID, char *initArray, CommandQueue queue_);
+			virtual void swapBuffers(MemBlock & a);
+		public:
+			virtual cl::Buffer &getBuffer();
+			shared_ptr<void> map();
+			friend inline void swapBuffers(MemBlock & a, MemBlock & b);
+	};
+
+	typedef shared_ptr<MemBlock> ElementData;
+	inline void swapBuffers(MemBlock & a, MemBlock & b);
+
+	
+	template<typename T> inline std::shared_ptr<T> map(ElementData m);
+	
+// --------------------Implementation -----------------------
+
+	inline void swapBuffers(MemBlock & a, MemBlock & b)
+	{
+		a.swapBuffers(b);
+	}
+
+
+	template<typename T> inline std::shared_ptr<T> map(ElementData m)
+	{
+		if (m->getTypeID() != typeToTypeID<T>())
+			asl::errorMessage ("map: there is attempt to cast pointer with type " + 
+			              typeToStr<T>() +
+			              " for an element  with type " +
+			              TYPE[m->getTypeID()]);
+		return std::shared_ptr<T> (m->map(),(T*)m->map().get());
+	}
+} // namespace acl
+
+#endif // ACLVECTOR_H
diff --git a/src/acl/DataTypes/aclPrivateArray.cxx b/src/acl/DataTypes/aclPrivateArray.cxx
new file mode 100644
index 0000000..17406ad
--- /dev/null
+++ b/src/acl/DataTypes/aclPrivateArray.cxx
@@ -0,0 +1,44 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclPrivateArray.h"
+
+namespace acl
+{
+
+	template <> unsigned int PrivateArray<cl_int>::id(0);
+	template <> const string PrivateArray<cl_int>::prefix("pa_i");
+
+	template <> unsigned int PrivateArray<cl_uint>::id(0);
+	template <> const string PrivateArray<cl_uint>::prefix("pa_ui");
+	
+	template <> unsigned int PrivateArray<cl_float>::id(0);
+	template <> const string PrivateArray<cl_float>::prefix("pa_f");
+
+	template <> unsigned int PrivateArray<cl_double>::id(0);
+	template <> const string PrivateArray<cl_double>::prefix("pa_d");
+
+	template <> unsigned int PrivateArray<cl_long>::id(0);
+	template <> const string PrivateArray<cl_long>::prefix("pa_l");
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclPrivateArray.h b/src/acl/DataTypes/aclPrivateArray.h
new file mode 100644
index 0000000..3b87caf
--- /dev/null
+++ b/src/acl/DataTypes/aclPrivateArray.h
@@ -0,0 +1,131 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLPRIVATEARRAY_H
+#define ACLPRIVATEARRAY_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+
+	/** 
+		This Element appears in the Kernel source code
+	 	as a private array (without address space qualifier).
+		It is not passed to the Kernel as an argument.
+	*/
+	template <typename T> class PrivateArray: public ElementBase
+	{
+		private:
+			string name;
+			static const string prefix;
+			static unsigned int id;
+			vector<T> initVector;
+		public:
+			explicit PrivateArray(const vector<T> & initVector_);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getAddressSpaceQualifier() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+	template <typename T> PrivateArray<T>::PrivateArray(const vector<T> & initVector_):
+		ElementBase(true, initVector_.size(), typeToTypeID<T>()),
+		initVector(initVector_)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string PrivateArray<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		if (kernelConfig.vectorWidth > 1)
+		{
+			errorMessage("PrivateArray should not be used in a SIMD Kernel");
+			return "";
+		}
+		else
+			return name + "[" + INDEX + "]";
+	}
+
+
+	template <typename T> string PrivateArray<T>::getName() const
+	{
+		return name;
+	}
+		
+
+	template <typename T> string PrivateArray<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> string PrivateArray<T>::getAddressSpaceQualifier() const
+	{
+		return "__private";
+	}
+
+
+	template <typename T> string PrivateArray<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		string s = typeToStr<T>() + " " + name + "[" + asl::numToStr(size) + "] = {";
+
+		for (unsigned int i = 0; i < size; ++i)
+			s += numToStr(initVector[i]) + ", ";
+
+		// drop last ", "
+		s.erase(s.size() - 2);
+		s += "}";
+			
+		return s;
+	}
+
+
+	template <typename T> void PrivateArray<T>::addToKernelSource(vector<Element> & arguments,
+	                                                              	                                                              vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	// can't be set as an argument
+	template <typename T> void PrivateArray<T>::setAsArgument(cl::Kernel & kernel,
+	                                                         unsigned int argumentIndex) const
+	{
+	}
+
+
+} // namespace acl
+
+#endif // ACLPRIVATEARRAY_H
diff --git a/src/acl/DataTypes/aclPrivateVariable.cxx b/src/acl/DataTypes/aclPrivateVariable.cxx
new file mode 100644
index 0000000..05dacd9
--- /dev/null
+++ b/src/acl/DataTypes/aclPrivateVariable.cxx
@@ -0,0 +1,46 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclPrivateVariable.h"
+#include "../aclUtilities.h"
+
+namespace acl
+{
+
+	template <> unsigned int PrivateVariable<cl_int>::id(0);
+	template <> const string PrivateVariable<cl_int>::prefix("pv_i");
+
+	template <> unsigned int PrivateVariable<cl_uint>::id(0);
+	template <> const string PrivateVariable<cl_uint>::prefix("pv_ui");
+
+	template <> unsigned int PrivateVariable<cl_float>::id(0);
+	template <> const string PrivateVariable<cl_float>::prefix("pv_f");
+
+	template <> unsigned int PrivateVariable<cl_double>::id(0);
+	template <> const string PrivateVariable<cl_double>::prefix("pv_d");
+
+	template <> unsigned int PrivateVariable<cl_long>::id(0);
+	template <> const string PrivateVariable<cl_long>::prefix("pv_l");
+	
+	
+} // namespace acl
diff --git a/src/acl/DataTypes/aclPrivateVariable.h b/src/acl/DataTypes/aclPrivateVariable.h
new file mode 100644
index 0000000..4622a69
--- /dev/null
+++ b/src/acl/DataTypes/aclPrivateVariable.h
@@ -0,0 +1,109 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLPRIVATEVARIABLE_H
+#define ACLPRIVATEVARIABLE_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+namespace acl
+{
+	/** 
+		This Element appears in the Kernel source code
+	 	as a private variable (without address space qualifier).
+		It is not passed to the Kernel as an argument.
+	*/
+	template <typename T> class PrivateVariable: public ElementBase
+	{
+		private:
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			PrivateVariable();
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getAddressSpaceQualifier() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+	template <typename T> PrivateVariable<T>::PrivateVariable():
+		ElementBase(true, 0, typeToTypeID<T>())
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string PrivateVariable<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return name;
+	}
+
+	template <typename T> string PrivateVariable<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string PrivateVariable<T>::getAddressSpaceQualifier() const
+	{
+		return "__private";
+	}
+
+
+	template <typename T> string PrivateVariable<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> string PrivateVariable<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return typeToStr<T>(kernelConfig.vectorWidth) + " " + name;
+	}
+
+
+	template <typename T> void PrivateVariable<T>::addToKernelSource(vector<Element> & arguments,
+	                                                                 vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	/// can't be set as an argument
+	template <typename T> void PrivateVariable<T>::setAsArgument(cl::Kernel & kernel,
+	                                                             unsigned int argumentIndex) const
+	{
+	}
+
+} // namespace acl
+
+#endif /* ACLPRIVATEVARIABLE_H */
+
diff --git a/src/acl/DataTypes/aclSubvector.cxx b/src/acl/DataTypes/aclSubvector.cxx
new file mode 100644
index 0000000..580b39a
--- /dev/null
+++ b/src/acl/DataTypes/aclSubvector.cxx
@@ -0,0 +1,46 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclSubvector.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+
+	
+	template <> unsigned int Subvector<cl_int>::id(0);
+	template <> const string Subvector<cl_int>::prefix("svi");
+
+	template <> unsigned int Subvector<cl_uint>::id(0);
+	template <> const string Subvector<cl_uint>::prefix("svui");
+	
+	template <> unsigned int Subvector<cl_float>::id(0);
+	template <> const string Subvector<cl_float>::prefix("svf");
+
+	template <> unsigned int Subvector<cl_double>::id(0);
+	template <> const string Subvector<cl_double>::prefix("svd");
+
+	template <> unsigned int Subvector<cl_long>::id(0);
+	template <> const string Subvector<cl_long>::prefix("svl");
+
+}
diff --git a/src/acl/DataTypes/aclSubvector.h b/src/acl/DataTypes/aclSubvector.h
new file mode 100644
index 0000000..57a38ad
--- /dev/null
+++ b/src/acl/DataTypes/aclSubvector.h
@@ -0,0 +1,143 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLSUBVECTOR_H
+#define ACLSUBVECTOR_H
+
+#include <CL/cl.hpp>
+#include "aclArray.h"
+#include "../../aslUtilities.h"
+
+///\todo{Add padding at the end?}
+
+namespace acl
+{
+
+	template <typename T> class Subvector: public MemBlock
+	{
+		private:
+			string name;
+			static const string prefix;
+			static unsigned int id;			
+			unsigned int offset;
+			shared_ptr<Array<T> > vector;
+			cl_buffer_region buffer_create_info;
+		public:
+			Subvector(shared_ptr<Array<T> > vector_,
+			          unsigned int size_,
+			          unsigned int offset_);
+			virtual cl::Buffer &getBuffer();
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(std::vector<Element> & arguments,
+			                               std::vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;			
+	};
+
+
+
+//---------------------------- Implementations------------------------
+
+	template <typename T> Subvector<T>::Subvector(shared_ptr<Array<T> > vector_,
+	                                              unsigned int size_,
+	                                              unsigned int offset_):
+		MemBlock(),
+		offset(offset_),
+		vector(vector_)
+	{
+		size = size_;
+		queue = vector_->getQueue();
+		if ( (offset + size) > vector->getSize() )
+		{
+			errorMessage("Subvector::Subvector() - (offset + size) > vector->getSize()");
+		}
+		else
+		{
+			buffer_create_info.origin = offset * sizeof(T);
+			buffer_create_info.size = size * sizeof(T);
+		}
+		
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> cl::Buffer &Subvector<T>::getBuffer()
+	{
+		cl_int status = 0;
+		///  if original buffer is moved within GPU memory	
+		*buffer = vector->getBuffer().createSubBuffer(CL_MEM_READ_WRITE,
+		                                              CL_BUFFER_CREATE_TYPE_REGION,
+		                                              &buffer_create_info,
+		                                              &status);
+		errorMessage(status, "Subvector::Subvector() - createSubBuffer()");
+
+		return *buffer;
+	}
+
+
+	template <typename T> string Subvector<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string Subvector<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return name + "[" + INDEX + "]";
+	}
+
+
+	template <typename T> string Subvector<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "__global " + typeToStr<T>(kernelConfig.vectorWidth) + " *" + name;
+	}
+
+
+	template <typename T> string Subvector<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	// Must be empty. Only operators can add arguments.
+	template <typename T> 
+	void Subvector<T>::addToKernelSource(std::vector<Element> & arguments,
+	                                     std::vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	template <typename T> 
+	void Subvector<T>::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+		cl_int status = 0;		
+		status = kernel.setArg(argumentIndex, *buffer);
+		errorMessage(status, "Kernel::setArg() - " + name + ", argument " + numToStr(argumentIndex));
+	}
+
+} // namespace acl
+
+#endif // ACLSUBVECTOR_H
diff --git a/src/acl/DataTypes/aclVariable.cxx b/src/acl/DataTypes/aclVariable.cxx
new file mode 100644
index 0000000..b52562a
--- /dev/null
+++ b/src/acl/DataTypes/aclVariable.cxx
@@ -0,0 +1,58 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclVariable.h"
+#include "../aclUtilities.h"
+#include "../aclTypesList.h"
+#include "../aclHardware.h"
+
+namespace acl
+{
+
+
+	template <> unsigned int Variable<cl_int>::id(0);
+	template <> const string Variable<cl_int>::prefix("v_i");
+
+	template <> unsigned int Variable<cl_uint>::id(0);
+	template <> const string Variable<cl_uint>::prefix("v_ui");
+
+	template <> unsigned int Variable<cl_float>::id(0);
+	template <> const string Variable<cl_float>::prefix("v_f");
+
+	template <> unsigned int Variable<cl_double>::id(0);
+	template <> const string Variable<cl_double>::prefix("v_d");
+
+	template <> unsigned int Variable<cl_long>::id(0);
+	template <> const string Variable<cl_long>::prefix("v_l");
+
+	template <typename T> string Variable<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return TYPE[typeID] + " " + name;
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template string Variable<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const;
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclVariable.h b/src/acl/DataTypes/aclVariable.h
new file mode 100644
index 0000000..64a263c
--- /dev/null
+++ b/src/acl/DataTypes/aclVariable.h
@@ -0,0 +1,111 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVARIABLE_H
+#define ACLVARIABLE_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+	template <typename T> class Variable: public ElementBase
+	{
+		private:
+			T value;
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			explicit Variable(T v);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+			virtual const T getValue() const;
+			void setValue(const T & a);
+	};
+
+
+	template <typename T> Variable<T>::Variable(T v):
+		ElementBase(true, 0, typeToTypeID<T>()),
+		value(v)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string Variable<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string Variable<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return name;
+	}
+
+	template <typename T> string Variable<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> void Variable<T>::addToKernelSource(vector<Element> & arguments,
+	                                                          vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	template <typename T> void Variable<T>::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+		cl_int status = 0;		
+		status = kernel.setArg(argumentIndex, value);
+		errorMessage(status, "Kernel::setArg() - " + name + ", argument " + asl::numToStr(argumentIndex));
+	}
+
+
+	template <typename T>  const T Variable<T>::getValue() const
+	{
+		return value;
+	}
+
+
+	template <typename T> void Variable<T>::setValue(const T & a)
+	{
+		value = a;
+	}
+
+		
+} // namespace acl
+
+#endif // ACLVARIABLE_H
diff --git a/src/acl/DataTypes/aclVariableReference.cxx b/src/acl/DataTypes/aclVariableReference.cxx
new file mode 100644
index 0000000..82bbd6b
--- /dev/null
+++ b/src/acl/DataTypes/aclVariableReference.cxx
@@ -0,0 +1,61 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclVariableReference.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+#include "../aclTypesList.h"
+#include "../aclHardware.h"
+
+
+namespace acl
+{
+
+
+	template <> unsigned int VariableReference<cl_int>::id(0);
+	template <> const string VariableReference<cl_int>::prefix("vr_i");
+
+	template <> unsigned int VariableReference<cl_uint>::id(0);
+	template <> const string VariableReference<cl_uint>::prefix("vr_ui");
+	
+	template <> unsigned int VariableReference<cl_float>::id(0);
+	template <> const string VariableReference<cl_float>::prefix("vr_f");
+
+	template <> unsigned int VariableReference<cl_double>::id(0);
+	template <> const string VariableReference<cl_double>::prefix("vr_d");
+
+	template <> unsigned int VariableReference<cl_long>::id(0);
+	template <> const string VariableReference<cl_long>::prefix("vr_l");
+
+	template <typename T> string VariableReference<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return TYPE[typeID] + " " + name;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template string VariableReference<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const;
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+
+} // namespace acl
diff --git a/src/acl/DataTypes/aclVariableReference.h b/src/acl/DataTypes/aclVariableReference.h
new file mode 100644
index 0000000..8317565
--- /dev/null
+++ b/src/acl/DataTypes/aclVariableReference.h
@@ -0,0 +1,97 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVARIABLEREFERENCE_H
+#define ACLVARIABLEREFERENCE_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+	template <typename T> class VariableReference: public ElementBase
+	{
+		private:
+			T & value;
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			explicit VariableReference(T & v);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+	template <typename T> VariableReference<T>::VariableReference(T & v):
+		ElementBase(true, 0, typeToTypeID<T>()),
+		value(v)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string VariableReference<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string VariableReference<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return name;
+	}
+
+
+	template <typename T> string VariableReference<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> void VariableReference<T>::addToKernelSource(vector<Element> & arguments,
+	                                                          vector<Element> & localDeclarations) const
+	{
+	}
+
+	template <typename T> void VariableReference<T>::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+		cl_int status = 0;		
+		status = kernel.setArg(argumentIndex, value);
+		errorMessage(status, "Kernel::setArg() - " + name + ", argument " + asl::numToStr(argumentIndex));
+	}
+
+		
+} // namespace acl
+
+#endif // ACLVARIABLE_H
diff --git a/src/acl/DataTypes/aclVariableSP.cxx b/src/acl/DataTypes/aclVariableSP.cxx
new file mode 100644
index 0000000..b59fe4f
--- /dev/null
+++ b/src/acl/DataTypes/aclVariableSP.cxx
@@ -0,0 +1,58 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclVariableSP.h"
+#include "../aclUtilities.h"
+#include "../aclTypesList.h"
+#include "../aclHardware.h"
+
+
+namespace acl
+{
+
+
+	template <> unsigned int VariableSP<cl_int>::id(0);
+	template <> const string VariableSP<cl_int>::prefix("vsp_i");
+
+	template <> unsigned int VariableSP<cl_uint>::id(0);
+	template <> const string VariableSP<cl_uint>::prefix("vsp_ui");
+
+	template <> unsigned int VariableSP<cl_float>::id(0);
+	template <> const string VariableSP<cl_float>::prefix("vsp_f");
+
+	template <> unsigned int VariableSP<cl_double>::id(0);
+	template <> const string VariableSP<cl_double>::prefix("vsp_d");
+
+	template <> unsigned int VariableSP<cl_long>::id(0);
+	template <> const string VariableSP<cl_long>::prefix("vsp_l");
+
+	template <typename T> string VariableSP<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return TYPE[typeID] + " " + name;
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template string VariableSP<T>::getTypeSignature(const KernelConfiguration & kernelConfig) const;
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+} // namespace acl
diff --git a/src/acl/DataTypes/aclVariableSP.h b/src/acl/DataTypes/aclVariableSP.h
new file mode 100644
index 0000000..d831db3
--- /dev/null
+++ b/src/acl/DataTypes/aclVariableSP.h
@@ -0,0 +1,96 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVARIABLESP_H
+#define ACLVARIABLESP_H
+
+#include "../aclElementBase.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+
+
+namespace acl
+{
+
+	template <typename T> class VariableSP: public ElementBase
+	{
+		private:
+			std::shared_ptr<T> value;
+			string name;
+			static const string prefix;
+			static unsigned int id;
+		public:
+			explicit VariableSP(std::shared_ptr<T> v);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+
+
+	template <typename T> VariableSP<T>::VariableSP(std::shared_ptr<T> v):
+		ElementBase(true, 0, typeToTypeID<T>()),
+		value(v)
+	{
+		++id;
+		name = prefix + asl::numToStr(id);
+	}
+
+
+	template <typename T> string VariableSP<T>::getName() const
+	{
+		return name;
+	}
+
+
+	template <typename T> string VariableSP<T>::str(const KernelConfiguration & kernelConfig) const
+	{
+		return name;
+	}
+
+	template <typename T> string VariableSP<T>::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	template <typename T> void VariableSP<T>::addToKernelSource(vector<Element> & arguments,
+	                                                            vector<Element> & localDeclarations) const
+	{
+	}
+
+	template <typename T> void VariableSP<T>::setAsArgument(cl::Kernel & kernel,
+	                                                        unsigned int argumentIndex) const
+	{
+		cl_int status = 0;		
+		status = kernel.setArg(argumentIndex, *value);
+		asl::errorMessage(status, "Kernel::setArg() - " + name + ", argument " + asl::numToStr(argumentIndex));
+	}
+
+		
+} // namespace acl
+
+#endif // ACLVARIABLE_H
diff --git a/src/acl/Kernels/aclExpressionContainer.cxx b/src/acl/Kernels/aclExpressionContainer.cxx
new file mode 100644
index 0000000..8f6e044
--- /dev/null
+++ b/src/acl/Kernels/aclExpressionContainer.cxx
@@ -0,0 +1,103 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclExpressionContainer.h"
+#include "../aclUtilities.h"
+#include "../../aslUtilities.h"
+#include <acl/aclElementBase.h>
+
+
+using namespace std;
+using namespace asl;
+
+namespace acl
+{
+
+	ExpressionContainer::ExpressionContainer():
+		size(0),
+		queue(),
+		regenerateKernelSource(true)
+	{
+	}
+
+
+	void ExpressionContainer::addExpression(Element expression_)
+	{
+		if (compatible(size, queue, expression_))
+		{
+			size = max(size, expression_->getSize());
+
+			if (expression_->getQueue().get() != 0)
+			{
+				queue = expression_->getQueue();
+			}
+			
+			expression.push_back(expression_);
+			addElementToKernelSource(expression_, arguments, localDeclarations);
+			regenerateKernelSource = true;
+		}
+		else
+		{
+			errorMessage("ExpressionContainer::addExpression() - last added expression \
+						 is incompatible with the previous ones. \
+						 Either they reside on different devices or their sizes do not match: "
+			             + numToStr(expression_->getSize()) + " and " + numToStr(size));
+		}
+	}
+
+	
+	void ExpressionContainer::filterDeclarations()
+	{
+		/// sorts all Elements in arguments
+		sort(arguments.begin(), arguments.end());
+		vector<Element>::iterator iter;
+		/// removes consecutive duplicate Elements in arguments
+		iter = unique(arguments.begin(), arguments.end());
+
+		// drop all elements beyond the new end() (= iter) returned by unique
+		arguments.resize(iter - arguments.begin());
+
+
+		/// sorts all Elements in localDeclarations
+		sort(localDeclarations.begin(), localDeclarations.end());
+
+		/// removes consecutive duplicate Elements in localDeclarations
+		iter = unique(localDeclarations.begin(), localDeclarations.end());
+		// drop all elements beyond the new end() (= iter) returned by unique
+		localDeclarations.resize(iter - localDeclarations.begin());
+		
+		/// \todoZeev remember duplicate Elements and create an extra local
+		/// variable for them in order to reduce number of memory reads
+
+		// Maybe use std::set to get rid of duplicates? Like this:
+		// std::set<std::string>   alternatives_set (m_alternatives.begin(), m_alternatives.end());
+		// std::vector<std::string> alternatives_vec (alternatives_set.begin(), alternatives_set.end());
+	}
+
+	unsigned int ExpressionContainer::getSize()
+	{
+		return size;
+	}
+	
+
+} // namespace acl
diff --git a/src/acl/Kernels/aclExpressionContainer.h b/src/acl/Kernels/aclExpressionContainer.h
new file mode 100644
index 0000000..87d49db
--- /dev/null
+++ b/src/acl/Kernels/aclExpressionContainer.h
@@ -0,0 +1,69 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLEXPRESSIONCONTAINER_H
+#define ACLEXPRESSIONCONTAINER_H
+
+#include <vector>
+#include <memory>
+#include <CL/cl.hpp>
+
+
+namespace acl
+{
+
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
+
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+
+	class ExpressionContainer
+	{
+		protected:
+			unsigned int size; //< initialized with 0, is overidden by first addExpression()
+			CommandQueue queue;
+			bool regenerateKernelSource;
+		public:	
+			std::vector<Element> expression;
+		protected:
+			std::vector<Element> arguments;
+			std::vector<Element> localDeclarations;
+			void filterDeclarations();
+		public:
+			ExpressionContainer();
+			void addExpression(Element expression_);		
+			unsigned int getSize();
+			inline const CommandQueue getQueue () const; 
+	};
+
+
+//------------------------------ Imlementation --------------------
+
+	inline const CommandQueue ExpressionContainer::getQueue () const 
+	{
+		return queue;
+	}
+	
+} // namespace acl
+
+#endif // ACLEXPRESSIONCONTAINER_H
diff --git a/src/acl/Kernels/aclKernel.cxx b/src/acl/Kernels/aclKernel.cxx
new file mode 100644
index 0000000..fb1a300
--- /dev/null
+++ b/src/acl/Kernels/aclKernel.cxx
@@ -0,0 +1,362 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclKernel.h"
+#include "../aclHardware.h"
+#include <acl/aclElementBase.h>
+#include <iostream>
+#include "../../aslUtilities.h"
+#include <algorithm>
+
+using namespace std;
+using namespace asl;
+
+
+namespace acl
+{
+
+	unsigned int Kernel::kernelNum = 0;
+	
+	Kernel::Kernel(const KernelConfiguration kernelConfig_):
+		groupsNumber(0),
+		kernelConfig(kernelConfig_),
+		kernelSource("")
+	{
+		id = kernelNum;
+		++kernelNum;
+	}
+
+
+	cl_uint Kernel::detectVectorWidth()
+	{
+		vector<cl_uint> widths;
+
+		// get all possible vector widths for this queue
+		for (unsigned int i = 0; i < TYPE.size(); ++i)
+			widths.push_back(getVectorWidth(queue, (TypeID)i));
+
+		cl_uint absoluteMin = *min_element(widths.begin(), widths.end());
+		cl_uint min = *max_element(widths.begin(), widths.end());
+
+		unsigned int i = 0;
+		while ((min > absoluteMin) && (i < arguments.size()))
+		{
+			if (min > widths[arguments[i]->getTypeID()])
+				min =  widths[arguments[i]->getTypeID()];
+			++i;
+		}
+
+		i = 0;
+		while ((min > absoluteMin) && (i < localDeclarations.size()))
+		{
+			if (min > widths[localDeclarations[i]->getTypeID()])
+				min =  widths[localDeclarations[i]->getTypeID()];
+			++i;
+		}
+
+		// Workaround for the case when double vector width is 0.
+		// The code still works, however with acceleration
+		// only for types other than double.
+		min = min == 0 ? 1 : min;
+		return min;
+	}
+
+			
+	// Enables double extension only if there are doubles in the source,
+	// enables right extension (workaround for the incomplete AMD cl_amd_fp64)
+	void enableDoubleExtension(string & kernelSource, const CommandQueue & queue)
+	{
+		if (kernelSource.find(TYPE[TYPE_DOUBLE]) != string::npos)
+		{
+			string availableExtensions = getDevice(queue).getInfo<CL_DEVICE_EXTENSIONS>();
+
+			// workaround for the incomplete AMD cl_amd_fp64.
+			// once AMD implements this extension completely
+			// only the else-block should stay
+			if (availableExtensions.find("cl_amd_fp64") != string::npos)
+			{
+				kernelSource = "#pragma OPENCL EXTENSION cl_amd_fp64 : enable\n" + kernelSource;
+			}
+			else
+			{
+				kernelSource = "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" + kernelSource;
+			}
+		}
+		else
+		{
+			string availableExtensions = getDevice(queue).getInfo<CL_DEVICE_EXTENSIONS>();
+
+			// workaround for the incomplete AMD cl_amd_fp64.
+			// once AMD implements this extension completely
+			// only the else-block should stay
+			if (availableExtensions.find("cl_amd_fp64") != string::npos)
+			{
+				kernelSource = "#pragma OPENCL EXTENSION cl_amd_fp64 : disable\n" + kernelSource;
+			}
+			else
+			{
+				kernelSource = "#pragma OPENCL EXTENSION cl_khr_fp64 : disable\n" + kernelSource;
+			}
+			
+		}
+	}
+
+
+	void Kernel::generateExtensions()
+	{
+		kernelSource = "\n" + kernelSource;
+		for (unsigned int i = 0; i < kernelConfig.extensions.size(); i++)
+		{
+			kernelSource = "#pragma OPENCL EXTENSION " + kernelConfig.extensions[i]
+							+ " : enable\n" + kernelSource;
+		}
+		enableDoubleExtension(kernelSource, queue);
+	}
+
+		
+	void Kernel::generateArguments()
+	{
+		for (unsigned int i = 0; i < arguments.size(); i++)
+		{
+			kernelSource += arguments[i]->getTypeSignature(kernelConfig) + ",\n                       ";
+			for (unsigned int j = 0; j < numToStr(id).size(); ++j)
+			{
+				kernelSource += " ";
+			}
+		}
+		// drop all after the ',' of last parameter
+		kernelSource.erase(kernelSource.size() - 25 - numToStr(id).size());
+		kernelSource += ")\n{\n\t";
+	}
+
+
+	void Kernel::generateIndex()
+	{
+		if (kernelConfig.local)
+		{
+			kernelSource += "uint " + INDEX + " = get_local_id(0);\n\t";
+			kernelSource += "uint groupID = get_group_id(0);\n";
+		}
+		else
+		{
+			if ((kernelConfig.vectorWidth > 1) && (kernelConfig.unaligned))
+			{
+				kernelSource += "uint " + INDEX + " = "
+							 + numToStr(kernelConfig.vectorWidth)
+							 + " * get_global_id(0);\n";
+			}
+			else
+			{
+				kernelSource += "uint " + INDEX + " = get_global_id(0);\n";
+			}
+		}
+	}
+
+
+	void Kernel::generateLocalDeclarations()
+	{
+		for (unsigned int i = 0; i < localDeclarations.size(); i++)
+		{
+			kernelSource += "\t" + localDeclarations[i]->getLocalDeclaration(kernelConfig) + ";\n";
+		}
+	}
+
+
+	void Kernel::generateExpressions()
+	{
+		for (unsigned int i = 0; i < expression.size(); i++)
+		{
+			kernelSource += "\t" + expression[i]->str(kernelConfig)  + ";\n";
+		}
+
+		kernelSource += "}";
+	}
+
+
+	void Kernel::generateKernelSource()
+	{
+		kernelSource = "__kernel void compute_" + numToStr(id) + "(";
+		
+		filterDeclarations();
+
+		generateArguments();
+
+		generateIndex();
+
+		generateLocalDeclarations();
+		
+		generateExpressions();
+
+		// enable extensions in the last step after
+		// the kernel source is available for analysis
+		generateExtensions();
+		
+		regenerateKernelSource = false;
+	}
+
+
+	void Kernel::buildKernel()
+	{
+		cl_int status = 0;
+		
+		cl::Program::Sources source(1, make_pair(kernelSource.data(), kernelSource.size()));
+
+		cl::Program program = cl::Program(getContext(queue), source, &status);
+		errorMessage(status, "Program::Program()");
+		status = program.build(std::vector<cl::Device>(1, getDevice(queue)));
+
+		if (status == CL_BUILD_PROGRAM_FAILURE)
+		{
+			string str = program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(getDevice(queue));
+
+			cout << " \n\t\t\tBUILD LOG\n";
+			cout << " ************************************************\n";
+			cout << str << endl;
+			cout << " ************************************************\n";
+			cout << " \n\t\t\tKERNEL SOURCE CODE\n";
+			cout << " ------------------------------------------------\n";
+			cout << kernelSource << endl;
+			cout << " ------------------------------------------------\n";
+		}
+
+		errorMessage(status, "Program::build()");
+
+		string kernelName;
+		kernelName = "compute_" + numToStr(id);
+		kernel = cl::Kernel(program, kernelName.c_str(), &status);
+		errorMessage(status, "Kernel() - kernelBase_" + numToStr(id));
+//		cout<<"  "<<kernelName<<": privMem="<< getKernelPrivateMemSize(*this)<<endl;
+		
+	}
+
+
+	void Kernel::setKernelArguments()
+	{
+		for (unsigned int i = 0; i < arguments.size(); ++i)
+		{
+			arguments[i]->setAsArgument(kernel, i);
+		}
+	}
+
+
+	void Kernel::updateKernelConfiguration()
+	{
+		// if it is a simd kernel - detect proper vector width
+		if (kernelConfig.vectorWidth > 1) 
+			kernelConfig.vectorWidth = detectVectorWidth();
+	}
+
+
+	void Kernel::setup()
+	{
+		if (size == 0)
+			errorMessage("Kernel::setup() - kernel's size is 0; add proper expression");
+
+		if (kernelConfig.local && (size > getMaxItemSize(queue)))
+			errorMessage("Kernel::setup() - requested group size is larger than supported by device");
+
+		if (kernelConfig.local && (groupsNumber == 0))
+			errorMessage("Kernel::setup() - groups number was not set");
+
+		updateKernelConfiguration();
+		generateKernelSource();
+		buildKernel();
+	}
+
+
+	inline unsigned int paddingElementsSIMD(unsigned int size, unsigned int vectorWidth);
+	
+	void Kernel::compute()
+	{
+		if (regenerateKernelSource)
+			setup();
+	
+		cl_int status = 0;
+		cl::Event event;
+
+		setKernelArguments();
+
+		size_t paddedSize = (size + paddingElementsSIMD(size, kernelConfig.vectorWidth)) / kernelConfig.vectorWidth;
+		// if 4th argument is cl::NullRange - OpenCL implementation
+		// will determine how to break the global work-items into
+		// appropriate work-group instances
+		status = queue->enqueueNDRangeKernel(kernel,
+	 	                                     cl::NullRange,
+	    	                                 kernelConfig.local ? cl::NDRange(groupsNumber * paddedSize) : cl::NDRange(paddedSize),
+	    	                                 kernelConfig.local ? cl::NDRange(paddedSize) : cl::NullRange,
+	    	                                 NULL,
+	    	                                 &event);
+		errorMessage(status, "CommandQueue::enqueueNDRangeKernel() - kernel");
+
+		status = event.wait();
+		errorMessage(status, "Event::wait() - event");
+	}
+
+
+	void Kernel::setGroupsNumber(unsigned int n)
+	{
+		groupsNumber = n;
+	}
+
+	unsigned int Kernel::getGroupsNumber()
+	{
+		return groupsNumber;
+	}		
+
+	string Kernel::getKernelSource()
+	{
+		return kernelSource;
+	}
+
+
+	unsigned int Kernel::getKernelID()
+	{
+		return id;
+	}
+
+
+	const cl::Kernel & Kernel::getKernel() const
+	{
+		return kernel;
+	}
+
+
+	void Kernel::clear()
+	{
+		kernelSource = "__kernel void compute_" + numToStr(id) + "(";
+		regenerateKernelSource = true;
+		expression.clear();
+		localDeclarations.clear();
+		arguments.clear();
+		size = 0;
+	}
+
+
+	inline unsigned int paddingElementsSIMD(unsigned int size, unsigned int vectorWidth)
+	{
+		// second modulo is added in order to make padding = 0 in the case
+		// that size is divisible by vectorWidth
+		return (vectorWidth - (size % vectorWidth)) % vectorWidth;
+	}
+		
+} // namespace acl
diff --git a/src/acl/Kernels/aclKernel.h b/src/acl/Kernels/aclKernel.h
new file mode 100644
index 0000000..d808395
--- /dev/null
+++ b/src/acl/Kernels/aclKernel.h
@@ -0,0 +1,116 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLKERNEL_H
+#define ACLKERNEL_H
+
+#include "aclExpressionContainer.h"
+#include "aclKernelConfiguration.h"
+#include <CL/cl.hpp>
+
+namespace acl
+{
+
+	extern const KernelConfiguration KERNEL_BASIC;
+	
+	/// OpenCl Kernel generator 
+	/**	
+		\ingroup KernelGen
+		\listedNote The kernel can be run without updating of parameters. 
+					This possibility can lead to some optimization.
+	 				to realize this possibility the function
+		 			\p computeWithoutUpdate can be added
+
+	*/
+	class Kernel: public ExpressionContainer
+	{
+		protected:
+			static unsigned int kernelNum;
+			unsigned int id;
+			unsigned int groupsNumber;
+			KernelConfiguration kernelConfig;
+			std::string kernelSource;
+			cl::Kernel kernel;
+
+			/// detects minimal vector width of all available types of Elements
+			cl_uint detectVectorWidth();
+			void generateExtensions();
+			void generateArguments();
+			void generateIndex();
+			void generateLocalDeclarations();
+			void generateExpressions();
+			virtual void generateKernelSource();
+			void updateKernelConfiguration();
+			void buildKernel();
+			void setKernelArguments();
+		public:
+			explicit Kernel(const KernelConfiguration kernelConfig_ = KERNEL_BASIC);
+			/// Prepares kernel for launch.
+			/// Should always be called before compute() after all expressions are added.
+			/// Generates kernel source, builds kernel and set its arguments.
+			void setup();
+			void compute();
+			void setGroupsNumber(unsigned int n);
+			unsigned int getGroupsNumber();			
+			std::string getKernelSource();
+			unsigned int getKernelID();
+			const cl::Kernel & getKernel() const;
+			/// removes all expressions from the kernel
+			void clear();
+			inline const KernelConfiguration & getConfiguration()const;
+
+			friend class KernelMerger;
+	};
+
+	/// \related Kernel
+	typedef std::shared_ptr<Kernel> SPKernel;
+
+	/// creates \p n kernels in \p vk with configuration \p kernelConfig_
+	/// \related Kernel
+	void inline createKernels(std::vector<SPKernel> & vk, 
+	                          unsigned int n, 
+	                          const KernelConfiguration & kernelConfig_ = KERNEL_BASIC);
+		
+
+//---------------------------- Implementation -----------------------------
+
+	void inline createKernels(std::vector<SPKernel> & vk, 
+	                          unsigned int n, 
+	                          const KernelConfiguration & kernelConfig_)
+	{
+		vk.resize(n);
+		for (unsigned int i(0); i < n; ++i)
+		{
+			vk[i].reset(new Kernel(kernelConfig_));
+		}
+	}
+
+	inline const KernelConfiguration & Kernel::getConfiguration()const
+	{
+		return kernelConfig;
+	}
+	
+
+} // namespace acl
+
+#endif // ACLKERNEL_H
diff --git a/src/acl/Kernels/aclKernelConfiguration.cxx b/src/acl/Kernels/aclKernelConfiguration.cxx
new file mode 100644
index 0000000..726fe6e
--- /dev/null
+++ b/src/acl/Kernels/aclKernelConfiguration.cxx
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclKernelConfiguration.h"
+
+
+using namespace std;
+
+namespace acl
+{
+
+KernelConfiguration::KernelConfiguration(bool simd,
+                                         bool unaligned_,
+                                         bool local_):
+	// sets vectorWidth to 2 for now, later it will be automatically
+	// detected and overwritten by the Kernel
+	vectorWidth(simd ? 2 : 1),
+	unaligned(unaligned_),
+	local(local_)
+
+{
+}
+
+
+KernelConfiguration::KernelConfiguration(const KernelConfiguration & kernelConfig_):
+	vectorWidth(kernelConfig_.vectorWidth),
+	unaligned(kernelConfig_.unaligned),
+	local(kernelConfig_.local)
+
+{
+	extensions = kernelConfig_.extensions;
+}
+
+
+bool KernelConfiguration::operator==(const KernelConfiguration & a) const
+{
+	bool equal;
+
+	equal = (vectorWidth == a.vectorWidth)
+			&& (unaligned == a.unaligned)
+			&& (local == a.local)
+			&& (extensions == a.extensions);
+
+	return equal;
+
+}
+
+
+
+} // asl namespace
diff --git a/src/acl/Kernels/aclKernelConfiguration.h b/src/acl/Kernels/aclKernelConfiguration.h
new file mode 100644
index 0000000..3c42d2d
--- /dev/null
+++ b/src/acl/Kernels/aclKernelConfiguration.h
@@ -0,0 +1,52 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLKERNELCONFIGURATION_H
+#define ACLKERNELCONFIGURATION_H
+
+#include <string>
+#include <vector>
+
+namespace acl
+{
+
+	/// ACL Kernel configuration class 	\ingroup KernelGen
+	class KernelConfiguration
+	{
+		public:
+			explicit KernelConfiguration(bool simd = false,
+			                             bool unaligned_ = false,
+			                             bool local_ = false);
+			KernelConfiguration(const KernelConfiguration & kernelConfig_);
+			bool operator==(const KernelConfiguration & a) const;
+
+			unsigned int vectorWidth;
+			bool unaligned;
+			bool local;
+			std::vector<std::string> extensions;
+	};
+
+
+} // acl namespace
+
+#endif // ACLKERNELCONFIGURATION_H
diff --git a/src/acl/Kernels/aclKernelConfigurationTemplates.cxx b/src/acl/Kernels/aclKernelConfigurationTemplates.cxx
new file mode 100644
index 0000000..b8631a8
--- /dev/null
+++ b/src/acl/Kernels/aclKernelConfigurationTemplates.cxx
@@ -0,0 +1,36 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclKernelConfigurationTemplates.h"
+
+using namespace std;
+
+
+namespace acl
+{
+
+	const KernelConfiguration KERNEL_BASIC;
+	const KernelConfiguration KERNEL_SIMD(true);
+	const KernelConfiguration KERNEL_SIMDUA(true, true);
+
+} // asl namespace
diff --git a/src/acl/Kernels/aclKernelConfigurationTemplates.h b/src/acl/Kernels/aclKernelConfigurationTemplates.h
new file mode 100644
index 0000000..9b772cc
--- /dev/null
+++ b/src/acl/Kernels/aclKernelConfigurationTemplates.h
@@ -0,0 +1,45 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLKERNELCONFIGURATIONTEMPLATES_H
+#define ACLKERNELCONFIGURATIONTEMPLATES_H
+
+#include "aclKernelConfiguration.h"
+
+namespace acl
+{
+
+	// GLOBALS
+
+
+	/// \ingroup KernelGen
+	extern const KernelConfiguration KERNEL_BASIC;
+	/// \ingroup KernelGen
+	extern const KernelConfiguration KERNEL_SIMD;
+	/// \ingroup KernelGen
+	extern const KernelConfiguration KERNEL_SIMDUA;
+	
+
+} // acl namespace
+
+#endif // ACLKERNELCONFIGURATIONTEMPLATES_H
diff --git a/src/acl/Kernels/aclKernelMerger.cxx b/src/acl/Kernels/aclKernelMerger.cxx
new file mode 100644
index 0000000..60b64a2
--- /dev/null
+++ b/src/acl/Kernels/aclKernelMerger.cxx
@@ -0,0 +1,184 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclKernelMerger.h"
+#include "aclKernel.h"
+#include <acl/acl.h>
+#include "acl/Operators/aclElementIfElse.h"
+#include "acl/DataTypes/aclIndex.h"
+#include "acl/DataTypes/aclConstant.h"
+#include <aslUtilities.h>
+
+namespace acl
+{
+	KernelMerger::KernelMerger():
+		kernel(new Kernel())
+	{
+	}
+
+
+	void KernelMerger::compute()
+	{
+		kernel->compute();		
+	}
+
+	unsigned int KernelMerger::getKernelSize(unsigned int i)
+	{
+		const KernelConfiguration &kc(kernels[i]->kernelConfig);
+		unsigned int size(kernels[i]->getSize());
+		if (kc.vectorWidth > 1)
+		{
+			size += (kc.vectorWidth - size % kc.vectorWidth) % kc.vectorWidth;
+				return size;
+		}
+		return size;
+	}
+		
+
+	std::string KernelMerger::getKernelSource()
+	{
+		return kernel->getKernelSource();
+	}
+	
+
+	void KernelMerger::clear()
+	{
+		kernels.clear();
+		offsets.clear();
+		kernel->clear();
+	}
+
+
+	void KernelMerger::addKernel(SPKernel k)
+	{
+		kernels.push_back(k);
+	}
+
+
+	void KernelMerger::addKernel(const KernelMerger & km)
+	{
+		for(unsigned int i(0); i < km.kernels.size(); ++i)
+		kernels.push_back(km.kernels[i]);
+	}
+		
+
+	unsigned int KernelMerger::getSize()
+	{
+		return size;
+	}
+
+
+	void KernelMerger::computeOffsets()
+	{
+		size = getKernelSize(0);
+		offsets.resize(kernels.size() - 1);
+		for (unsigned int i(1); i < kernels.size(); ++i)
+		{
+			const KernelConfiguration &kc(kernels[0]->kernelConfig);
+			offsets[i-1] = kc.unaligned ? size : size / kc.vectorWidth;
+			size += getKernelSize(i);
+		}
+	}
+
+
+	void KernelMerger::setup()
+	{
+		if (!kernels.size())
+			asl::errorMessage("KernelMerger::setup() : no kernels have been added."); 
+		if (kernels.size() > 1)
+		{
+			kernel.reset(new Kernel(kernels[0]->kernelConfig));
+			computeOffsets();
+			kernel->addExpression(castSpliter(0, kernels.size() - 1));		
+		}
+		else
+			kernel = kernels[0];
+		kernel->setup();
+	}
+
+
+	void addToIfBody(std::shared_ptr<ElementIfElse> ife,
+	                 std::shared_ptr<Kernel> k,
+	                 unsigned int size)
+	{
+		Element ind(new Index(size));
+		for (unsigned int i(0); i < k->expression.size(); ++i)
+			ife->addBodyExpressionIf(elementOperators::excerpt(k->expression[i], ind));
+	}
+	
+
+	void addToElseBody(std::shared_ptr<ElementIfElse> ife,
+	                   std::shared_ptr<Kernel> k,
+	                   unsigned int size)
+	{
+		Element ind(new Index(size));
+		for (unsigned int i(0); i < k->expression.size(); ++i)
+			ife->addBodyExpressionElse(elementOperators::excerpt(k->expression[i],ind));
+		
+	}
+
+
+	Element KernelMerger::castSpliter(unsigned int i1, unsigned int i2)
+	{
+		Element ind(new Index(size));
+		if (i2 - i1 == 1)
+		{
+			using namespace elementOperators;
+			Element c(new Constant<int>(offsets[i1]));
+			shared_ptr<ElementIfElse> ife(new ElementIfElse(ind < c));
+			if (i1 > 0)
+			{
+				Element c(new Constant<int>(offsets[i1 - 1]));
+				ife->addBodyExpressionIf(ind -= c);
+			}
+			addToIfBody(ife, kernels[i1], size);
+			ife->addBodyExpressionElse(ind -= c);
+			addToElseBody(ife, kernels[i2], size);
+			return ife;
+		}
+		if (i2 - i1 == 2)
+		{
+			using namespace elementOperators;
+			Element c(new Constant<int>(offsets[i1]));
+			shared_ptr<ElementIfElse> ife(new ElementIfElse(ind < c));
+			if (i1 > 0)
+			{
+				Element c(new Constant<int>(offsets[i1 - 1]));
+				ife->addBodyExpressionIf(ind -= c);
+			}
+			addToIfBody(ife, kernels[i1],size);
+			ife->addBodyExpressionElse(castSpliter(i1 + 1, i2));
+			return ife;
+		}
+
+		using namespace elementOperators;
+		unsigned int midi(i1 + (i2 - i1) / 2);
+		Element c(new Constant<int>(offsets[midi]));
+		shared_ptr<ElementIfElse> ife(new ElementIfElse(ind < c));
+		ife->addBodyExpressionIf(castSpliter(i1, midi));
+		ife->addBodyExpressionElse(castSpliter(midi + 1, i2));
+
+		return ife;
+	}	
+	
+} // namespace acl
diff --git a/src/acl/Kernels/aclKernelMerger.h b/src/acl/Kernels/aclKernelMerger.h
new file mode 100644
index 0000000..cf591d4
--- /dev/null
+++ b/src/acl/Kernels/aclKernelMerger.h
@@ -0,0 +1,76 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLKERNELMERGER_H
+#define ACLKERNELMERGER_H
+
+#include <memory>
+#include <vector>
+
+namespace acl
+{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+
+	/// OpenCl Kernel merger 
+	/**	
+		\ingroup KernelGen
+		The KernelMerger generates a big kernel containing differen 
+		kernels. The number of copies is a sum of all kernels and 
+		it realizes tree like "if" "else" structure in order to execute 
+		different kernels
+	*/
+	class KernelMerger
+	{
+		private:
+			std::vector<SPKernel> kernels;
+			SPKernel kernel;
+			unsigned int size;
+			std::vector<unsigned int> offsets;
+
+			unsigned int getKernelSize(unsigned int i);
+			void checkKernelsCompatibility();
+			void computeOffsets();
+			Element castSpliter(unsigned int i1, unsigned int i2);
+		public:
+			KernelMerger();
+			void setup();
+			void compute();
+			std::string getKernelSource();
+			/// removes all kernels
+			void clear();
+			void addKernel(SPKernel k);
+			void addKernel(const KernelMerger & km);
+			unsigned int getSize();
+	};
+
+	/// \related Kernel
+	typedef std::shared_ptr<KernelMerger> SPKernelMerger;
+
+
+	
+} // namespace acl
+
+#endif // ACLKERNELMERGER_H
diff --git a/src/acl/Operators/CMakeLists.txt b/src/acl/Operators/CMakeLists.txt
new file mode 100644
index 0000000..0154013
--- /dev/null
+++ b/src/acl/Operators/CMakeLists.txt
@@ -0,0 +1,61 @@
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslaclOperators
+
+set(aslaclOperators_PUBLIC_HEADERS
+	aclElementAssignmentSafe.h
+	aclElementIfElse.h
+	aclElementSum.h
+	aclElementSubtraction.h
+	aclElementSqrt.h
+	aclElementSin.h
+	aclElementProduct.h
+	aclElementDivision.h
+	aclElementGenericBinary.h
+	aclGenericAtomicFunction.h
+	aclElementGenericUnary.h
+	aclElementCos.h
+	aclElementSelect.h
+	aclElementMad.h
+	aclElementExcerpt.h
+	aclElementParser.h
+	aclElementSyncCopy.h
+	aclOperatorUnary.h
+	aclOperatorBinary.h
+	aclOperatorTernary.h
+	aclOperatorGeneric.h
+	aclElementFor.h
+	aclElementConvert.h
+)
+
+set(aslaclOperators_SOURCES
+	${aslaclOperators_PUBLIC_HEADERS}
+	aclElementAssignmentSafe.cxx
+	aclElementIfElse.cxx
+	aclElementSum.cxx
+	aclElementSubtraction.cxx
+	aclElementSqrt.cxx
+	aclElementSin.cxx
+	aclElementProduct.cxx
+	aclElementDivision.cxx
+	aclElementGenericBinary.cxx
+	aclGenericAtomicFunction.cxx
+	aclElementGenericUnary.cxx
+	aclElementCos.cxx
+	aclElementSelect.cxx
+	aclElementMad.cxx
+	aclElementExcerpt.cxx
+	aclElementParser.cxx
+	aclElementSyncCopy.cxx
+	aclOperatorUnary.cxx
+	aclOperatorBinary.cxx
+	aclOperatorTernary.cxx
+	aclOperatorGeneric.cxx
+	aclElementFor.cxx
+	aclElementConvert.cxx
+)
+
+add_library(aslaclOperators ${aslaclOperators_SOURCES})
+target_link_libraries(aslaclOperators ${OpenCL_LIBRARIES})
+INSTALL_SUBLIB(aslaclOperators aslaclOperators_PUBLIC_HEADERS)
diff --git a/src/acl/Operators/aclElementAssignmentSafe.cxx b/src/acl/Operators/aclElementAssignmentSafe.cxx
new file mode 100644
index 0000000..e27dcbd
--- /dev/null
+++ b/src/acl/Operators/aclElementAssignmentSafe.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementAssignmentSafe.h"
+#include "../../aslUtilities.h"
+#include "../Kernels/aclKernelConfigurationTemplates.h"
+
+namespace acl
+{
+
+
+ElementAssignmentSafe::ElementAssignmentSafe(Element a1, Element a2):
+	OperatorBinary(a1, a2)
+{
+}
+
+string ElementAssignmentSafe::str(const KernelConfiguration & kernelConfig) const
+{
+	string e1s(e1->str(KERNEL_BASIC));
+	string e2s(e2->str(kernelConfig));	
+
+	if (kernelConfig.unaligned && kernelConfig.vectorWidth > 1)
+	{
+		return "vstore" + asl::numToStr(kernelConfig.vectorWidth) + "(" + e2s + ", 0, &" + e1s + ")";
+	}
+	else
+	{
+		return e1s + " = " + e2s;
+	}
+}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementAssignmentSafe.h b/src/acl/Operators/aclElementAssignmentSafe.h
new file mode 100644
index 0000000..b5f7a7c
--- /dev/null
+++ b/src/acl/Operators/aclElementAssignmentSafe.h
@@ -0,0 +1,41 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTASSIGNMENTSAFE_H
+#define ACLELEMENTASSIGNMENTSAFE_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+namespace acl
+{
+
+class ElementAssignmentSafe: public OperatorBinary
+{
+	public:
+		ElementAssignmentSafe(Element a1, Element a2);
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTASSIGNMENTSAFE_H
diff --git a/src/acl/Operators/aclElementConvert.cxx b/src/acl/Operators/aclElementConvert.cxx
new file mode 100644
index 0000000..33a4aa9
--- /dev/null
+++ b/src/acl/Operators/aclElementConvert.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementConvert.h"
+#include <aslUtilities.h>
+#include "../aclHardware.h"
+
+namespace acl
+{
+
+	ElementConvert::ElementConvert(Element a, TypeID type, bool strong):
+		OperatorUnary(a,type),
+		strongForm(strong)
+	{
+	}
+		
+	string ElementConvert::str(const KernelConfiguration & kernelConfig) const
+	{
+		string es(e->str(kernelConfig));
+		string vectorW(kernelConfig.vectorWidth>1 ? 
+		               asl::numToStr(kernelConfig.vectorWidth) :
+			           "");
+		string function;
+		
+		if (strongForm)
+			function="convert_"+TYPE[typeID]+vectorW;
+		else
+			function="("+TYPE[typeID]+vectorW+")";
+		return function+"(" + es + ")";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementConvert.h b/src/acl/Operators/aclElementConvert.h
new file mode 100644
index 0000000..a8c6b7c
--- /dev/null
+++ b/src/acl/Operators/aclElementConvert.h
@@ -0,0 +1,52 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTCONVERT_H
+#define ACLELEMENTCONVERT_H
+
+#include "../Operators/aclOperatorUnary.h"
+
+
+namespace acl
+{
+	///realizes \p convert_ functionality
+	/**
+		\ingroup SpecialPurposeFunctions
+		The element generates code corresponding to convert function with 
+		 an apropriate vector index.
+
+		The \p strong parameter defines the form of the operator: 
+		 convert_ in case of \p true or (type) in case of false 
+	*/
+	class ElementConvert: public OperatorUnary
+	{
+		private: 
+			bool strongForm;
+		public:
+			ElementConvert(Element a, TypeID type, bool strong=true);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+#endif // ACLELEMENTCONVERT_H
diff --git a/src/acl/Operators/aclElementCos.cxx b/src/acl/Operators/aclElementCos.cxx
new file mode 100644
index 0000000..5bb94ae
--- /dev/null
+++ b/src/acl/Operators/aclElementCos.cxx
@@ -0,0 +1,45 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementCos.h"
+
+namespace acl
+{
+
+	ElementCos::ElementCos(Element a):
+		OperatorUnary(a)
+	{
+	}
+		
+	string ElementCos::str(const KernelConfiguration & kernelConfig) const
+	{
+		string es(e->str(kernelConfig));
+		// check for zeros and throw them away
+		if (es == "0" || es == "-0")
+			return "1";
+		else
+			return "cos(" + es + ")";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementCos.h b/src/acl/Operators/aclElementCos.h
new file mode 100644
index 0000000..2d4691b
--- /dev/null
+++ b/src/acl/Operators/aclElementCos.h
@@ -0,0 +1,43 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTCOS_H
+#define ACLELEMENTCOS_H
+
+// ToDo: change to "../aclBaseElement.h" ? and the same in all operators
+#include "../Operators/aclOperatorUnary.h"
+
+
+namespace acl
+{
+
+	class ElementCos: public OperatorUnary
+	{
+		public:
+			ElementCos(Element a);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+#endif // ACLELEMENTCOS_H
diff --git a/src/acl/Operators/aclElementDivision.cxx b/src/acl/Operators/aclElementDivision.cxx
new file mode 100644
index 0000000..1673375
--- /dev/null
+++ b/src/acl/Operators/aclElementDivision.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementDivision.h"
+#include "../../aslUtilities.h"
+
+namespace acl
+{
+
+
+ElementDivision::ElementDivision(Element a1, Element a2):
+	OperatorBinary(a1, a2)
+{
+}
+
+
+string ElementDivision::str(const KernelConfiguration & kernelConfig) const
+{
+	string e1s(e1->str(kernelConfig));
+	string e2s(e2->str(kernelConfig));
+
+	// check for zeros and throw them away
+	if ((e1s != "0") && (e2s != "0") && (e1s != "-0") && (e2s != "-0"))
+		return "(" + e1s + "/" + e2s + ")";
+	else
+		if (((e1s == "0") || (e1s == "-0")) && (e2s != "0") && (e2s != "-0"))
+		    return "0";
+		else
+			asl::errorMessage("Division by zero");
+    return "";
+}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementDivision.h b/src/acl/Operators/aclElementDivision.h
new file mode 100644
index 0000000..deafd21
--- /dev/null
+++ b/src/acl/Operators/aclElementDivision.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTDIVISION_H
+#define ACLELEMENTDIVISION_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+
+namespace acl
+{
+
+class ElementDivision: public OperatorBinary
+{
+	public:
+		ElementDivision(Element a1, Element a2);
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif //ACLELEMENTDIVISION_H
diff --git a/src/acl/Operators/aclElementExcerpt.cxx b/src/acl/Operators/aclElementExcerpt.cxx
new file mode 100644
index 0000000..b25bd41
--- /dev/null
+++ b/src/acl/Operators/aclElementExcerpt.cxx
@@ -0,0 +1,101 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "../aclUtilities.h"
+#include "../../aslUtilities.h"
+#include "aclElementExcerpt.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+ElementExcerpt::ElementExcerpt(Element source_, Element filter_):
+	ElementBase(source_->isWritable, filter_->getSize(), source_->getTypeID())
+{
+	if (onSameDevice(source_, filter_))
+	{
+		source = source_;
+		filter = filter_;
+
+		// filter->getQueue().get() can be 0,
+		// and source->getQueue().get() should not be 0
+		// (but even if it is 0 the statement bellow is correct;
+		// the excerpt() operator will do nothing however in such a case).
+		queue = source->getQueue();
+	}
+	else
+	{
+		errorMessage("ElementExcerpt::ElementExcerpt() - elements reside on different devices");
+	}
+}
+
+
+string ElementExcerpt::str(const KernelConfiguration & kernelConfig) const
+{
+	string s = source->str(kernelConfig);
+	size_t found = s.find(INDEX);
+
+	int filterSize(filter->str(kernelConfig).size());
+	while (found != string::npos)
+	{
+		s.replace(found, INDEX.size(), filter->str(kernelConfig));
+		found = s.find(INDEX, found + filterSize);
+	}
+
+	return s;
+}
+
+
+void ElementExcerpt::addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const
+{
+	addElementToKernelSource(source, arguments, localDeclarations);
+	addElementToKernelSource(filter, arguments, localDeclarations);
+}
+
+
+void ElementExcerpt::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+{
+}
+
+
+string ElementExcerpt::getName() const
+{
+	return "";
+}
+
+
+string ElementExcerpt::getTypeSignature(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+string ElementExcerpt::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementExcerpt.h b/src/acl/Operators/aclElementExcerpt.h
new file mode 100644
index 0000000..f5bbe82
--- /dev/null
+++ b/src/acl/Operators/aclElementExcerpt.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTEXCERPT_H
+#define ACLELEMENTEXCERPT_H
+
+#include "../aclElementBase.h"
+
+
+namespace acl
+{
+
+/// Creates excerpt from source defined by filter
+/// by replacing of "INDEX" occurrences
+/// in source_->str() by filter_->str()
+
+class ElementExcerpt: public ElementBase
+{
+	protected:
+		Element source;
+		Element filter;
+	public:
+		ElementExcerpt(Element source_, Element filter_);
+		virtual string getName() const;
+		virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+		virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+		virtual void addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const;
+		virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTEXCERPT_H
diff --git a/src/acl/Operators/aclElementFor.cxx b/src/acl/Operators/aclElementFor.cxx
new file mode 100644
index 0000000..15be7e3
--- /dev/null
+++ b/src/acl/Operators/aclElementFor.cxx
@@ -0,0 +1,139 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementFor.h"
+#include "../aclUtilities.h"
+#include "../../aslUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+ElementFor::ElementFor(Element initialization_, Element condition_, Element increase_):
+	// typeID fictitious
+	ElementBase(false, 0, TYPE_INT),
+	initialization(initialization_),
+	condition(condition_),
+	increase(increase_)
+{
+	if (compatible(size, queue, initialization_))
+	{
+		size = max(size, initialization_->getSize());
+		if (initialization_->getQueue().get() != 0)
+			queue = initialization_->getQueue();
+	}
+	if (compatible(size, queue, condition_))
+	{
+		size = max(size, condition_->getSize());
+		if (condition_->getQueue().get() != 0)
+			queue = condition_->getQueue();
+	}
+	if (compatible(size, queue, increase_))
+	{
+		size = max(size, increase_->getSize());
+		if (increase_->getQueue().get() != 0)
+			queue = increase_->getQueue();
+	}
+}
+
+
+string ElementFor::str(const KernelConfiguration & kernelConfig) const
+{
+	string s("");
+
+	// only if "for"'s body is not empty
+	// create for (...) loop
+	if (expression.size() > 0)
+	{
+		s = "for (" + initialization->str(kernelConfig) + "; "
+			+ condition->str(kernelConfig) + "; "
+			+ increase->str(kernelConfig) + ")\n\t{";
+
+		for (unsigned int i = 0; i < expression.size(); i++)
+		{
+			s += "\n\t\t" + expression[i]->str(kernelConfig) + ";";
+		}
+
+		s += "\n\t}";
+	}
+	
+	return s;
+}
+
+
+void ElementFor::addBodyExpression(Element expression_)
+{
+	if (compatible(size, queue, expression_))
+	{
+		size = max(size, expression_->getSize());
+		if (expression_->getQueue().get() != 0)
+				queue = expression_->getQueue();
+		expression.push_back(expression_);
+	}
+	else
+	{
+		errorMessage("ElementFor::addBodyExpression - last added expression \
+					 is incompatible with the previous ones. \
+					 Either they reside on different devices or their sizes do not match: "
+		             + numToStr(expression_->getSize()) + " and " + numToStr(size));
+	}
+}
+
+
+void ElementFor::addToKernelSource(vector<Element> & arguments,
+		                           vector<Element> & localDeclarations) const
+{
+	addElementToKernelSource(initialization, arguments, localDeclarations);
+	addElementToKernelSource(condition, arguments, localDeclarations);
+	addElementToKernelSource(increase, arguments, localDeclarations);
+	
+	for (unsigned int i = 0; i < expression.size(); i++)
+	{
+		addElementToKernelSource(expression[i], arguments, localDeclarations);
+	}
+}
+
+
+void ElementFor::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+{
+}
+
+
+string ElementFor::getName() const
+{
+	return "";
+}
+
+
+string ElementFor::getTypeSignature(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+string ElementFor::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+} // namespace acl
diff --git a/src/acl/Operators/aclElementFor.h b/src/acl/Operators/aclElementFor.h
new file mode 100644
index 0000000..c75b826
--- /dev/null
+++ b/src/acl/Operators/aclElementFor.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLElementFor_H
+#define ACLElementFor_H
+
+#include "../aclElementBase.h"
+
+
+namespace acl
+{
+
+/// For loop
+class ElementFor: public ElementBase
+{
+	protected:
+		vector<Element> expression;
+		Element initialization;
+		Element condition;
+		Element increase;
+	public:
+		ElementFor(Element initialization_, Element condition_, Element increase_);
+		void addBodyExpression(Element expression_);
+		virtual string getName() const;
+		virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+		virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+		virtual void addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const;
+		virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLElementFor_H
diff --git a/src/acl/Operators/aclElementGenericBinary.cxx b/src/acl/Operators/aclElementGenericBinary.cxx
new file mode 100644
index 0000000..297caa4
--- /dev/null
+++ b/src/acl/Operators/aclElementGenericBinary.cxx
@@ -0,0 +1,52 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementGenericBinary.h"
+
+using namespace acl;
+
+ElementGenericBinary::ElementGenericBinary(Element a1, Element a2, const string & operation_):
+	OperatorBinary(a1, a2),
+	operation(operation_)
+{
+}
+
+
+string ElementGenericBinary::str(const KernelConfiguration & kernelConfig) const
+{
+		return "(" + e1->str(kernelConfig) + operation + e2->str(kernelConfig) + ")";
+}
+
+
+ElementGenericBinaryFunction::ElementGenericBinaryFunction(Element a1, Element a2, const string & functionName_):
+	OperatorBinary(a1, a2),
+	functionName(functionName_)
+{
+}
+
+
+string ElementGenericBinaryFunction::str(const KernelConfiguration & kernelConfig) const
+{
+	return functionName + "(" + e1->str(kernelConfig) + ", " + e2->str(kernelConfig) + ")";
+}
+
diff --git a/src/acl/Operators/aclElementGenericBinary.h b/src/acl/Operators/aclElementGenericBinary.h
new file mode 100644
index 0000000..0556f22
--- /dev/null
+++ b/src/acl/Operators/aclElementGenericBinary.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTGENERICBINARY_H
+#define ACLELEMENTGENERICBINARY_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+namespace acl
+{
+	///\todo{Add optimization for Constant  on function level}
+	///\todo{Add optimization for Singlevalued elements on function level}
+	class ElementGenericBinary: public OperatorBinary
+	{
+		private:
+			const string operation;
+		public:
+			ElementGenericBinary(Element a1, Element a2, const string & operation_);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+
+	class ElementGenericBinaryFunction: public OperatorBinary
+	{
+		private:
+			const string functionName;
+		public:
+			ElementGenericBinaryFunction(Element a1, Element a2, const string & functionName_);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+	
+} // namespace acl
+
+#endif // ACLELEMENTGENERICBINARY_H
diff --git a/src/acl/Operators/aclElementGenericUnary.cxx b/src/acl/Operators/aclElementGenericUnary.cxx
new file mode 100644
index 0000000..2bae01d
--- /dev/null
+++ b/src/acl/Operators/aclElementGenericUnary.cxx
@@ -0,0 +1,69 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementGenericUnary.h"
+
+using namespace acl;
+
+ElementGenericUnary::ElementGenericUnary(Element a, 
+                                         const string & operation_, 
+                                         bool outside):
+	OperatorUnary(a),
+	operation(operation_),
+	outside(outside)
+{
+}
+
+string ElementGenericUnary::str(const KernelConfiguration & kernelConfig) const
+{
+	string res;
+	if (outside)
+		res = operation + "(" + e->str(kernelConfig) + ")";
+	else 
+		res =  "(" + operation + e->str(kernelConfig) + ")";
+	return res;
+}
+
+ElementGenericUnarySIMD::ElementGenericUnarySIMD(Element a, 
+                                         const string & operation_, 
+                                         bool outside):
+	OperatorUnary(a),
+	operation(operation_),
+	outside(outside)
+{
+}
+
+string ElementGenericUnarySIMD::str(const KernelConfiguration & kernelConfig) const
+{
+	string res;
+	if(kernelConfig.vectorWidth > 1)
+	{
+		if (outside)
+			res = operation + "(" + e->str(kernelConfig) + ")";
+		else 
+			res =  "(" + operation + e->str(kernelConfig) + ")";
+	}
+	else 
+		res = e->str(kernelConfig);	
+	return res;
+}
diff --git a/src/acl/Operators/aclElementGenericUnary.h b/src/acl/Operators/aclElementGenericUnary.h
new file mode 100644
index 0000000..0da6edb
--- /dev/null
+++ b/src/acl/Operators/aclElementGenericUnary.h
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTGENERICUNARY_H
+#define ACLELEMENTGENERICUNARY_H
+
+#include "../Operators/aclOperatorUnary.h"
+
+namespace acl
+{
+	class ElementGenericUnary: public OperatorUnary
+	{
+		private:
+			const string operation;
+			bool outside;
+		public:
+			ElementGenericUnary(Element a, const string & operation_, bool outside = true);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+	class ElementGenericUnarySIMD: public OperatorUnary
+	{
+		private:
+			const string operation;
+			bool outside;
+		public:
+			ElementGenericUnarySIMD(Element a, const string & operation_, bool outside = true);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+	
+} // namespace acl
+
+#endif // ACLELEMENTGENERICUNARY_H
diff --git a/src/acl/Operators/aclElementIfElse.cxx b/src/acl/Operators/aclElementIfElse.cxx
new file mode 100644
index 0000000..b495222
--- /dev/null
+++ b/src/acl/Operators/aclElementIfElse.cxx
@@ -0,0 +1,152 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementIfElse.h"
+#include "../aclUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+ElementIfElse::ElementIfElse(Element condition_):
+	// typeID fictitious
+	ElementBase(false, 0, TYPE_INT),
+	condition(condition_)
+{
+}
+
+
+string ElementIfElse::str(const KernelConfiguration & kernelConfig) const
+{
+	string s("");
+
+	// only if "if"'s body is not empty
+	// create if (...) statement
+	if (expressionIf.size() > 0)
+	{
+		s = "if (" + condition->str(kernelConfig) + ")\n\t{";
+
+		for (unsigned int i = 0; i < expressionIf.size(); i++)
+		{
+			s += "\n\t\t" + expressionIf[i]->str(kernelConfig) + ";";
+		}
+
+		s += "\n\t}";
+
+		// only if "if"'s and "else"'s body is not empty
+		// create else {...} statement
+		if (expressionElse.size() > 0)
+		{
+			s += "\n\telse\n\t{";
+
+			for (unsigned int i = 0; i < expressionElse.size(); i++)
+			{
+				s += "\n\t\t" + expressionElse[i]->str(kernelConfig) + ";";
+			}
+
+			s += "\n\t}";
+		}
+	}
+	
+	return s;
+}
+
+
+void ElementIfElse::addBodyExpressionIf(Element expression_)
+{
+	if (compatible(size, queue, expression_))
+	{
+		size = max(size, expression_->getSize());
+		if (expression_->getQueue().get() != 0)
+				queue = expression_->getQueue();
+		expressionIf.push_back(expression_);
+	}
+	else
+	{
+		errorMessage("ElementIfElse::addBodyExpressionIf - last added expression \
+					 is incompatible with the previous ones. \
+					 Either they reside on different devices or their sizes do not match: "
+		             + numToStr(expression_->getSize()) + " and " + numToStr(size));
+	}
+}
+
+
+void ElementIfElse::addBodyExpressionElse(Element expression_)
+{
+	if (compatible(size, queue, expression_))
+	{
+		size = max(size, expression_->getSize());
+		if (expression_->getQueue().get() != 0)
+				queue = expression_->getQueue();
+		expressionElse.push_back(expression_);
+	}
+	else
+	{
+		errorMessage("ElementIfElse::addBodyExpressionElse - last added expression \
+					 is incompatible with the previous ones. \
+					 Either they reside on different devices or their sizes do not match: "
+		             + numToStr(expression_->getSize()) + " and " + numToStr(size));
+	}
+}
+
+
+void ElementIfElse::addToKernelSource(vector<Element> & arguments,
+                                      vector<Element> & localDeclarations) const
+{
+	addElementToKernelSource(condition, arguments, localDeclarations);
+		
+	for (unsigned int i = 0; i < expressionIf.size(); i++)
+	{
+		addElementToKernelSource(expressionIf[i], arguments, localDeclarations);
+	}
+
+	for (unsigned int i = 0; i < expressionElse.size(); i++)
+	{
+		addElementToKernelSource(expressionElse[i], arguments, localDeclarations);
+	}
+}
+
+
+void ElementIfElse::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+{
+}
+
+
+string ElementIfElse::getName() const
+{
+	return "";
+}
+
+
+string ElementIfElse::getTypeSignature(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+string ElementIfElse::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+} // namespace acl
diff --git a/src/acl/Operators/aclElementIfElse.h b/src/acl/Operators/aclElementIfElse.h
new file mode 100644
index 0000000..21ccb90
--- /dev/null
+++ b/src/acl/Operators/aclElementIfElse.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTIFELSE_H
+#define ACLELEMENTIFELSE_H
+
+#include "../aclElementBase.h"
+
+
+namespace acl
+{
+
+/// If-Else conditional structure
+class ElementIfElse: public ElementBase
+{
+	protected:
+		vector<Element> expressionIf;
+		vector<Element> expressionElse;
+		Element condition;
+	public:
+		ElementIfElse(Element condition_);
+		void addBodyExpressionIf(Element expression_);
+		void addBodyExpressionElse(Element expression_);
+		virtual string getName() const;
+		virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+		virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+		virtual void addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const;
+		virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTIFELSE_H
diff --git a/src/acl/Operators/aclElementMad.cxx b/src/acl/Operators/aclElementMad.cxx
new file mode 100644
index 0000000..9c1a658
--- /dev/null
+++ b/src/acl/Operators/aclElementMad.cxx
@@ -0,0 +1,37 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementMad.h"
+
+using namespace acl;
+
+
+ElementMad::ElementMad(Element a1, Element a2, Element a3):
+	OperatorTernary(a1, a2, a3)
+{
+}
+
+string ElementMad::str(const KernelConfiguration & kernelConfig) const
+{
+	return "mad(" + e1->str(kernelConfig) + ", " + e2->str(kernelConfig) +", " + e3->str(kernelConfig) + ")";
+}
diff --git a/src/acl/Operators/aclElementMad.h b/src/acl/Operators/aclElementMad.h
new file mode 100644
index 0000000..5756095
--- /dev/null
+++ b/src/acl/Operators/aclElementMad.h
@@ -0,0 +1,43 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTMAD_H
+#define ACLELEMENTMAD_H
+
+#include "../Operators/aclOperatorTernary.h"
+
+namespace acl
+{
+	///The class is realization of the \p mad operation 
+	/** For a scalar type, result = a1 * a2 +a3 */
+	class ElementMad: public OperatorTernary
+	{
+		public:
+			ElementMad(Element a1, Element a2, Element a3);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+
+#endif // ACLELEMENTMAD_H
diff --git a/src/acl/Operators/aclElementParser.cxx b/src/acl/Operators/aclElementParser.cxx
new file mode 100644
index 0000000..c9d81b5
--- /dev/null
+++ b/src/acl/Operators/aclElementParser.cxx
@@ -0,0 +1,121 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementParser.h"
+#include "../aclUtilities.h"
+#include "../../aslUtilities.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+ElementParser::ElementParser():
+	// set typeID fictitious first, change with the first call of addElementNamePair
+	ElementBase(false, 0, TYPE_INT)
+{
+}
+
+
+void ElementParser::addElementNamePair(Element element, string name)
+{
+	if (compatible(size, queue, element))
+	{
+		size = max(size, element->getSize());
+		typeID = element->getTypeID();
+		if (element->getQueue().get() != 0)
+				queue = element->getQueue();
+		elementNamePairs.push_back(make_pair(element, name));
+	}
+	else
+	{
+		errorMessage("ElementParser::addElementNamePair - last added expression \
+					 is incompatible with the previous ones. \
+					 Either they reside on different devices or their sizes do not match: "
+		             + numToStr(element->getSize()) + " and " + numToStr(size));
+	}
+}
+
+
+void ElementParser::setStatement(string statement_)
+{
+	statement = statement_;
+}
+
+
+string ElementParser::str(const KernelConfiguration & kernelConfig) const
+{
+	string s = statement;
+
+	for (unsigned int i = 0; i < elementNamePairs.size(); ++i)
+	{
+		size_t found = s.find(elementNamePairs[i].second);
+
+		int nameSize(elementNamePairs[i].second.size());
+		string fieldStr(elementNamePairs[i].first->str(kernelConfig));
+		while (found != string::npos)
+		{
+			s.replace(found, nameSize, fieldStr);
+			found = s.find(elementNamePairs[i].second, found + fieldStr.size());
+		}
+	}
+
+	return s;
+}
+
+/// \todoZeev Add to kernel only Elements that were found in the statement!!!
+void ElementParser::addToKernelSource(vector<Element> & arguments,
+		                              vector<Element> & localDeclarations) const
+{
+	if (statement == "")
+		errorMessage("ElementParser::addToKernelSource() - statement is an empty string");
+	
+	for (unsigned int i = 0; i < elementNamePairs.size(); ++i)
+	{
+		addElementToKernelSource(elementNamePairs[i].first, arguments, localDeclarations);
+	}
+}
+
+
+void ElementParser::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+{
+}
+
+
+string ElementParser::getName() const
+{
+	return "";
+}
+
+
+string ElementParser::getTypeSignature(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+string ElementParser::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+} // namespace acl
diff --git a/src/acl/Operators/aclElementParser.h b/src/acl/Operators/aclElementParser.h
new file mode 100644
index 0000000..79e7d84
--- /dev/null
+++ b/src/acl/Operators/aclElementParser.h
@@ -0,0 +1,57 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTPARSER_H
+#define ACLELEMENTPARSER_H
+
+#include "../aclElementBase.h"
+
+
+namespace acl
+{
+
+/// Parses \p statement by replacing occurrences of
+/// element's \p names by corresponding \p element->str()
+/// from elementNamePairs
+
+class ElementParser: public ElementBase
+{
+	protected:
+		vector<pair<Element, string> > elementNamePairs;
+		string statement;
+	public:
+		ElementParser();
+		void addElementNamePair(Element element, string name);
+		void setStatement(string statement_);
+		virtual string getName() const;
+		virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+		virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+		virtual void addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const;
+		virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTPARSER_H
diff --git a/src/acl/Operators/aclElementProduct.cxx b/src/acl/Operators/aclElementProduct.cxx
new file mode 100644
index 0000000..3c3e07c
--- /dev/null
+++ b/src/acl/Operators/aclElementProduct.cxx
@@ -0,0 +1,54 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementProduct.h"
+
+namespace acl
+{
+
+
+ElementProduct::ElementProduct(Element a1, Element a2):
+	OperatorBinary(a1, a2)
+{
+}
+
+string ElementProduct::str(const KernelConfiguration & kernelConfig) const
+{
+	string e1s(e1->str(kernelConfig));
+	string e2s(e2->str(kernelConfig));
+	// check for 0 and 1 and optimize
+	if ((e1s == "0") || (e2s == "0") || (e1s == "-0") || (e2s == "-0") || 
+	    (e1s == "0.") || (e2s == "0.") || (e1s == "-0.") || (e2s == "-0."))
+		return "0";
+	else
+		if (e1s == "1" || e1s == "1.")
+			return e2s;
+		else
+			if (e2s == "1" || e2s == "1.")
+				return e1s;
+			else
+				return  e1s + "*" + e2s;
+}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementProduct.h b/src/acl/Operators/aclElementProduct.h
new file mode 100644
index 0000000..7ec0b88
--- /dev/null
+++ b/src/acl/Operators/aclElementProduct.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTPRODUCT_H
+#define ACLELEMENTPRODUCT_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+
+namespace acl
+{
+
+class ElementProduct: public OperatorBinary
+{
+	public:
+		ElementProduct(Element a1, Element a2);
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif //ACLELEMENTPRODUCT_H
diff --git a/src/acl/Operators/aclElementSelect.cxx b/src/acl/Operators/aclElementSelect.cxx
new file mode 100644
index 0000000..ea9175a
--- /dev/null
+++ b/src/acl/Operators/aclElementSelect.cxx
@@ -0,0 +1,37 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSelect.h"
+
+using namespace acl;
+
+
+ElementSelect::ElementSelect(Element a1, Element a2, Element a3):
+	OperatorTernary(a1, a2, a3)
+{
+}
+
+string ElementSelect::str(const KernelConfiguration & kernelConfig) const
+{
+	return "select(" + e1->str(kernelConfig) + ", " + e2->str(kernelConfig) +", " + e3->str(kernelConfig) + ")";
+}
diff --git a/src/acl/Operators/aclElementSelect.h b/src/acl/Operators/aclElementSelect.h
new file mode 100644
index 0000000..12db09e
--- /dev/null
+++ b/src/acl/Operators/aclElementSelect.h
@@ -0,0 +1,43 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSELECT_H
+#define ACLELEMENTSELECT_H
+
+#include "../Operators/aclOperatorTernary.h"
+
+namespace acl
+{
+	/// The class is realization of the \p select operation 
+	/// For a scalar type, result = c ? b : a
+	class ElementSelect: public OperatorTernary
+	{
+		public:
+			ElementSelect(Element a1, Element a2, Element a3);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+
+#endif // ACLELEMENTSELECT_H
diff --git a/src/acl/Operators/aclElementSin.cxx b/src/acl/Operators/aclElementSin.cxx
new file mode 100644
index 0000000..8208b5c
--- /dev/null
+++ b/src/acl/Operators/aclElementSin.cxx
@@ -0,0 +1,44 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSin.h"
+
+namespace acl
+{
+
+	ElementSin::ElementSin(Element a):
+		OperatorUnary(a)
+	{
+	}
+
+	string ElementSin::str(const KernelConfiguration & kernelConfig) const
+	{
+		string es(e->str(kernelConfig));
+		// check for zeros and throw them away
+		if (es == "0" || es == "-0")
+			return "0";
+		else
+			return "sin(" + es + ")";
+	}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementSin.h b/src/acl/Operators/aclElementSin.h
new file mode 100644
index 0000000..ed4fa25
--- /dev/null
+++ b/src/acl/Operators/aclElementSin.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSIN_H
+#define ACLELEMENTSIN_H
+
+#include "../Operators/aclOperatorUnary.h"
+
+
+namespace acl
+{
+
+	class ElementSin: public OperatorUnary
+	{
+		public:
+			ElementSin(Element a);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+#endif // ACLELEMENTSIN_H
diff --git a/src/acl/Operators/aclElementSqrt.cxx b/src/acl/Operators/aclElementSqrt.cxx
new file mode 100644
index 0000000..318ebd5
--- /dev/null
+++ b/src/acl/Operators/aclElementSqrt.cxx
@@ -0,0 +1,44 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSqrt.h"
+
+namespace acl
+{
+
+	ElementSqrt::ElementSqrt(Element a):
+		OperatorUnary(a)
+	{
+	}
+
+	string ElementSqrt::str(const KernelConfiguration & kernelConfig) const
+	{
+		string es(e->str(kernelConfig));		
+		// check for zeros and throw them away
+		if (es == "0" || es == "-0")
+			return "0";
+		else
+			return "sqrt(" + es + ")";
+	}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementSqrt.h b/src/acl/Operators/aclElementSqrt.h
new file mode 100644
index 0000000..89b818a
--- /dev/null
+++ b/src/acl/Operators/aclElementSqrt.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSQRT_H
+#define ACLELEMENTSQRT_H
+
+#include "../Operators/aclOperatorUnary.h"
+
+
+namespace acl
+{
+
+	class ElementSqrt: public OperatorUnary
+	{
+		public:
+			ElementSqrt(Element a);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+#endif // ACLELEMENTSQRT_H
diff --git a/src/acl/Operators/aclElementSubtraction.cxx b/src/acl/Operators/aclElementSubtraction.cxx
new file mode 100644
index 0000000..ef46ce4
--- /dev/null
+++ b/src/acl/Operators/aclElementSubtraction.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSubtraction.h"
+
+namespace acl
+{
+
+
+ElementSubtraction::ElementSubtraction(Element a1, Element a2):
+	OperatorBinary(a1, a2)
+{
+}
+
+string ElementSubtraction::str(const KernelConfiguration & kernelConfig) const
+{
+	string e1s(e1->str(kernelConfig));
+	string e2s(e2->str(kernelConfig));
+
+	// check for zeros and throw them away
+	if ((e1s != "0") && (e2s != "0") && (e1s != "-0") && (e2s != "-0"))
+		return "(" + e1s + " - " + e2s + ")";
+	else
+		if ((e1s != "0") && (e1s != "-0") && ((e2s == "0") || (e2s == "-0")))
+			return e1s;
+		else
+			if (((e1s == "0") || (e1s == "-0")) && (e2s != "0") && (e2s != "-0"))
+				return "(- " + e2s + ")";
+			else
+				return "0";
+}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementSubtraction.h b/src/acl/Operators/aclElementSubtraction.h
new file mode 100644
index 0000000..a09cc24
--- /dev/null
+++ b/src/acl/Operators/aclElementSubtraction.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSUBTRACTION_H
+#define ACLELEMENTSUBTRACTION_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+
+namespace acl
+{
+
+class ElementSubtraction: public OperatorBinary
+{
+	public:
+		ElementSubtraction(Element a1, Element a2);
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTSUBTRACTION_H
diff --git a/src/acl/Operators/aclElementSum.cxx b/src/acl/Operators/aclElementSum.cxx
new file mode 100644
index 0000000..9e4c330
--- /dev/null
+++ b/src/acl/Operators/aclElementSum.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSum.h"
+
+namespace acl
+{
+
+
+ElementSum::ElementSum(Element a1, Element a2):
+	OperatorBinary(a1, a2)
+{
+}
+
+string ElementSum::str(const KernelConfiguration & kernelConfig) const
+{
+	string e1s(e1->str(kernelConfig));
+	string e2s(e2->str(kernelConfig));	
+	// check for zeros and throw them away
+	if ((e1s !=  "0") && (e2s !=  "0") && (e1s != "-0") && (e2s != "-0") && 
+	    (e1s !=  "0.") && (e2s !=  "0.") && (e1s != "-0.") && (e2s != "-0."))
+		return "(" + e1s + "+" + e2s + ")";
+	else
+		if (e1s == "0" || e1s == "-0" || e1s == "0." || e1s == "-0.")
+			return e2s;
+		else
+			if (e2s == "0" || e2s == "-0" || e2s == "0." || e2s == "-0.")
+				return e1s;
+	return "";
+}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementSum.h b/src/acl/Operators/aclElementSum.h
new file mode 100644
index 0000000..ebacfbd
--- /dev/null
+++ b/src/acl/Operators/aclElementSum.h
@@ -0,0 +1,41 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSUM_H
+#define ACLELEMENTSUM_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+namespace acl
+{
+
+class ElementSum: public OperatorBinary
+{
+	public:
+		ElementSum(Element a1, Element a2);
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTSUM_H
diff --git a/src/acl/Operators/aclElementSyncCopy.cxx b/src/acl/Operators/aclElementSyncCopy.cxx
new file mode 100644
index 0000000..937ae1a
--- /dev/null
+++ b/src/acl/Operators/aclElementSyncCopy.cxx
@@ -0,0 +1,130 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementSyncCopy.h"
+#include "../../aslUtilities.h"
+#include "../aclUtilities.h"
+#include "../aclHardware.h"
+
+using namespace asl;
+
+namespace acl
+{
+
+///\todo{Think of cutting one copy operation into 3: frontRemainder, middlePart (SIMD chunks) and backRemainder}
+	
+unsigned int ElementSyncCopy::syncCopyNum = 0;
+
+
+ElementSyncCopy::ElementSyncCopy(Element source_,
+                                 Element destination_,
+                                 Element srcOffset,
+                                 Element dstOffset,
+                                 Element length_):
+	// typeID fictitious
+	ElementBase(false, 0, TYPE_INT),
+	source(source_),
+	destination(destination_),
+	length(length_)
+{
+	if(source->getQueue().get() == 0 && destination->getQueue().get() == 0)
+		errorMessage("ElementSyncCopy: source and destionation have no queue");
+	queue = source->getQueue().get() != 0 ? source->getQueue() : destination->getQueue();
+	
+	kernelSourceStr = "event_t event_" + numToStr(syncCopyNum) + " = (event_t)0;\n";
+	kernelSourceStr += "\tevent_" + numToStr(syncCopyNum) + " = async_work_group_copy(&((" + destination->getAddressSpaceQualifier() + " " + TYPE[destination->getTypeID()] + " *)" + destination->getName() + ")[" + 
+						dstOffset->str() + "], &((" + source->getAddressSpaceQualifier() + " " + TYPE[source->getTypeID()] + " *)" + source->getName() + ")[" +
+						srcOffset->str() + "], " +	length->str() +
+						", (event_t)0);\n";
+	kernelSourceStr += "\twait_group_events (1, &event_" + numToStr(syncCopyNum) + ")";
+
+	++syncCopyNum;
+}
+
+
+string ElementSyncCopy::str(const KernelConfiguration & kernelConfig) const
+{
+	return kernelSourceStr;
+}
+
+
+void ElementSyncCopy::addToKernelSource(vector<Element> & arguments,
+                                        vector<Element> & localDeclarations) const
+{
+	if (isDeclarable(source))
+	{
+		if (isArgument(source))
+		{
+			arguments.push_back(source);
+		}
+		else
+		{
+			localDeclarations.push_back(source);
+		}
+	}
+	else
+	{
+		source->addToKernelSource(arguments, localDeclarations);
+	}
+		
+	if (isDeclarable(destination))
+	{
+		if (isArgument(destination))
+		{
+			arguments.push_back(destination);
+		}
+		else
+		{
+			localDeclarations.push_back(destination);
+		}
+	}
+	else
+	{
+		destination->addToKernelSource(arguments, localDeclarations);
+	}
+}
+
+
+void ElementSyncCopy::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+{
+}
+
+
+string ElementSyncCopy::getName() const
+{
+	return "";
+}
+
+
+string ElementSyncCopy::getTypeSignature(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+
+string ElementSyncCopy::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+{
+	return "";
+}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclElementSyncCopy.h b/src/acl/Operators/aclElementSyncCopy.h
new file mode 100644
index 0000000..9f4a32a
--- /dev/null
+++ b/src/acl/Operators/aclElementSyncCopy.h
@@ -0,0 +1,61 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTSYNCCOPY_H
+#define ACLELEMENTSYNCCOPY_H
+
+#include "../aclElementBase.h"
+
+
+namespace acl
+{
+
+class ElementSyncCopy: public ElementBase
+{
+	protected:
+		Element source;
+		Element destination;
+	private:
+		Element length;
+		static unsigned int syncCopyNum;
+		string kernelSourceStr;
+
+	public:
+		ElementSyncCopy(Element source_,
+		                Element destination_,
+		                Element srcOffset,
+		                Element dstOffset,
+		                Element length_);
+
+		virtual string getName() const;
+		virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+		virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+		virtual void addToKernelSource(vector<Element> & arguments,
+		                               vector<Element> & localDeclarations) const;
+		virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+		virtual string str(const KernelConfiguration & kernelConfig) const;
+};
+
+} // namespace acl
+
+#endif // ACLELEMENTSYNCCOPY_H
diff --git a/src/acl/Operators/aclGenericAtomicFunction.cxx b/src/acl/Operators/aclGenericAtomicFunction.cxx
new file mode 100644
index 0000000..bc43633
--- /dev/null
+++ b/src/acl/Operators/aclGenericAtomicFunction.cxx
@@ -0,0 +1,45 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclGenericAtomicFunction.h"
+#include "../../aslUtilities.h"
+
+
+namespace acl
+{
+
+ElementGenericAtomicFunction::ElementGenericAtomicFunction(Element a1, Element a2, const string & functionName_):
+	OperatorBinary(a1, a2),
+	functionName(functionName_)
+{
+	if (!a1->isWritable)
+		asl::errorMessage("ElementGenericAtomicFunction - first argument is not writable");
+}
+
+
+string ElementGenericAtomicFunction::str(const KernelConfiguration & kernelConfig) const
+{
+	return functionName + "(&" + e1->str(kernelConfig) + ", " + e2->str(kernelConfig) + ")";
+}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclGenericAtomicFunction.h b/src/acl/Operators/aclGenericAtomicFunction.h
new file mode 100644
index 0000000..48eec8e
--- /dev/null
+++ b/src/acl/Operators/aclGenericAtomicFunction.h
@@ -0,0 +1,43 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLGENERICATOMICFUNCTION_H
+#define ACLGENERICATOMICFUNCTION_H
+
+#include "../Operators/aclOperatorBinary.h"
+
+namespace acl
+{
+
+	class ElementGenericAtomicFunction: public OperatorBinary
+	{
+		private:
+			const string functionName;
+		public:
+			ElementGenericAtomicFunction(Element a1, Element a2, const string & operation_);
+			virtual string str(const KernelConfiguration & kernelConfig) const;
+	};
+
+} // namespace acl
+
+#endif // ACLGENERICATOMICFUNCTION_H
diff --git a/src/acl/Operators/aclOperatorBinary.cxx b/src/acl/Operators/aclOperatorBinary.cxx
new file mode 100644
index 0000000..411235e
--- /dev/null
+++ b/src/acl/Operators/aclOperatorBinary.cxx
@@ -0,0 +1,88 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclOperatorBinary.h"
+#include "../aclUtilities.h"
+#include <algorithm>
+
+using namespace std;
+using namespace asl;
+
+namespace acl
+{
+
+	OperatorBinary::OperatorBinary(Element a1, Element a2, const string & description):
+		// first operand dictates the typeID of the binary operator
+		ElementBase(false, 0, a1->getTypeID())
+	{
+		if ( compatible(a1, a2) )
+		{
+			size = max(a1->getSize(), a2->getSize());
+
+			if (a1->getQueue().get() != 0)
+				queue = a1->getQueue();
+			else
+				queue = a2->getQueue();
+			
+			e1 = a1;
+			e2 = a2;
+		}
+		else
+		{
+			errorMessage("Operands of binary operator (" + description + ") are incompatible. \
+				 		 Either they reside on different devices or their sizes do not match: "
+			             + numToStr(a1->getSize()) + " and " + numToStr(a2->getSize()));
+		}
+	}
+	
+	void OperatorBinary::addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const
+	{
+		addElementToKernelSource(e1, arguments, localDeclarations);
+		addElementToKernelSource(e2, arguments, localDeclarations);
+	}
+
+
+	void OperatorBinary::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string OperatorBinary::getName() const
+	{
+		return "";
+	}
+
+
+	string OperatorBinary::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string OperatorBinary::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclOperatorBinary.h b/src/acl/Operators/aclOperatorBinary.h
new file mode 100644
index 0000000..0a96caf
--- /dev/null
+++ b/src/acl/Operators/aclOperatorBinary.h
@@ -0,0 +1,48 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLOPERATORBINARY_H
+#define ACLOPERATORBINARY_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+
+	class OperatorBinary: public ElementBase
+	{
+		protected:
+			Element e1;
+			Element e2;
+		public:
+			OperatorBinary(Element a1, Element a2, const string & description = "");			
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+	
+} // namespace acl
+#endif // ACLOPERATORBINARY_H
diff --git a/src/acl/Operators/aclOperatorGeneric.cxx b/src/acl/Operators/aclOperatorGeneric.cxx
new file mode 100644
index 0000000..b8c26e9
--- /dev/null
+++ b/src/acl/Operators/aclOperatorGeneric.cxx
@@ -0,0 +1,74 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclOperatorGeneric.h"
+
+using namespace std;
+
+namespace acl
+{
+
+	OperatorGeneric::OperatorGeneric(const string & operatorStr_):
+		// typeID fictitious
+		ElementBase(false, 0, TYPE_INT),
+		operatorStr(operatorStr_)
+	{
+	}
+
+
+	string OperatorGeneric::str(const KernelConfiguration & kernelConfig) const
+	{
+		return operatorStr;
+	}
+
+
+	void OperatorGeneric::addToKernelSource(vector<Element> & arguments,
+	                                        vector<Element> & localDeclarations) const
+	{
+	}
+
+
+	void OperatorGeneric::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string OperatorGeneric::getName() const
+	{
+		return "";
+	}
+
+
+	string OperatorGeneric::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string OperatorGeneric::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclOperatorGeneric.h b/src/acl/Operators/aclOperatorGeneric.h
new file mode 100644
index 0000000..d758ade
--- /dev/null
+++ b/src/acl/Operators/aclOperatorGeneric.h
@@ -0,0 +1,48 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLOPERATORGENERIC_H
+#define ACLOPERATORGENERIC_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+
+	class OperatorGeneric: public ElementBase
+	{
+		protected:
+			string operatorStr;
+		public:
+			OperatorGeneric(const string & operatorStr_);
+			virtual string str(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const;
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+	
+} // namespace acl
+#endif // ACLOPERATORGENERIC_H
diff --git a/src/acl/Operators/aclOperatorTernary.cxx b/src/acl/Operators/aclOperatorTernary.cxx
new file mode 100644
index 0000000..35720b4
--- /dev/null
+++ b/src/acl/Operators/aclOperatorTernary.cxx
@@ -0,0 +1,97 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclOperatorTernary.h"
+#include "../aclUtilities.h"
+#include <algorithm>
+
+using namespace std;
+using namespace asl;
+
+namespace acl
+{
+
+	OperatorTernary::OperatorTernary(Element a1, Element a2, Element a3):
+		// first operand dictates the typeID of the ternary operator
+		ElementBase(false, 0, a1->getTypeID())
+	{
+		// if three elements have the same size or size of at least one of them is 0
+		if (compatible(a1,a2) && compatible(a2,a3) && compatible(a1,a3)) 
+		{
+			size = max(max(a1->getSize(), a2->getSize()), a3->getSize());
+
+			if (a1->getQueue().get() != 0)
+				queue = a1->getQueue();
+			else
+				if (a2->getQueue().get() != 0)
+					queue = a2->getQueue();
+				else
+					queue = a3->getQueue();
+			
+			e1 = a1;
+			e2 = a2;
+			e3 = a3;
+		}
+		else
+		{
+			errorMessage("Operands of ternary operator are incompatible. \
+				 		 Either they reside on different devices or their sizes do not match: "
+			             + numToStr(a1->getSize()) + " and "
+			             + numToStr(a2->getSize()) + " and "
+			             + numToStr(a3->getSize()));
+		}
+	}
+
+
+	void OperatorTernary::addToKernelSource(vector<Element> & arguments,
+	                                        vector<Element> & localDeclarations) const
+	{
+		addElementToKernelSource(e1, arguments, localDeclarations);
+		addElementToKernelSource(e2, arguments, localDeclarations);
+		addElementToKernelSource(e3, arguments, localDeclarations);
+	}
+
+
+	void OperatorTernary::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string OperatorTernary::getName() const
+	{
+		return "";
+	}
+
+
+	string OperatorTernary::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string OperatorTernary::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+} // namespace acl
diff --git a/src/acl/Operators/aclOperatorTernary.h b/src/acl/Operators/aclOperatorTernary.h
new file mode 100644
index 0000000..60302d8
--- /dev/null
+++ b/src/acl/Operators/aclOperatorTernary.h
@@ -0,0 +1,49 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLOPERATORTERNARY_H
+#define ACLOPERATORTERNARY_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+
+	class OperatorTernary: public ElementBase
+	{
+		protected:
+			Element e1;
+			Element e2;
+			Element e3;
+		public:
+			OperatorTernary(Element a1, Element a2, Element a3);
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+	
+} // namespace acl
+#endif // ACLOPERATORTERNARY_H
diff --git a/src/acl/Operators/aclOperatorUnary.cxx b/src/acl/Operators/aclOperatorUnary.cxx
new file mode 100644
index 0000000..8fa0fa4
--- /dev/null
+++ b/src/acl/Operators/aclOperatorUnary.cxx
@@ -0,0 +1,78 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclOperatorUnary.h"
+#include "../aclUtilities.h"
+
+using namespace std;
+
+namespace acl
+{
+
+	OperatorUnary::OperatorUnary(Element a):
+		ElementBase(false, 0, a->getTypeID()),
+		e(a)
+	{
+		size = a->getSize();
+		queue = a->getQueue();
+	}
+
+	OperatorUnary::OperatorUnary(Element a, TypeID type):
+		ElementBase(false, 0, type),
+		e(a)
+	{
+		size = a->getSize();
+		queue = a->getQueue();
+	}
+
+	void OperatorUnary::addToKernelSource(vector<Element> & arguments,
+			                              vector<Element> & localDeclarations) const
+	{
+		addElementToKernelSource(e, arguments, localDeclarations);
+	}
+
+
+	void OperatorUnary::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
+	{
+	}
+
+
+	string OperatorUnary::getName() const
+	{
+		return "";
+	}
+
+
+	string OperatorUnary::getTypeSignature(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+	string OperatorUnary::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
+	{
+		return "";
+	}
+
+
+} // namespace acl
diff --git a/src/acl/Operators/aclOperatorUnary.h b/src/acl/Operators/aclOperatorUnary.h
new file mode 100644
index 0000000..3437e30
--- /dev/null
+++ b/src/acl/Operators/aclOperatorUnary.h
@@ -0,0 +1,48 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLOPERATORUNARY_H
+#define ACLOPERATORUNARY_H
+
+#include "../aclElementBase.h"
+
+namespace acl
+{
+
+	class OperatorUnary: public ElementBase
+	{
+		protected:
+			Element e;
+			OperatorUnary(Element a);
+			OperatorUnary(Element a, TypeID type);
+		public:
+			virtual string getName() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig) const;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig) const;
+			virtual void addToKernelSource(vector<Element> & arguments,
+			                               vector<Element> & localDeclarations) const;
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const;
+	};
+	
+} // namespace acl
+#endif // ACLOPERATORUNARY_H
diff --git a/src/acl/acl.cxx b/src/acl/acl.cxx
new file mode 100644
index 0000000..e2b93e1
--- /dev/null
+++ b/src/acl/acl.cxx
@@ -0,0 +1,726 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "acl.h"
+#include "Operators/aclElementAssignmentSafe.h"
+#include "Operators/aclElementIfElse.h"
+#include "Operators/aclElementFor.h"
+#include "Operators/aclElementSum.h"
+#include "Operators/aclElementSubtraction.h"
+#include "Operators/aclElementProduct.h"
+#include "Operators/aclElementDivision.h"
+#include "Operators/aclElementSin.h"
+#include "Operators/aclElementCos.h"
+#include "Operators/aclElementSqrt.h"
+#include "Operators/aclOperatorGeneric.h"
+#include "Operators/aclElementGenericBinary.h"
+#include "Operators/aclGenericAtomicFunction.h"
+#include "Operators/aclElementGenericUnary.h"
+#include "Operators/aclElementSelect.h"
+#include "Operators/aclElementMad.h"
+#include "Operators/aclElementExcerpt.h"
+#include "Operators/aclElementParser.h"
+#include "Operators/aclElementSyncCopy.h"
+#include "Operators/aclElementConvert.h"
+#include "../aslUtilities.h"
+#include "Kernels/aclKernel.h"
+#include "DataTypes/aclConstant.h"
+#include "DataTypes/aclIndex.h"
+#include "DataTypes/aclVariableReference.h"
+#include "DataTypes/aclArray.h"
+#include "DataTypes/aclLocalArray.h"
+#include "Kernels/aclExpressionContainer.h"
+#include "aclMath/aclVectorOfElementsDef.h"
+#include "aclMath/aclMatrixOfElements.h"
+
+#include<string>
+
+using namespace std;
+using namespace asl;
+
+namespace acl
+{
+	namespace elementOperators
+	{
+
+		Element operator-(Element e)
+		{
+			return Element(new ElementGenericUnary(e, "-", false));
+		}
+		
+		Element operator+(Element e1, Element e2)
+		{
+			return Element(new ElementSum(e1, e2));
+		}
+
+
+		Element operator-(Element e1, Element e2)
+		{
+			return Element(new ElementSubtraction(e1, e2));
+		}
+
+
+		Element operator*(Element e1, Element e2)
+		{
+			return Element(new ElementProduct(e1, e2));
+		}
+
+
+		Element operator/(Element e1, Element e2)
+		{
+			return Element(new ElementDivision(e1, e2));
+		}
+
+		
+		Element operator%(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "%"));
+		}
+
+		
+		Element operatorAssignmentSafe(Element e1, Element e2)
+		{
+			return Element(new ElementAssignmentSafe(e1, e2));
+		}
+
+
+		Element operatorAssignment(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "="));
+		}
+
+		
+		Element operator+=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "+="));
+		}
+
+
+		Element operator-=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "-="));
+		}
+
+
+		Element operator*=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "*="));
+		}
+
+
+		Element operator/=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "/="));
+		}
+
+
+		Element operator>(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, ">"));
+		}
+
+
+		Element operator<(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "<"));
+		}
+
+	
+		Element operator>=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, ">="));
+		}
+
+	
+		Element operator<=(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "<="));
+		}
+
+	
+		Element isEqual(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "=="));
+		}
+
+	
+		Element isNotEqual(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, " != "));
+		}
+
+
+		Element operator||(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "||"));
+		}
+
+
+		Element operator&&(Element e1, Element e2)
+		{
+			return Element(new ElementGenericBinary(e1, e2, "&&"));
+		}
+
+		Element operator!(Element e)
+		{
+			return Element(new ElementGenericUnary(e, "!", false));
+		}
+
+		Element convert(const TypeID tName, Element e1, bool strong)
+		{
+			return Element(new ElementConvert(e1, tName, strong));
+		}
+		
+
+		Element select(Element e1, Element e2, Element e3)
+		{
+			return Element(new ElementSelect(e1,e2,e3));
+		}
+	
+		Element mad(Element e1, Element e2, Element e3)
+		{
+			return Element(new ElementMad(e1, e2, e3));
+		}
+
+		Element sin(Element e)
+		{
+			return Element(new ElementSin(e));
+		}
+
+
+		Element cos(Element e)
+		{
+			return Element(new ElementCos(e));
+		}
+
+
+		Element sqrt(Element e)
+		{
+			return Element(new ElementSqrt(e));
+		}
+
+		Element rsqrt(Element e)
+		{
+			return Element(new ElementGenericUnary(e, "native_rsqrt"));
+		}
+	
+
+		Element log(Element e)
+		{
+			return Element(new ElementGenericUnary(e, "native_log"));
+		}
+
+
+		Element log10(Element e)
+		{
+			return Element(new ElementGenericUnary(e, "log10"));
+		}
+
+
+		Element powI(Element a, unsigned int i)
+		{
+			Element n(new Constant<int>(i));
+			return Element(new ElementGenericBinaryFunction(a, n, "pown"));
+		}
+
+
+		Element exp(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "exp"));
+		}
+
+
+		Element fabs(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "fabs"));
+		}
+
+		Element abs(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "abs"));
+		}
+
+		Element abs_diff(Element a, Element b)
+		{
+			return Element(new ElementGenericBinaryFunction(a, b, "abs_diff"));
+		}
+		
+		Element floor(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "floor"));
+		}
+		
+		Element isnan(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "isnan"));
+		}
+
+		Element copysign(Element a, Element b)
+		{
+			return Element(new ElementGenericBinaryFunction(a, b, "copysign"));
+		}
+
+		Element sign(Element a)
+		{
+			return Element(new ElementGenericUnary(a, "sign"));
+		}
+		
+		Element min(Element a, Element b)
+		{
+			return Element(new ElementGenericBinaryFunction(a, b, "min"));
+		}
+
+		Element max(Element a, Element b)
+		{
+			return Element(new ElementGenericBinaryFunction(a, b, "max"));
+		}
+		
+		Element atomic_add(Element e1, Element e2)
+		{
+			return Element(new ElementGenericAtomicFunction(e1, e2, "atomic_add"));
+		}
+
+
+		Element atomic_sub(Element e1, Element e2)
+		{
+			return Element(new ElementGenericAtomicFunction(e1, e2, "atomic_sub"));
+		}
+
+
+		Element atomic_xchg(Element e1, Element e2)
+		{
+			return Element(new ElementGenericAtomicFunction(e1, e2, "atomic_xchg"));
+		}
+
+			
+		Element excerpt(Element source, Element filter)
+		{
+			return Element(new ElementExcerpt(source, filter));
+		}
+		
+
+		Element parse(const vector<pair<Element, string> > & elementNamePairs, const string & statement)
+		{
+			shared_ptr<ElementParser> parser(new ElementParser);
+			parser->setStatement(statement);
+
+			for (unsigned int i = 0; i < elementNamePairs.size(); ++i)
+			{
+				parser->addElementNamePair(elementNamePairs[i].first, elementNamePairs[i].second);
+			}
+			return parser;
+		}
+
+
+		Element printfFunction(string args)
+		{
+			return Element(new OperatorGeneric("printf(" + args + ")"));
+		}
+
+		
+		Element syncCopy(Element source,
+		                 Element destination,
+		                 Element srcOffset,
+		                 Element dstOffset,
+		                 Element length)
+		{
+			return Element(new ElementSyncCopy(source, destination,
+			                                   srcOffset, dstOffset,
+			                                   length));
+		}
+
+		Element any(Element e)
+		{
+			return Element(new ElementGenericUnarySIMD(e, "any"));
+		}
+
+		Element all(Element e)
+		{
+			return Element(new ElementGenericUnarySIMD(e, "all"));
+		}
+		
+
+		/// Sets work-group barrier
+		Element barrier(string flags)
+		{
+			return Element(new OperatorGeneric("barrier(" + flags + ")"));
+		}
+
+		
+		Element ifElse(Element condition, 
+		               const vector<Element> & thenBody, 
+		               const vector<Element> & elseBody)
+		{
+			std::shared_ptr<ElementIfElse> elIf(new ElementIfElse(condition));
+			for(unsigned int i(0); i < thenBody.size(); ++i)
+				elIf->addBodyExpressionIf(thenBody[i]);
+			for(unsigned int i(0); i < elseBody.size(); ++i)
+				elIf->addBodyExpressionIf(elseBody[i]);
+
+			return elIf;
+		}
+
+
+		Element forLoop(Element initialization,
+		                Element condition,
+		                Element increase,
+		                const vector<Element> & body)
+		{
+			std::shared_ptr<ElementFor> elFor(new ElementFor (initialization, condition, increase));
+			for(unsigned int i(0); i < body.size(); ++i)
+			{
+				elFor->addBodyExpression(body[i]);
+			}
+			return Element(elFor);
+		}
+
+
+		Element returnStatement()
+		{
+			return Element(new OperatorGeneric("return"));
+		}
+
+		Element nan(TypeID t)
+		{
+			std::string s; 
+			switch (t)
+			{
+				case TYPE_DOUBLE:
+					s=std::string("nan(ulong(1))");
+					break;	
+				case TYPE_FLOAT:
+					s="nan(uint(1))";
+					break;
+				default:
+					errorMessage("nan: the input variable has an uncorrect type");
+			}
+			return Element(new OperatorGeneric(s));
+		}
+
+	}
+
+	
+	//	RTTI functions
+
+	bool isConstant()
+	{
+		return false;
+	}
+	
+
+	bool isSingleValue()
+	{
+		return false;
+	}
+	
+
+	bool isMemBlock(Element e)
+	{
+		return (dynamic_cast<MemBlock*>(e.get()) != NULL);
+	}
+
+	/// Copies source to destination, resizes destination to accommodate source.
+	template <typename T> void copy(MemBlock & source, T* destination)
+	{
+		cl_int status = 0;
+		cl::Event event;
+		// Enqueue readBuffer. Blocking read (CL_TRUE)!
+		status = source.getQueue()->enqueueReadBuffer(source.getBuffer(),
+		                                              CL_TRUE,
+		                                              0,
+		                                              source.getSize() * sizeof(T),
+		                                              destination,
+		                                              NULL,
+		                                              &event);
+		
+		errorMessage(status, "queue::enqueueReadBuffer()");
+		status = event.wait();
+		errorMessage(status, "Event::wait() - event");
+	}
+	
+	/// Copies source to destination, resizes destination to accommodate source.
+	template <typename T> void copy(MemBlock & source, std::vector<T> & destination)
+	{
+		// this line is necesary in order to avoid unnecesary memory copy trigered by resize()
+		destination.clear();
+		destination.resize(source.getSize());
+		copy(source, &(destination[0]));
+	}
+
+	template <typename T> void copy(Element source, std::vector<T> & destination)
+	{
+		if (isMemBlock(source))
+			copy(dynamic_cast<MemBlock& >(*source), destination);
+		else
+			errorMessage("copy() failed. First argument is not a MemBlock or has unproper type");
+	}
+
+	template void copy(Element source, std::vector<cl_int> &destination);
+	template void copy(Element source, std::vector<cl_float> &destination);
+	template void copy(Element source, std::vector<cl_double> &destination);
+
+	template <typename T> void copy(Element source, T* destination)
+	{
+		if (isMemBlock(source))
+			copy(dynamic_cast<MemBlock& >(*source),destination);
+		else
+			errorMessage("copy() failed. First argument is not a MemBlock or has unproper type");
+	}
+
+	template void copy(Element source, cl_int* destination);
+	template void copy(Element source, cl_float* destination);
+	template void copy(Element source, cl_double* destination);
+	
+	
+	template <typename T> void copy(T* source, MemBlock & destination)
+	{
+		cl_int status = 0;
+		cl::Event event;		
+		// Write data to buffer 
+		status = destination.getQueue()->enqueueWriteBuffer(destination.getBuffer(),
+		                                                    CL_TRUE,
+		                                                    0,
+		                                                    destination.getSize() * sizeof(T),
+		                                                    &source[0],
+		                                                    NULL,
+		                                                    &event);
+		errorMessage(status, "copy() - queue::enqueueWriteBuffer()");
+		status = event.wait();
+		errorMessage(status, "Event::wait() - event");
+		
+	}
+
+	
+	template <typename T> void copy(std::vector<T> & source, MemBlock & destination)
+	{
+		if (source.size() == destination.getSize())
+			copy(&source[0], destination);
+		else
+			errorMessage("copy() - write to MemBlock failed. Sizes do not match");
+	}
+
+
+	template <typename T> void copy(MemBlock & source, MemBlock & destination)
+	{
+		if (source.size() == destination.getSize())
+		{
+			if (source.getQueue().get() == destination.getQueue().get())
+			{
+				// \todoIgal swap buffers???
+			}
+			else
+			{
+				shared_ptr<void> buffer = source.map();
+				copy((T *)buffer, destination);
+			}
+		}
+		else
+		{
+			errorMessage("copy() - write from MemBlock to MemBlock failed. Sizes do not match");
+		}
+		    
+	}
+	
+	template <typename T> void copy(std::vector<T> & source, Element destination)
+	{
+		if (isMemBlock(destination))
+			copy(source, dynamic_cast<MemBlock& >(*destination));				
+		else
+			errorMessage("copy() - Second argument is not a MemBlock type or has unproper type");
+	}
+
+	template void copy(std::vector<cl_int> & source, Element destination);
+	template void copy(std::vector<cl_float> & source, Element destination);
+	template void copy(std::vector<cl_double> & source, Element destination);
+
+	template <typename T> void copy(T* source, Element destination)
+	{
+		if (isMemBlock(destination))
+			copy(source, dynamic_cast<MemBlock& >(*destination));				
+		else
+			errorMessage("copy() - Second argument is not a MemBlock type or has unproper type");
+	}
+
+	template void copy(cl_int* source, Element destination);
+	template void copy(cl_uint* source, Element destination);
+	template void copy(cl_float* source, Element destination);
+	template void copy(cl_double* source, Element destination);
+	template void copy(cl_long* source, Element destination);
+
+	std::vector<Element> & operator<<(std::vector<Element> & ec,
+	                                 const std::vector<Element> & a)
+	{
+		for (unsigned int i(0); i < a.size(); ++i)
+			ec.push_back(a[i]);
+		return ec;
+	}
+
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const std::vector<Element> & a)
+	{
+		for (unsigned int i(0); i < a.size(); ++i)
+			ec.addExpression(a[i]);
+		return ec;
+	}
+	
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const MatrixOfElements & a)
+	{
+		ec << (vector<Element>) (a.getInternalVector()) ;
+		return ec;
+	}
+	
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const ExpressionContainer & a)
+	{
+		ec << a.expression;
+		return ec;
+	}
+	
+	void initData(Element a,
+	              Element initializationValue,
+	              const KernelConfiguration & kernelConfig)
+	{
+		Kernel k(kernelConfig);
+		{ 
+			using namespace elementOperators;
+			k.addExpression(operatorAssignment(a, initializationValue));
+		}
+		k.compute();
+	}
+
+
+	Element generateSubElement(Element e, unsigned int size, int offset)
+	{
+		Element ind(new Index(size));
+		Element offs(new Constant<cl_int>(offset));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offs));
+		return res;
+	}
+
+
+	Element generateSubElement(Element e, unsigned int size, int * offset)
+	{
+		Element ind(new Index(size));
+		Element offs(new VariableReference<cl_int>(*offset));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offs));
+		return res;
+	}
+
+
+	Element generateSubElement(Element e, unsigned int size, Element offset)
+	{
+		Element ind(new Index(size));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offset));
+		return res;
+	}	
+
+
+	Element generateShiftedElement(Element e,int offset)
+	{
+		Element ind(new Index(e->getSize()));
+		Element offs(new Constant<cl_int>(offset));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offs));
+		return res;
+	}
+
+
+	Element generateShiftedElement(Element e, unsigned int size, int * offset)
+	{
+		Element ind(new Index(e->getSize()));
+		Element offs(new VariableReference<cl_int>(*offset));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offs));
+		return res;
+	}
+
+
+	Element generateShiftedElement(Element e, Element offset)
+	{
+		Element ind(new Index(e->getSize()));
+		using namespace elementOperators;
+		Element res(new ElementExcerpt(e, ind + offset));
+		return res;
+	}
+
+
+	ElementData generateElementArray(TypeID typeID,
+	                                 unsigned int size,
+	                                 CommandQueue q)
+	{
+		ElementData v;
+		switch (typeID) 
+		{
+			case TYPE_DOUBLE:
+				v.reset(new Array<cl_double>(size, q));
+				break;	
+			case TYPE_FLOAT:
+				v.reset(new Array<cl_float>(size, q));
+				break;
+		    case TYPE_INT:
+				v.reset(new Array<cl_int>(size, q));		
+				break;
+		    case TYPE_UINT:
+				v.reset(new Array<cl_uint>(size, q));		
+				break;
+		    case TYPE_LONG:
+				v.reset(new Array<cl_long>(size, q));		
+		}
+		return v;
+	}
+
+	ElementData generateElementArray(TypeID typeID,
+	                                 unsigned int size)
+	{
+		return generateElementArray(typeID, size, hardware.defaultQueue);
+	}
+
+	Element generateElementLocalArray(TypeID typeID,
+	                                  unsigned int size)
+	{
+		Element v;
+		switch (typeID) 
+		{
+			case TYPE_DOUBLE:
+				v.reset(new LocalArray<cl_double>(size));
+				break;	
+			case TYPE_FLOAT:
+				v.reset(new LocalArray<cl_float>(size));
+				break;
+		    case TYPE_INT:
+				v.reset(new LocalArray<cl_int>(size));		
+				break;
+		    case TYPE_UINT:
+				v.reset(new LocalArray<cl_uint>(size));		
+				break;
+		    case TYPE_LONG:
+				v.reset(new LocalArray<cl_long>(size));		
+		}
+		return v;
+	}	
+
+} // namespace acl
diff --git a/src/acl/acl.h b/src/acl/acl.h
new file mode 100644
index 0000000..b66c692
--- /dev/null
+++ b/src/acl/acl.h
@@ -0,0 +1,487 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACL_H
+#define ACL_H
+
+#include "aclStdIncludes.h"
+#include <memory>
+#include "Kernels/aclKernelConfiguration.h"
+//#include "aclHardware.h"
+#include "aclTypes.h"
+
+namespace cl
+{
+	class CommandQueue;
+}
+
+
+/// Advanced Computational Language
+namespace acl
+{
+	class ExpressionContainer;
+	class VectorOfElements;
+	class MatrixOfElements;
+	class MemBlock;
+	class ElementBase;
+	template <class T> class Array;
+	typedef std::shared_ptr<MemBlock> ElementData;
+	typedef std::shared_ptr<ElementBase> Element;
+	extern const KernelConfiguration KERNEL_BASIC;
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;	
+
+	
+	/// definitions of mathematical operators and functions for class ::Element
+	namespace elementOperators
+	{
+	// Math Operators
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator-(Element e);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator+(Element e1, Element e2);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator-(Element e1, Element e2);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator*(Element e1, Element e2);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator/(Element e1, Element e2);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator%(Element e1, Element e2);
+
+
+		
+	// Assignment Operators
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operatorAssignment(Element e1, Element e2);
+
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operatorAssignmentSafe(Element e1, Element e2);
+
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operator+=(Element e1, Element e2);
+
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operator-=(Element e1, Element e2);
+
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operator*=(Element e1, Element e2);
+
+		/**
+			 \ingroup AssignmentOperators
+		 */		
+		Element operator/=(Element e1, Element e2);
+
+
+		/**
+			 \ingroup BooleanOperators
+		 */		
+		Element operator>(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element operator<(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element operator>=(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element operator<=(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element isEqual(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element isNotEqual(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element operator&&(Element e1, Element e2);
+
+		/**
+			 \ingroup BooleanOperators
+		 */	
+		Element operator||(Element e1, Element e2);
+
+		/**
+			 \ingroup MathOperators
+		 */
+		Element operator!(Element e);
+
+		
+	// Mathematical Functions
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element sin(Element e);
+
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element cos(Element e);
+
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element sqrt(Element e);
+
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element rsqrt(Element e);
+
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element log(Element e);
+
+		/**
+			 \ingroup MathFunctions
+		 */
+		Element log10(Element e);
+		
+		/**
+			 a^i
+			 \ingroup MathFunctions
+		 */
+		Element powI(Element a, unsigned int i);
+
+		/**
+			 exp(a)
+			 \ingroup MathFunctions
+		 */
+		Element exp(Element a);
+
+		/**
+			 fabs(a)
+			 \ingroup MathFunctions
+		 */
+		Element fabs(Element a);
+
+		/**
+			 abs(a)
+			 \ingroup MathFunctions
+		 */
+		Element abs(Element a);
+
+		/**
+			 abs_diff(a,b)
+			 \ingroup MathFunctions
+		 */
+		Element abs_diff(Element a,Element b);
+		
+		/**
+			 floor(a)
+			 \ingroup MathFunctions
+		 */
+		Element floor(Element a);
+		
+		/**
+			 isnan(a)
+			 \ingroup MathFunctions
+		 */
+		Element isnan(Element a);
+
+		/// Return nan of corresponding float type
+		/// \ingroup MathFunctions
+		Element nan(TypeID t);
+		
+		/**
+		 	returns \p a with sign of \p b
+			 copysign(a,b)
+			 \ingroup MathFunctions
+		 */
+		Element copysign(Element a,Element b);
+
+		/**
+		 	returns 1 with sign of \p a and 0 for a = +-0 
+			 copysign(a,b)
+			 \ingroup MathFunctions
+		 */
+		Element sign(Element a);
+		
+		/**
+			 min(a,b)
+			 \ingroup MathFunctions
+		 */
+		Element min(Element a,Element b);
+
+		/**
+			 max(a,b)
+			 \ingroup MathFunctions
+		 */
+		Element max(Element a,Element b);
+		
+		/// Atomic sum
+		/// \ingroup AtomicFunctions
+		Element atomic_add(Element e1, Element e2);
+
+		/// Atomic subtraction
+		/// \ingroup AtomicFunctions
+		Element atomic_sub(Element e1, Element e2);
+
+		/// Atomic exchange
+		/// \ingroup AtomicFunctions
+		Element atomic_xchg(Element e1, Element e2);
+
+
+		/// ternary mad operator e1 * e2 + e3
+		/// \ingroup MathFunctions
+		Element mad(Element e1, Element e2, Element e3);
+
+
+	// Synchronization Functions
+		/**
+		 Synchronous copy: Global memory <-> Local memory
+
+		 \ingroup SynchronizationFunctions
+		 */
+		Element syncCopy(Element source,
+		                 Element destination,
+		                 Element srcOffset,
+		                 Element dstOffset,
+		                 Element length);
+
+
+
+		/**
+		 Sets work-group barrier
+
+		 \ingroup SynchronizationFunctions
+		 */
+		Element barrier(std::string flags = "CLK_LOCAL_MEM_FENCE");
+
+
+
+	// Special Purpose Functions
+		/**
+		 Creates excerpt from source defined by filter
+		 by replacing of "INDEX" occurrences
+		 in source->str() by filter->str()
+			 
+		 \ingroup SpecialPurposeFunctions
+		 */
+		Element excerpt(Element source, Element filter);
+
+		/**
+		 Parses statement by replacing occurrences of
+		 element's names by corresponding element->str()
+		 from elementNamePairs
+			 
+		 \ingroup SpecialPurposeFunctions
+		 */
+		Element parse(const std::vector<std::pair<Element, std::string> > & elementNamePairs, 
+		              const std::string & statement);
+
+		/**
+		 type conversion
+		 \ingroup SpecialPurposeFunctions
+		 */			
+		Element convert(const TypeID tName, Element e1, bool strong=true);
+
+		/// printf()
+		/// \ingroup SpecialPurposeFunctions
+		Element printfFunction(std::string args);
+		
+		
+		/// Return statement (terminates the execution of a kernel)
+		/// \ingroup ControlStructures
+		Element returnStatement();
+
+		
+		/// If-Else conditional structure
+		/// \ingroup ControlStructures
+		Element ifElse(Element condition, 
+		               const std::vector<Element> & thenBody, 
+		               const std::vector<Element> & elseBody);
+
+			
+		/// ternary branching operator
+		/// \ingroup ControlStructures
+		Element select(Element e1, Element e2, Element e3);
+
+
+		/// For loop
+		/// \ingroup ControlStructures
+		Element forLoop(Element initialization, 
+		                Element condition, 
+		                Element increase, 
+		                const std::vector<Element> & body);
+
+		/// Corresponds to the openCL operation any	
+		Element any(Element e);
+		/// Corresponds to the openCL operation all
+		Element all(Element e);
+		
+
+	}
+
+	
+	//	RTTI functions
+
+	bool isConstant(Element e);
+
+	/// The function returns true when the input is a single valued object e.g. aclConstatnt, aclVariable 
+	bool isSingleValue(Element e); 
+
+	bool isMemBlock(Element e);
+
+	/// Copies source to destination, resizes destination to accommodate source.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(MemBlock &source, T* destination);
+
+	/// Copies source to destination, exit(1) if sizes do not match.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(T* source, MemBlock &destination);
+
+	/// Copies source to destination, resizes destination to accommodate source.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(MemBlock &source, std::vector<T> &destination);
+
+	/// Copies source to destination, exit(1) if sizes do not match.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(std::vector<T> &source, MemBlock &destination);
+
+	/// Copies source to destination, exit(1) if sizes do not match.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(MemBlock &source, MemBlock &destination);
+
+	/// Copies source to destination, resizes destination to accommodate source.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(Element source, std::vector<T> &destination);	
+	
+	/// Copies source to destination, exit(1) if sizes do not match.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(std::vector<T> &source, Element destination);
+
+	/// Copies source to destination.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(Element source, T* destination);	
+	
+	/// Copies source to destination.
+	/// \ingroup HostInteractionFunctions
+	template <typename T> void copy(T* source, Element destination);
+
+	/// puts a vector<Element> in ExpressionContainer
+	/**
+		 \relates ExpressionContainer
+		 \relates VectorOfElements
+	 */
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const std::vector<Element> & a);
+	
+	/// puts a vector<Element> in ExpressionContainer
+	/**
+		 \relates ExpressionContainer
+		 \relates VectorOfElements
+	 */
+	std::vector<Element> & operator<<(std::vector<Element> & ec,
+	                                 const std::vector<Element> & a);
+
+	
+	/// puts a MatrixOfElements in ExpressionContainer
+	/**
+		 \relates ExpressionContainer
+		 \relates VectorOfElements
+	 */
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const MatrixOfElements & a);
+	
+	/// puts a ExpressionContainer in ExpressionContainer
+	/**
+		 \relates ExpressionContainer
+		 \relates VectorOfElements
+	 */
+	ExpressionContainer & operator<<(ExpressionContainer & ec,
+	                                 const ExpressionContainer & a);
+	
+	/// function writes data from \p initializationValue to \p a
+	///	\ingroup SpecialPurposeFunctions
+	void initData(Element a,
+	              Element initializationValue,
+	              const KernelConfiguration & kernelConfig = KERNEL_BASIC);
+
+	/// function creates subElement with given length and offset; offset is constant
+	Element generateSubElement(Element, unsigned int size, int offset);		
+	
+	///function creates subElement with given length and offset; offset can be a variable
+	Element generateSubElement(Element, unsigned int size, int * offset);		
+
+	Element generateSubElement(Element, unsigned int size, Element offset);		
+
+	Element generateShiftedElement(Element, int offset);			
+	Element generateShiftedElement(Element, int* offset);		
+	Element generateShiftedElement(Element, Element offset);		
+
+	template <typename T> void swapBuffers(std::shared_ptr<Array<T> >a, 
+	                                       std::shared_ptr<Array<T> > b);
+
+
+	ElementData generateElementArray(TypeID typeID,
+	                                 unsigned int size);
+	ElementData generateElementArray(TypeID typeID,
+	                                 unsigned int size,
+	                                 CommandQueue queue_);
+
+
+	Element generateElementLocalArray(TypeID typeID,
+	                                  unsigned int size);
+
+} // namespace acl
+#endif // ACL_H
diff --git a/src/acl/aclElementBase.cxx b/src/acl/aclElementBase.cxx
new file mode 100644
index 0000000..6bd2b4e
--- /dev/null
+++ b/src/acl/aclElementBase.cxx
@@ -0,0 +1,73 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclElementBase.h"
+
+using namespace std;
+
+namespace acl
+{
+	
+	const string INDEX("index");
+
+
+	ElementBase::ElementBase(bool isWritable_,
+	                         unsigned int size_,
+	                         TypeID typeID_):
+		size(size_),
+		typeID(typeID_),
+		queue(),
+		isWritable(isWritable_)
+	{
+	}
+
+
+	ElementBase::~ElementBase()
+	{
+	}
+		
+
+	string ElementBase::getAddressSpaceQualifier() const
+	{
+		return "";
+	}
+
+
+	unsigned int ElementBase::getSize() const
+	{
+		return size;
+	}
+
+
+	CommandQueue ElementBase::getQueue() const
+	{
+		return queue;
+	}
+
+
+	TypeID ElementBase::getTypeID() const
+	{
+		return typeID;
+	}
+
+} // namespace acl
diff --git a/src/acl/aclElementBase.h b/src/acl/aclElementBase.h
new file mode 100644
index 0000000..cc6b590
--- /dev/null
+++ b/src/acl/aclElementBase.h
@@ -0,0 +1,77 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLELEMENTBASE_H
+#define ACLELEMENTBASE_H
+
+#include "aclStdIncludes.h"
+//#include "aclHardware.h"
+#include "Kernels/aclKernelConfiguration.h"
+#include <memory>
+#include "aclTypes.h"
+
+namespace cl
+{
+	class CommandQueue;
+	class Kernel;
+}
+
+namespace acl
+{
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
+
+	// GLOBALS	
+	extern const std::string INDEX;
+	extern const KernelConfiguration KERNEL_BASIC;
+	
+	using namespace std;
+	
+	class ElementBase
+	{
+		protected:
+			unsigned int size;
+			TypeID typeID;
+			CommandQueue queue;
+			ElementBase(bool isWritable_, unsigned int size_, TypeID typeID_);
+		public:
+			const bool isWritable;
+			virtual string str(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
+			virtual string getName() const = 0;
+			virtual string getAddressSpaceQualifier() const;
+			unsigned int getSize() const;
+			CommandQueue getQueue() const;
+			TypeID getTypeID() const;
+			virtual string getTypeSignature(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
+			virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
+			/// Adds ElementBase to the kernel source either as an argument or as a local declaration
+			virtual void addToKernelSource(vector<shared_ptr<ElementBase> > & arguments,
+			                               vector<shared_ptr<ElementBase> > & localDeclarations) const = 0;
+
+			virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const = 0;
+			virtual ~ElementBase();
+	};
+
+	typedef std::shared_ptr<ElementBase> Element;
+	
+} // namespace acl
+#endif // ACLELEMENTBASE_H
diff --git a/src/acl/aclGenerators.cxx b/src/acl/aclGenerators.cxx
new file mode 100644
index 0000000..c287981
--- /dev/null
+++ b/src/acl/aclGenerators.cxx
@@ -0,0 +1,611 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclGenerators.h"
+#include "aclMath/aclVectorOfElements.h"
+#include "acl.h"
+#include "DataTypes/aclConstant.h"
+#include "DataTypes/aclArray.h"
+#include "DataTypes/aclSubvector.h"
+#include "DataTypes/aclVariableReference.h"
+#include "DataTypes/aclVariableSP.h"
+#include "DataTypes/aclPrivateVariable.h"
+#include "DataTypes/aclPrivateArray.h"
+#include "DataTypes/aclIndex.h"
+#include "DataTypes/aclIndexExt.h"
+#include "DataTypes/aclGroupID.h"
+
+#include "aclTypesList.h"
+
+
+namespace acl
+{
+
+	template <typename T> VectorOfElements generateVEConstant(T a)
+	{
+		VectorOfElements v(1); 
+		v[0] = Element(new Constant<T>(a));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(t a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEConstant(T a, T b)
+	{
+		VectorOfElements v(2); 
+		v[0] = Element(new Constant<T>(a));
+		v[1] = Element(new Constant<T>(b));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(t a, t b);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEConstant(T a, T b, T c)
+	{
+		VectorOfElements v(3); 
+		v[0] = Element(new Constant<T>(a));
+		v[1] = Element(new Constant<T>(b));
+		v[2] = Element(new Constant<T>(c));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(t a, t b, t c);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+
+	template <typename T> VectorOfElements generateVEConstantN(unsigned int n, T a)
+	{
+		VectorOfElements v(n);
+		v[0] = Element(new Constant<T>(a));
+		for (unsigned int i(1); i < n; ++i)
+			v[i] = v[0];
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstantN(unsigned int n, t a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEConstant(unsigned int n,
+	                                                          const T* const a)
+	{
+		VectorOfElements v(n);
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = Element(new Constant<T>(a[i]));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(unsigned int n, const t* const a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEConstant(const vector<T> & a)
+	{
+		return generateVEConstant(a.size(), &a[0]);		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(const vector<t> & a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEConstant(const asl::AVec<T> &a)
+	{
+		VectorOfElements v(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			v[i] = Element(new Constant<T>(a[i]));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEConstant(const asl::AVec<t> &a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> MatrixOfElements generateMEConstant(const asl::AMatr<T> &a)
+	{
+		MatrixOfElements m(a.getNRow(), a.getNCol());
+		copy(generateVEConstant(a.getInternalVec()),
+		     m.getInternalVector());
+		return m;		
+	}
+
+	template MatrixOfElements generateMEConstant(const asl::AMatr<double> &a);
+	template MatrixOfElements generateMEConstant(const asl::AMatr<float> &a);
+		
+	template <typename T> 
+	VectorOfElementsData generateVEData(unsigned int length,
+	                                    unsigned int nComponents,
+	                                    CommandQueue queue)
+	{
+		VectorOfElementsData v(nComponents);
+		for (unsigned int i(0); i < nComponents; ++i)
+			v[i] = ElementData(new Array<T>(length, queue));
+		return v;		
+	}	
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+	template VectorOfElementsData generateVEData<t>(unsigned int length, \
+	                                                unsigned int nComponents, \
+	                                                CommandQueue queue);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> 
+	VectorOfElementsData generateVEData(unsigned int length,
+	                                    unsigned int nComponents)
+	{
+		return generateVEData<T>(length,nComponents,hardware.defaultQueue);
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+	template VectorOfElementsData generateVEData<t>(unsigned int length, \
+	                                                unsigned int nComponents);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	VectorOfElementsData generateVEData(unsigned int length,
+    	                                TypeID typeID,
+		                                unsigned int nComponents,
+		                                CommandQueue queue)
+	{
+		VectorOfElementsData v(nComponents);
+		for (unsigned int i(0); i < nComponents; ++i)
+			v[i] = generateElementArray(typeID, length, queue);
+		return v;
+	}
+	
+
+	VectorOfElements generateVELocalArray(unsigned int componentSize,
+	                                      TypeID typeID,
+	                                      unsigned int size)
+	{
+		VectorOfElements v(size);
+		for (unsigned int i(0); i < size; ++i)
+			v[i] = generateElementLocalArray(typeID, componentSize);
+		return v;
+	}
+
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & data)
+	{
+		VectorOfElements v(1);
+		v[0] = Element(new PrivateArray<T>(data));
+		return v;		
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template VectorOfElements generateVEPrivateArray(const vector<T> & d);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & data)
+	{
+		unsigned int nd(data[0].getSize());
+		VectorOfElements v(nd);
+		vector<T> d(data.size());
+		for(unsigned int i(0); i < nd; ++i)
+		{
+			for(unsigned int j(0); j < data.size(); ++j)
+				d[j] = data[j][i];
+			v[i] = Element(new PrivateArray<T>(d));
+		}
+		return v;		
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & d);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+		
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & d,
+	                                  	                          TypeID typeID)
+	{
+		VectorOfElements v(1);
+		switch (typeID) 
+		{
+			#define BOOST_TT_rep_expression(r, data, tt) \
+				case typeToTypeID<tt>():	\
+					{   \
+						vector<tt> newD(d.size());  \
+						copy(d.begin(),d.end(),newD.begin());   \
+						copy(generateVEPrivateArray(newD), v);  \
+					}   \
+					break;	
+			BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+			#undef BOOST_TT_rep_expression	
+		}
+		return v;
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template VectorOfElements generateVEPrivateArray(const vector<T> & d, TypeID typeID);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & d,
+	                                  	                          TypeID typeID)
+	{
+		VectorOfElements v(1);
+		switch (typeID) 
+		{
+			#define BOOST_TT_rep_expression(r, data, tt) \
+				case typeToTypeID<tt>():	\
+					{   \
+						vector<asl::AVec<tt>> newD(d.size());  \
+						copy(d.begin(),d.end(),newD.begin());   \
+						copy(generateVEPrivateArray(newD), v);  \
+					}   \
+					break;	
+			BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+			#undef BOOST_TT_rep_expression	
+		}
+		return v;
+	}
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & d, TypeID typeID);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+
+		
+	template <typename T> 
+	VectorOfElements generateVEDataSub(T,
+	                                   unsigned int sublength,
+	                                   unsigned int length,
+	                                   unsigned int nComponents,
+	                                   CommandQueue queue)
+	{
+		VectorOfElements v(nComponents);
+		for (unsigned int i(0); i < nComponents; ++i)
+		{
+			shared_ptr<Array<T> > vec(new Array<T>(length, queue));
+			v[i] = Element(new Subvector<T>(vec, sublength, 0u));
+		}
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+	template VectorOfElements generateVEDataSub(t,	\
+	                                            unsigned int sublength,	\
+	                                            unsigned int length,	\
+	                                            unsigned int nComponents,	\
+	                                            CommandQueue queue);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEVariableR(T& a)
+	{
+		VectorOfElements v(1); 
+		v[0] = Element(new VariableReference<T>(a));
+		return v;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableR(t & a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEVariableR(T& a, T& b)
+	{
+		VectorOfElements v(2); 
+		v[0] = Element(new VariableReference<T>(a));
+		v[1] = Element(new VariableReference<T>(b));
+		return v;	
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableR(t & a, t & b);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	template <typename T> VectorOfElements generateVEVariableR(T& a, T& b, T& c)
+	{
+		VectorOfElements v(3); 
+		v[0] = Element(new VariableReference<T>(a));
+		v[1] = Element(new VariableReference<T>(b));
+		v[2] = Element(new VariableReference<T>(c));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableR(t & a, t & b, t & c);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEVariableR(asl::AVec<T>& a)
+	{
+		unsigned int n(nD(a));
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = Element(new VariableReference<T>(a[i]));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableR(asl::AVec<t> & a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a)
+	{
+		VectorOfElements v(1); 
+		v[0] = Element(new VariableSP<T>(a));
+		return v;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableSP(std::shared_ptr<t> a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a,
+	                                                            std::shared_ptr<T> b)
+	{
+		VectorOfElements v(2); 
+		v[0] = Element(new VariableSP<T>(a));
+		v[1] = Element(new VariableSP<T>(b));
+		return v;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableSP(std::shared_ptr<t> a, std::shared_ptr<t> b);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a,std::shared_ptr<T> b, std::shared_ptr<T> c)
+	{
+		VectorOfElements v(3); 
+		v[0] = Element(new VariableSP<T>(a));
+		v[1] = Element(new VariableSP<T>(b));
+		v[2] = Element(new VariableSP<T>(c));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableSP(std::shared_ptr<t> a, std::shared_ptr<t> b, std::shared_ptr<t> c);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<asl::AVec<T>> a)
+	{
+		unsigned int n(nD(*a));
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = Element(new VariableSP<T>(std::shared_ptr<T>(a, & (*a)[i]) ));
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEVariableSP(std::shared_ptr<asl::AVec<t>> a);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	
+	template <typename T> VectorOfElements generateVEPrivateVariable(unsigned int n)
+	{
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = Element(new PrivateVariable<T>());
+		return v;		
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElements generateVEPrivateVariable<t>(unsigned int i);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	VectorOfElements generateVEPrivateVariable(unsigned int n, TypeID t)
+	{
+		VectorOfElements v;
+		switch (t) 
+		{
+			#define BOOST_TT_rep_expression(r, data, tt) \
+				case typeToTypeID<tt>():	\
+					copy(generateVEPrivateVariable<tt>(n), v);	\
+					break;	
+			BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+			#undef BOOST_TT_rep_expression	
+		}
+		return v;		
+	}
+
+	MatrixOfElements generateMEPrivateVariable(unsigned int nR, unsigned int nC, TypeID t)
+	{
+		MatrixOfElements res(nR,nC);
+		copy(generateVEPrivateVariable(nR*nC, t), res.getInternalVector());
+		return res;
+	}
+
+	
+	VectorOfElements generateVESubElements(VectorOfElements a,
+	                                       unsigned int length,
+	                                       int offset)
+	{
+		unsigned int n(a.size());
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateSubElement(a[i], length, offset);
+		return v;		
+	}
+
+
+	VectorOfElements generateVESubElements(VectorOfElements a,
+	                                       unsigned int length,
+	                                       VectorOfElements offset)
+	{
+		unsigned int n(a.size());
+		if (n != offset.size())
+			errorMessage("generateVESubElements(): two VectorOfElements have different sizes");
+		VectorOfElements v(n);
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateSubElement(a[i], length, offset[i]);
+		return v;		
+	}
+
+
+	VectorOfElements generateVEShiftedElements(VectorOfElements a,
+	                                          int offset)
+	{
+		unsigned int n(a.size());
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateShiftedElement(a[i], offset);
+		return v;		
+	}
+
+	VectorOfElements generateVEShiftedElements(VectorOfElements a,
+	                                           VectorOfElements offset)
+	{
+		unsigned int n(a.size());
+		if (n != offset.size())
+			errorMessage("generateVEShiftedElements(): two VectorOfElements have different sizes");
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateShiftedElement(a[i], offset[i]);
+		return v;		
+	}
+
+
+	VectorOfElements generateVEShiftedElements(VectorOfElements a,
+	                                           const vector<int> & offset)
+	{
+		unsigned int n(a.size());
+		if (n != offset.size())
+			errorMessage("generateVEShiftedElements(): VectorOfElements and vector<int> have different sizes");
+		VectorOfElements v(n); 
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateShiftedElement(a[i], offset[i]);
+		return v;		
+	}
+
+
+	VectorOfElements generateParsedVE(const VectorOfElements & fields,
+	                                  const vector<string> & names,
+	                                  const string & statement)
+	{
+		if (fields.size() != names.size())
+			errorMessage("generateParsedVE(): VectorOfElements \"fields\" and vector<string> \"names\" have different sizes");
+		vector<pair<Element, string> > f(names.size());
+		for (unsigned int i(0); i < names.size(); ++i)
+		{
+			f[i].first = fields[i];
+			f[i].second = names[i];
+		}
+
+		VectorOfElements a(1u);
+		a[0] = elementOperators::parse(f, statement);
+		return a;			
+	}
+		
+	VectorOfElements generateVEPolynom(VectorOfElements x,
+	                                   VectorOfElements coefs)
+	{
+		if (x.size() > 1)
+			errorMessage("generateVEPolynom(): \"x\" has size more than 1");
+		if (coefs.size() < 1)
+			errorMessage("generateVEPolynom(): size of \"coefs\" less than 1");
+		auto type(getElementType(x));
+		VectorOfElements p(x.size());
+		copy(subVE(coefs, 0), p);
+		for (unsigned int i(1); i < coefs.size(); ++i)
+			copy(mad(p, x, subVE(coefs, i), type), p);
+//			p[0] = p[0] * x[0] + coefs[i];
+		return p;	
+	}
+
+	template <typename T> MatrixOfElements generateMEUnit(unsigned int n)
+	{
+		MatrixOfElements m(n,n);
+		Element c0(new Constant<T>(0));
+		Element c1(new Constant<T>(1));
+		
+		for(unsigned int i(0); i<n; ++i)
+			for(unsigned int j(0); j<n; ++j)
+				m.setElement(i,j,c0);
+		for(unsigned int i(0); i<n; ++i)
+			m.setElement(i,i,c1);
+		return m;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template MatrixOfElements generateMEUnit<t>(unsigned int n);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+	
+	MatrixOfElements generateMEDiagonal(const VectorOfElements & d)
+	{
+		unsigned int n(d.size());
+		MatrixOfElements m(n,n);
+
+		Element c0(new Constant<int>(0));
+		
+		for(unsigned int i(0); i<n; ++i)
+			for(unsigned int j(0); j<n; ++j)
+				m.setElement(i,j,c0);
+		for(unsigned int i(0); i<n; ++i)
+			m.setElement(i,i,d[i]);
+		
+		return m;
+	}
+	
+/*	template <typename T> VectorOfElements indexDependedConstant(vector<unsigned int> r, vector<T> values)
+	{
+		Index in;
+		
+		Element e(select())
+		return 
+	}*/
+
+
+	VectorOfElements generateVEIndex(unsigned int size)
+	{
+		VectorOfElements v(1);
+		Element ind(new Index(size));
+		v[0] = ind;
+		return v;
+	}
+
+	VectorOfElements generateVEGroupID()
+	{
+		VectorOfElements v(1);
+		v[0].reset(new GroupID());
+		return v;
+	}
+
+	VectorOfElements generateVEIndexExt(unsigned int size)
+	{
+		VectorOfElements v(1);
+		Element ind(new IndexExt(size));
+		v[0] = ind;
+		return v;
+	}
+	
+} // acl
diff --git a/src/acl/aclGenerators.h b/src/acl/aclGenerators.h
new file mode 100644
index 0000000..bb740e9
--- /dev/null
+++ b/src/acl/aclGenerators.h
@@ -0,0 +1,190 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLGENERATORS_H
+#define ACLGENERATORS_H
+
+#include "aclMath/aclVectorOfElementsDef.h"
+#include "aclMath/aclMatrixOfElements.h"
+#include <math/aslVectors.h>
+#include <math/aslMatrices.h>
+
+
+namespace acl
+{
+	/// Generates VectorOfElements with 1 Element acl::Constant with value a \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(T a);
+	/// Generates VectorOfElements with 2 Elements acl::Constant with values a and b \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(T a, T b);
+	/// Generates VectorOfElements with 3 Elements acl::Constant with values a,b and c \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(T a, T b, T c);
+	/// Generates VectorOfElements with n Elements acl::Constant with values a \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstantN(unsigned int n, T a);
+	/// Generates VectorOfElements with \p n Elements acl::Constant with values a[i] \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(unsigned int n, const T* const a);
+	/// Generates VectorOfElements with a.size() Elements acl::Constant with values a[i] \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(const std::vector<T> & a);
+	/// Generates VectorOfElements correspondinng to \p a \ingroup generateVE
+	template <typename T> VectorOfElements generateVEConstant(const asl::AVec<T> & a);
+	/// Generates VectorOfElements correspondinng to \p a \ingroup generateME
+	template <typename T> MatrixOfElements generateMEConstant(const asl::AMatr<T> & a);
+		
+	/// Generates VectorOfElements with \p nComponents Elements acl::Vector with size \p length \ingroup generateVE
+	template <typename T> VectorOfElementsData generateVEData(unsigned int length,
+	                                                          unsigned int nComponents,
+	                                                          CommandQueue queue);
+
+	/// Generates VectorOfElements with \p nComponents Elements acl::Vector with size \p length and default queue \ingroup generateVE
+	template <typename T> VectorOfElementsData generateVEData(unsigned int length,
+	                                                          unsigned int nComponents = 1);
+	
+	/// Generates VectorOfElementsData with \p nComponents Elements acl::Array of type \p with size \p length \ingroup generateVE
+	VectorOfElementsData generateVEData(unsigned int length,
+    	                                TypeID typeID,
+		                                unsigned int nComponents,
+		                                CommandQueue queue);
+
+		/// Generates VectorOfElementsData with \p nComponents Elements acl::Array of type \p with size \p length and default queue \ingroup generateVE
+	VectorOfElementsData generateVEData(unsigned int length,
+    	                                TypeID typeID,
+		                                unsigned int nComponents = 1);
+
+	
+	/// Generates VectorOfElements with \p size Elements acl::LocalArray of type \p typeID with size \p componentSize \ingroup generateVE
+	VectorOfElements generateVELocalArray(unsigned int componentSize,
+	                                      TypeID typeID,
+	                                      unsigned int size);
+
+	/// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with data defined by \p data \ingroup generateVE
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & data);
+	/// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with data defined by \p data \ingroup generateVE
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & data);
+
+	/// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with size \p componentSize \ingroup generateVE
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & data,
+	                                  	                          TypeID typeID);
+	/// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with size \p componentSize \ingroup generateVE
+	template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & data,
+	                                  	                          TypeID typeID);
+	
+	/// Generates VectorOfElements with \p nComponents Elements acl::Subvector with size \p sublength. \p length is the vector size \ingroup generateVE
+	template <typename T> VectorOfElements generateVEDataSub(T,
+	                                                     unsigned int sublength,
+	                                                     unsigned int length,
+	                                                     unsigned int nComponents,
+	                                                     CommandQueue queue);
+
+	/// Generates VectorOfElements with 1 Element acl::VariableReference with reference on \p a	\ingroup generateVE
+	template <typename T> VectorOfElements generateVEVariableR(T& a);
+	/// Generates VectorOfElements with 2 Element acl::VariableReference with references on \p a and \p b	\ingroup generateVE
+	template <typename T> VectorOfElements generateVEVariableR(T& a, T& b);
+	/// Generates VectorOfElements with 3 Element acl::VariableReference with references on \p a, \p b and \p c \ingroup generateVE	
+	template <typename T> VectorOfElements generateVEVariableR(T& a, T& b, T& c);
+	/// Generates VectorOfElements with nD(a) Element acl::VariableReference with reference on \p a[i] \ingroup generateVE	
+	template <typename T> VectorOfElements generateVEVariableR(asl::AVec<T>& a);
+
+
+	/// Generates VectorOfElements with 1 Element acl::VariableReference with reference on \p a	\ingroup generateVE
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a);
+	/// Generates VectorOfElements with 2 Element acl::VariableReference with references on \p a and \p b	\ingroup generateVE
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a, std::shared_ptr<T> b);
+	/// Generates VectorOfElements with 3 Element acl::VariableReference with references on \p a, \p b and \p c \ingroup generateVE	
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a, std::shared_ptr<T> b, std::shared_ptr<T> c);
+	/// Generates VectorOfElements with nD(a) Element acl::VariableReference with reference on \p a[i] \ingroup generateVE	
+	template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<asl::AVec<T>> a);
+	
+	
+	/// Generates VectorOfElements with \p n Element of acl::PrivateVariable \ingroup generateVE
+	template <typename T> VectorOfElements generateVEPrivateVariable(unsigned int n);
+
+	/// Generates VectorOfElements with \p n Element of acl::PrivateVariable with type \p t \ingroup generateVE
+	VectorOfElements generateVEPrivateVariable(unsigned int n, TypeID t);
+
+	/// Generates VectorOfElements with \p n Element of acl::PrivateVariable with type \p t \ingroup generateME
+	MatrixOfElements generateMEPrivateVariable(unsigned int nR, unsigned int nC, TypeID t);
+
+	
+	/// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
+	VectorOfElements generateVESubElements(VectorOfElements a, unsigned int length, int offset);
+	
+	/// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
+	VectorOfElements generateVESubElements(VectorOfElements a, unsigned int length, VectorOfElements offset);
+
+	/// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
+	VectorOfElements generateVEShftedElements(VectorOfElements a, int offset);
+
+	/// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
+	VectorOfElements generateVEShftedElements(VectorOfElements a, const std::vector<int> & offset);
+	
+	/// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
+	VectorOfElements generateVEShiftedElements(VectorOfElements a, VectorOfElements offset);
+
+	/// Generates VectorOfElements which 1 element correspond to polynom for \p x with \p coefs \ingroup generateVE
+	/// The polinom is \f$ x^{n-1}*coefs_0+x^{n-2}coefs_1+...+coefs_{n-1} \f$
+	/**
+		The polynom contains mad fanction with type specification the type is 
+		 defined by \p x  
+	*/
+	VectorOfElements generateVEPolynom(VectorOfElements x, VectorOfElements coefs);
+	
+	/// 
+	VectorOfElements generateParsedVE(const VectorOfElements & fields,
+	                                  const vector<string> & names,
+	                                  const string & statement);
+		
+
+	/// \ingroup generateME	
+	template <typename T=int>MatrixOfElements generateMEUnit(unsigned int n);
+
+	/// \ingroup generateME	
+	MatrixOfElements generateMEDiagonal(const VectorOfElements & d);
+
+	/// \ingroup generateME	
+	/**
+		\param  sc contains sin and cos values
+	 */
+	MatrixOfElements generateMEGivensRotation(unsigned int k,
+	                                          unsigned int l,
+	                                          const VectorOfElements & sc);
+
+	
+	// insert local variable which takes values accoding to index \ingroup generateVE
+	template <typename T> VectorOfElements indexDependedConstant(vector<unsigned int> r,
+	                                                             vector<T> values);
+
+
+	/// Generates VectorOfElements with one Element of type Index
+	/// \ingroup generateVE
+	VectorOfElements generateVEIndex(unsigned int size = 0);
+
+	/// Generates VectorOfElements with one Element of type GroupID
+	/// \ingroup generateVE
+	VectorOfElements generateVEGroupID();
+
+	/// Generates VectorOfElements with one Element of type Index
+	/// \ingroup generateVE
+	VectorOfElements generateVEIndexExt(unsigned int size = 0);
+	
+}  //namespace acl
+
+#endif // ACLGENERATORS_H
diff --git a/src/acl/aclHardware.cxx b/src/acl/aclHardware.cxx
new file mode 100644
index 0000000..ee52d0f
--- /dev/null
+++ b/src/acl/aclHardware.cxx
@@ -0,0 +1,246 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclHardware.h"
+#include "../aslUtilities.h"
+#include "Kernels/aclKernel.h"
+#include "../utilities/aslParametersManager.h"
+#include <fstream>
+
+using namespace std;
+using namespace asl;
+
+namespace acl
+{
+	vector<string> clExtension({"cl_khr_fp64",
+								"cl_khr_int64_base_atomics",
+								"cl_khr_int64_extended_atomics",
+								"CL_KHR_gl_sharing"});
+
+	// order of elements in TYPE and TYPE_SIZE
+	// has to correspond to the order of elements of TypeID
+	// dot't change strings to "cl_..."
+	const vector<string> TYPE({"int", "uint", "float", "double", "long"});
+	const vector<unsigned char> TYPE_SIZE({sizeof(cl_int), sizeof(cl_uint), sizeof(cl_float), sizeof(cl_double), sizeof(cl_long)});
+	const vector<TypeID> TYPE_SELECT({TYPE_INT, 	TYPE_INT, TYPE_INT, TYPE_LONG, TYPE_LONG});
+
+	Hardware hardware;
+	
+	Hardware::Hardware():
+		devicesInfo(""),
+		defaultPlatform(""),
+		defaultDevice("")
+	{
+		loadConfiguration();
+		
+
+		// Have a look at the available platforms and their devices
+		vector<cl::Platform> platforms;
+		vector<cl::Device> devices;
+		cl_context_properties cps[3];
+		cl::Context context;
+		
+		cl_int status = 0;	
+		status = cl::Platform::get(&platforms);
+		errorMessage(status, "Platform::get()");
+		
+		if (platforms.size() > 0)
+		{
+			for (unsigned int i = 0; i < platforms.size(); ++i)
+			{
+				status = platforms[i].getDevices(CL_DEVICE_TYPE_ALL, &devices);
+				errorMessage(status, "Platform::getDevices()");
+				devicesInfo += "Platform: " + platforms[i].getInfo<CL_PLATFORM_VENDOR>()
+					 + "\nNumber of devices: " + numToStr(devices.size()) + "\n";
+
+				cps[0] = CL_CONTEXT_PLATFORM;
+				cps[1] = (cl_context_properties)(platforms[i])();
+				cps[2] = 0;
+
+				for (unsigned int j = 0; j < devices.size(); ++j)
+				{
+					// Create an OpenCL context for the current device
+					context = cl::Context(vector<cl::Device>(1, devices[j]), cps, NULL, NULL, &status);
+					errorMessage(status, "Context::Context()");
+
+					// Create an OpenCL command queue for current context and device
+					queues.push_back(CommandQueue(new cl::CommandQueue(context, devices[j], 0, &status)));
+					errorMessage(status, "CommandQueue::CommandQueue()");
+					
+					if ((platforms[i].getInfo<CL_PLATFORM_VENDOR>().c_str() == defaultPlatform) && 
+					    (devices[j].getInfo<CL_DEVICE_NAME>().c_str() == defaultDevice))
+					{
+						// Choose requested device on requested platform
+						defaultQueue = queues.back();
+					}
+
+					devicesInfo += "\t" + devices[j].getInfo<CL_DEVICE_NAME>() + "\n";
+				}
+			}
+		}
+		
+		if (defaultQueue.get() == 0)
+		{
+			devicesInfo += "\n" + warningString("Requested device not found") + "\n";
+			// Choose first available device
+			defaultQueue = queues.front();
+		}
+
+		// get platform and device info from defaultQueue
+		devicesInfo += "\nDefault device: " + getPlatformVendor(defaultQueue)
+					+ ", " + getDeviceName(defaultQueue) + "\n";
+	}
+
+
+	void Hardware::loadConfiguration(const string & fileName)
+	{
+		ParametersManager parametersManager;
+		Parameter<string> platform("", "platform", "Default platform", "");
+		Parameter<string> device("", "device", "Default device", "");
+		parametersManager.load(fileName);
+
+		defaultPlatform = platform.v();
+		defaultDevice = device.v();
+	}
+
+
+	string Hardware::getDevicesInfo()
+	{
+		return devicesInfo;
+	}
+	
+
+	string getPlatformVendor(const CommandQueue & queue)
+	{
+		cl_context_properties cps = getContext(queue).getInfo<CL_CONTEXT_PROPERTIES>()[1];
+		return  (cl::Platform((cl_platform_id)cps)).getInfo<CL_PLATFORM_VENDOR>();
+	}
+
+
+	string getDeviceName(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_NAME>();
+	}
+
+	cl_device_type getDeviceType(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_TYPE>();
+	}
+		
+	cl_uint getNComputeUnits(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>();
+	}
+
+	cl::Device getDevice(const CommandQueue & queue)
+	{
+		return queue->getInfo<CL_QUEUE_DEVICE>();
+	}
+
+
+	cl::Context getContext(const CommandQueue & queue)
+	{
+		return queue->getInfo<CL_QUEUE_CONTEXT>();
+	}
+
+
+	unsigned int getAlignment(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE>();
+	}
+
+
+	size_t getMaxItemSize(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_MAX_WORK_ITEM_SIZES>()[0];
+	}
+
+
+	cl_uint getVectorWidth(const CommandQueue & queue, const TypeID typeID)
+	{
+		cl_uint width;
+
+		switch (typeID)
+		{
+			case TYPE_INT:
+				width = getDevice(queue).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_INT>();
+				break;
+			case TYPE_UINT:
+				// same width as in TYPE_INT
+				width = getDevice(queue).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_INT>();
+				break;
+			case TYPE_FLOAT:
+				width = getDevice(queue).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT>();
+				break;
+			case TYPE_LONG:
+				width = getDevice(queue).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG>();
+				break;
+			default:
+				width = getDevice(queue).getInfo<CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE>();
+				break;
+		}
+
+		return width;
+	}
+	
+
+	bool extensionAvailable(const CommandQueue & queue, const Extension extension)
+	{
+		string availableExtensions = getDevice(queue).getInfo<CL_DEVICE_EXTENSIONS>();
+		return (availableExtensions.find(clExtension[extension]) != string::npos);	
+	}
+
+
+	cl_device_local_mem_type getLocalMemoryType(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_LOCAL_MEM_TYPE>();
+	}
+
+
+	cl_ulong getLocalMemorySize(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_LOCAL_MEM_SIZE>();
+	}
+
+
+	cl_ulong getKernelLocalMemSize(const Kernel & kernel)
+	{
+		return kernel.getKernel().getWorkGroupInfo<CL_KERNEL_LOCAL_MEM_SIZE>(getDevice(kernel.getQueue()));
+	}
+
+
+	cl_ulong getKernelPrivateMemSize(const Kernel & kernel)
+	{
+		return kernel.getKernel().getWorkGroupInfo<CL_KERNEL_PRIVATE_MEM_SIZE >(getDevice(kernel.getQueue()));
+//		return kernel.getKernel().getWorkGroupInfo<CL_KERNEL_WORK_GROUP_SIZE >(getDevice(kernel.getQueue())); 
+
+	}
+
+
+	cl_device_fp_config doublePrecisionSupport(const CommandQueue & queue)
+	{
+		return getDevice(queue).getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>();
+	}
+
+
+} // namespace acl
diff --git a/src/acl/aclHardware.h b/src/acl/aclHardware.h
new file mode 100644
index 0000000..4720d7c
--- /dev/null
+++ b/src/acl/aclHardware.h
@@ -0,0 +1,151 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLHARDWARE_H
+#define ACLHARDWARE_H
+
+#include <CL/cl.hpp>
+#include "aclStdIncludes.h"
+#include <memory>
+#include "aclTypes.h"
+
+namespace acl
+{
+
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
+
+
+	extern const std::vector<std::string> TYPE;
+	extern const std::vector<unsigned char> TYPE_SIZE;
+	/// contains trasnlation of types necessery for use in the function select
+	/* expression in the condition field should have this type*/ 
+	extern const std::vector<TypeID> TYPE_SELECT;
+
+	/// Returns vendor name.
+	/// \ingroup HardwareInformation
+	std::string getPlatformVendor(const CommandQueue & queue);
+	/// Returns device name.
+	/// \ingroup HardwareInformation
+	std::string getDeviceName(const CommandQueue & queue);
+
+	/// Returns device type.
+	/// \ingroup HardwareInformation
+	cl_device_type getDeviceType(const CommandQueue & queue);
+
+	/// Returns number of computer units on the device.
+	/// \ingroup HardwareInformation
+	cl_uint getNComputeUnits(const CommandQueue & queue);
+	
+	cl::Device getDevice(const CommandQueue & queue);
+	cl::Context getContext(const CommandQueue & queue);
+
+	/// Returns the smallest alignment in bytes which can be used for any data type.
+	/// \ingroup HardwareInformation
+	unsigned int getAlignment(const CommandQueue & queue);
+	
+
+	/// Returns type of local memory supported.
+	/// CL_LOCAL (implies dedicated local memory storage such as SRAM) or CL_GLOBAL.
+	/// \ingroup HardwareInformation
+	cl_device_local_mem_type getLocalMemoryType(const CommandQueue & queue);
+
+
+	/// Size of local memory arena in bytes. The minimum value is 1 KB.
+	/// \ingroup HardwareInformation
+	cl_ulong getLocalMemorySize(const CommandQueue & queue);
+
+
+	/// Returns the maximum number of work-items that can be specified
+	/// in '0' dimension of the work-group to clEnqueueNDRangeKernel.
+	/// \ingroup HardwareInformation
+	size_t getMaxItemSize(const CommandQueue & queue);
+
+
+	/// Returns the native ISA vector width. The vector width is defined as the
+	/// number of scalar elements that can be stored in the vector.
+	/// If the cl_khr_fp64 extension is not supported,
+	/// CL_DEVICE_NATIVE_DOUBLE must return 0.
+	/// \ingroup HardwareInformation
+	cl_uint getVectorWidth(const CommandQueue & queue, const TypeID typeID);
+
+
+	/// Checks availability of an OpenCL extension 
+	/// \ingroup HardwareInformation
+	bool extensionAvailable(const CommandQueue & queue, const Extension extension);
+
+
+	/// Describes double precision floating-point capability of the OpenCL device.
+	/// Returns a non-zero value if double precision FP is supported.
+	/// See CL_DEVICE_DOUBLE_FP_CONFIG for more info.
+	/// \ingroup HardwareInformation
+	cl_device_fp_config doublePrecisionSupport(const CommandQueue & queue);
+
+	class Kernel;
+	
+	/**
+	Returns the amount of local memory in bytes being used by a kernel. This
+	includes local memory that may be needed by an implementation to execute
+	the kernel, variables declared inside the kernel with the __local address
+	qualifier and local memory to be allocated for arguments to the kernel
+	declared as pointers with the __local address qualifier and whose size is
+	specified with clSetKernelArg.
+
+	\ingroup HardwareInformation
+	*/
+	cl_ulong getKernelLocalMemSize(const Kernel & kernel);
+
+
+	/**
+	Returns the minimum amount of private memory, in bytes, used by each work-
+	item in the kernel. This value may include any private memory needed by
+	an implementation to execute the kernel, including that used by the language
+	built-ins and variable declared inside the kernel with the __private qualifier.
+
+	\ingroup HardwareInformation
+	*/
+	cl_ulong getKernelPrivateMemSize(const Kernel & kernel);
+
+
+	/// Provides access to the underlying hardware
+	class Hardware
+	{
+		public:
+			/// OpenCL related initializations are done here.
+			/// Context, Device list, Command Queue are set up.
+			Hardware();
+			void loadConfiguration(const std::string & fileName = "asl.ini");
+			std::vector<CommandQueue> queues;
+			CommandQueue defaultQueue;
+			std::string getDevicesInfo();
+		private:
+			std::string devicesInfo;
+			std::string defaultPlatform;
+			std::string defaultDevice;
+	};
+
+
+	// GLOBALS
+	extern Hardware hardware;
+
+} // namespace acl
+#endif // ACLHARDWARE_H
diff --git a/src/acl/aclMath/CMakeLists.txt b/src/acl/aclMath/CMakeLists.txt
new file mode 100644
index 0000000..1c47c66
--- /dev/null
+++ b/src/acl/aclMath/CMakeLists.txt
@@ -0,0 +1,31 @@
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslaclMath
+
+set(aslaclMath_PUBLIC_HEADERS
+	aclVectorOfElements.h
+	aclVectorOfElementsDef.h
+	aclVectorOfElementsOperations.h
+	aclMatrixOfElements.h
+	aclComplexNumOfElements.h
+	aclQuaternionOfElements.h
+	aclReductionAlgGenerator.h
+	aclBarycentric.h
+	aclMathAlg.h
+)
+
+set(aslaclMath_SOURCES
+	${aslaclMath_PUBLIC_HEADERS}
+	aclVectorOfElementsDef.cxx
+	aclVectorOfElementsOperations.cxx
+	aclMatrixOfElements.cxx
+	aclComplexNumOfElements.cxx
+	aclQuaternionOfElements.cxx
+	aclReductionAlgGenerator.cxx
+	aclBarycentric.cxx
+	aclMathAlg.cxx
+)
+
+add_library(aslaclMath ${aslaclMath_SOURCES})
+INSTALL_SUBLIB(aslaclMath aslaclMath_PUBLIC_HEADERS)
diff --git a/src/acl/aclMath/aclBarycentric.cxx b/src/acl/aclMath/aclBarycentric.cxx
new file mode 100644
index 0000000..4883224
--- /dev/null
+++ b/src/acl/aclMath/aclBarycentric.cxx
@@ -0,0 +1,109 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclBarycentric.h"
+#include "aclMatrixOfElements.h"
+#include "aclVectorOfElements.h"
+#include "aclGenerators.h"
+#include "../aslUtilities.h"
+
+using namespace std;
+using asl::errorMessage;
+
+namespace acl
+{
+	Barycentric::Barycentric(vector<acl::VectorOfElements> & p)
+	{
+		init(p);
+	}
+	
+	Barycentric::Barycentric():
+		corners(0)
+	{
+	}
+	
+	void Barycentric::init(vector<VectorOfElements> & p)
+	{
+		acl::TypeID type(getElementType(p[0]));
+
+		if (p.size()-1 != p[0].size())
+			errorMessage("Barycentric::init: number of points does not corresponds to the dimentionality");
+			
+		corners.resize(p.size());
+		for (unsigned int i(0); i < p.size(); ++i)
+			copy(p[i],corners[i]);
+
+		unsigned int n(p.size()-1);
+		t.resize(n, n);
+		if (n != tInv.getNRows())
+		{
+			tInv.resize(n, n);
+			copy(generateVEPrivateVariable(n*n, type), tInv.getInternalVector());
+		}
+
+		for (unsigned int i(1); i < p.size(); ++i)
+		{
+			t.setRow(i - 1, corners[i]-corners[0]);
+		}
+		
+		copy(gcMatrixInversion(t,tInv), initTInv);
+	}
+
+	VectorOfElements Barycentric::getCordinates(const VectorOfElements & p)
+	{
+		if(t.getNRows() != p.size())
+			errorMessage("Barycentric::interpolate: point dimensionality does not corresponds to the triangle dimentionality");
+		return tInv * (p - corners[0]);
+	}
+
+	VectorOfElements Barycentric::interpolate(const VectorOfElements & p, 
+	                                          const VectorOfElements & f)
+	{
+		if(p.size()+1 != f.size())
+			errorMessage("Barycentric::interpolate: number of funciton values does not corresponds to the dimentionality");
+
+		VectorOfElements fm(subVE(f, 1, p.size()) - catN(subVE(f, 0), p.size()));
+		return subVE(f,0) + fm * getCordinates(p); 
+	}
+		
+	VectorOfElements  Barycentric::in(const VectorOfElements & p)
+	{
+		auto x(getCordinates(p));
+		auto zero(generateVEConstant(0));
+		auto res(zero <= subVE(x,0));
+		for(unsigned int i(1); i < x.size(); ++i)
+			copy(res && ( zero <= subVE(x,i) ), res);
+		copy(res && ( sumOfElements(x) <= generateVEConstant(1)), res);
+		return res;
+	}
+
+	VectorOfElements Barycentric::gradient(const VectorOfElements & f)
+	{
+		if(t.getNRows()+1 != f.size())
+			errorMessage("Barycentric::gradient: number of funciton values does not corresponds to the dimentionality");
+		unsigned int nd(f.size()-1);
+		VectorOfElements fm(subVE(f, 1, nd) - catN(subVE(f, 0), nd));
+		return fm*tInv; 
+	}
+		
+} // namespace acl
diff --git a/src/acl/aclMath/aclBarycentric.h b/src/acl/aclMath/aclBarycentric.h
new file mode 100644
index 0000000..5c4ff3a
--- /dev/null
+++ b/src/acl/aclMath/aclBarycentric.h
@@ -0,0 +1,57 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLBARYCENTRIC_H
+#define ACLBARYCENTRIC_H
+
+#include "aclMatrixOfElements.h"
+
+namespace acl
+{
+	/// realizes Barycentric algorithms for triangles generated within Kernel 
+	/**
+		 \ingroup ComplexDataTypes
+
+		 The coordinates do not contain the first coordinate
+	 */
+	class Barycentric
+	{	
+		public:
+			vector<acl::VectorOfElements> corners;
+			MatrixOfElements t;
+			MatrixOfElements tInv;
+			VectorOfElements initTInv;
+			Barycentric(vector<acl::VectorOfElements> & p);
+			Barycentric();
+			void init(vector<VectorOfElements> & p);
+
+			VectorOfElements getCordinates(const VectorOfElements & p);
+			VectorOfElements interpolate(const VectorOfElements & p, 
+			                             const VectorOfElements & f);
+			VectorOfElements in(const VectorOfElements & p);
+			VectorOfElements gradient(const VectorOfElements & f);
+			
+	};
+}  //namespace acl
+
+#endif // ACLBARYCENTRIC_H
diff --git a/src/acl/aclMath/aclComplexNumOfElements.cxx b/src/acl/aclMath/aclComplexNumOfElements.cxx
new file mode 100644
index 0000000..8959677
--- /dev/null
+++ b/src/acl/aclMath/aclComplexNumOfElements.cxx
@@ -0,0 +1,100 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclComplexNumOfElements.h"
+#include "aclUtilities.h"
+#include "acl.h"
+#include "../aslUtilities.h"
+#include <algorithm>
+
+using namespace std;
+using asl::errorMessage;
+
+namespace acl
+{
+	ComplexNumOfElements::ComplexNumOfElements():
+		ve(2)
+	{
+	}
+
+	
+	void ComplexNumOfElements::setRe(Element a)
+	{
+		ve[0]=a;
+	}
+
+	void ComplexNumOfElements::setIm(Element a)
+	{
+		ve[1]=a;
+	}
+		
+	const Element ComplexNumOfElements::getRe() const
+	{
+		return ve[0];
+	}
+
+	const Element ComplexNumOfElements::getIm() const
+	{
+		return ve[1];
+	}
+	
+	VectorOfElements & ComplexNumOfElements::getInternalVector()
+	{
+		return ve;
+	}
+
+	const VectorOfElements & ComplexNumOfElements::getInternalVector() const
+	{
+		return ve;
+	}
+
+		
+	void copy(const ComplexNumOfElements & source,ComplexNumOfElements  destination)
+	{
+		copy(source.getInternalVector(),destination.getInternalVector());		
+	}
+
+	ComplexNumOfElements operator+(ComplexNumOfElements & a,ComplexNumOfElements & b)
+	{
+		ComplexNumOfElements m;
+		copy(a.getInternalVector()+b.getInternalVector(),m.getInternalVector());
+		return m;			
+	}
+
+	ComplexNumOfElements operator-(ComplexNumOfElements & a,ComplexNumOfElements & b)
+	{
+		ComplexNumOfElements m;
+		copy(a.getInternalVector()-b.getInternalVector(),m.getInternalVector());
+		return m;
+	}
+		
+	ComplexNumOfElements operator*(const ComplexNumOfElements & a, const ComplexNumOfElements & b)
+	{
+		ComplexNumOfElements m;
+		using namespace elementOperators;
+		m.setRe(a.getRe()*b.getRe()-a.getIm()*b.getIm());
+		m.setIm(a.getRe()*b.getIm()+a.getIm()*b.getRe());
+		return m;			
+	}
+
+} // namespace acl
diff --git a/src/acl/aclMath/aclComplexNumOfElements.h b/src/acl/aclMath/aclComplexNumOfElements.h
new file mode 100644
index 0000000..425fe3a
--- /dev/null
+++ b/src/acl/aclMath/aclComplexNumOfElements.h
@@ -0,0 +1,81 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLCOMPLEXNUMOFELEMENTS_H
+#define ACLCOMPLEXNUMOFELEMENTS_H
+
+#include "aclVectorOfElements.h"
+
+namespace acl
+{
+	/// The class represents a matrix elements of ::Element
+	/**
+		 \ingroup ComplexDataTypes
+	 */
+	class ComplexNumOfElements
+	{
+		private:
+			VectorOfElements ve; 
+		public:	
+			ComplexNumOfElements();
+			
+			void setRe(Element a);
+			void setIm(Element a);
+			const Element getRe() const;
+			const Element getIm() const;
+			VectorOfElements & getInternalVector();
+			const VectorOfElements & getInternalVector() const;
+	};
+
+	///function copies the ComplexNumOfElements class. 
+	/**
+		 \relates ComplexNumOfElements
+	 */
+	void copy(const ComplexNumOfElements & source, ComplexNumOfElements & destination);
+
+	///summ of two matrices
+	/**
+		 \relates ComplexNumOfElements
+	 */	
+	ComplexNumOfElements operator+(ComplexNumOfElements & a, ComplexNumOfElements & b);
+	///difference of two matrices
+	/**
+		 \relates ComplexNumOfElements
+	 */	
+	ComplexNumOfElements operator-(ComplexNumOfElements & a,ComplexNumOfElements & b);	
+
+	///product of two matrices
+	/**
+		 \relates ComplexNumOfElements
+	 */	
+	ComplexNumOfElements operator*(const ComplexNumOfElements & a, const ComplexNumOfElements & b);	
+
+
+
+	
+		
+	
+
+}  //namespace acl
+
+#endif // ACLCOMPLEXNUMOFELEMENTS_H
diff --git a/src/acl/aclMath/aclMathAlg.cxx b/src/acl/aclMath/aclMathAlg.cxx
new file mode 100644
index 0000000..69bfbd0
--- /dev/null
+++ b/src/acl/aclMath/aclMathAlg.cxx
@@ -0,0 +1,97 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclMathAlg.h"
+#include "aclVectorOfElements.h"
+#include <aclGenerators.h>
+#include "aclUtilities.h"
+#include "acl.h"
+#include "DataTypes/aclConstant.h"
+#include "../aslUtilities.h"
+#include <algorithm>
+#include "Kernels/aclKernel.h"
+
+#include <acl/DataTypes/aclArray.h>
+
+#include <acl/aclGenerators.h>
+
+using asl::errorMessage;
+
+using namespace std;
+
+namespace acl
+{
+
+	void findNearestDirectionCode(const vector<asl::AVec<>> & directions, 
+	                              VectorOfElements v, 
+	                              VectorOfElements iDir, 
+	                              ExpressionContainer & k)
+	{
+		acl::TypeID type(getElementType(v));
+		VectorOfElements prod(generateVEPrivateVariable(1, type));
+		findNearestDirectionCode(directions, v, iDir, prod, k);
+	}
+
+	void findNearestDirectionCode(const vector<asl::AVec<>> & directions, 
+	                              VectorOfElements v, 
+	                              VectorOfElements iDir, 
+	                              VectorOfElements scalProd,
+	                              ExpressionContainer & k)
+	{
+		acl::TypeID type(getElementType(v));
+		k << (iDir = generateVEConstant(0))
+		  << (scalProd = v * generateVEConstant(asl::normalize(directions[0])));
+		for (unsigned int i(1); i < directions.size(); ++i){
+			VectorOfElements vd(generateVEConstant(asl::normalize(directions[i])));
+			k << (iDir = select(iDir, generateVEConstant(i), scalProd < v * vd , type))
+			  << (scalProd = max(scalProd, v * vd, type));			
+		}
+	}
+
+	acl::VectorOfElements differentSign(acl::VectorOfElements d)
+	{
+		return (acl::fabs(acl::sumOfElements(acl::sign(d))) < (d.size()-.2));
+	}
+
+	VectorOfElements generateVEOutOfBoundarySafe(const VectorOfElements & a)
+	{
+		unsigned int length(getElementsSize(a));
+		auto ind(generateVEIndex(length));
+		return excerpt(a, (length + ind) % length );
+	}
+
+	VectorOfElements generateVEOutOfBoundarySafe(const VectorOfElements & a, 
+	                                             const VectorOfElements & outVal)	
+	{
+		acl::TypeID type(getElementType(a)); 
+		unsigned int length(getElementsSize(a));
+		auto ind(generateVEIndex(length));
+		auto indE(generateVEIndexExt(length));
+		return select(excerpt(a, (length + ind) % length), 
+		              outVal, 
+		              (indE < 0.) || (indE > (length-1)), 
+		              type);
+	}
+
+	
+} // namespace acl
diff --git a/src/acl/aclMath/aclMathAlg.h b/src/acl/aclMath/aclMathAlg.h
new file mode 100644
index 0000000..caa5d03
--- /dev/null
+++ b/src/acl/aclMath/aclMathAlg.h
@@ -0,0 +1,75 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLMATHALG_H
+#define ACLMATHALG_H
+
+#include "aclVectorOfElementsDef.h"
+#include "math/aslVectorsDynamicLength.h"
+
+using namespace std;
+
+namespace acl
+{
+	class ExpressionContainer;
+	
+	/// generates code for finding nearest direction from given directions set \p directions
+	/**
+		 \param directions vectors set defining directions
+		 \param v the vector for which directions is seeked
+		 \param iDir the number of vector is stored here
+		 \param k the kernel for the generated code
+	*/
+	void findNearestDirectionCode(const vector<asl::AVec<>> & directions, 
+	                           VectorOfElements v, 
+	                           VectorOfElements iDir, 
+	                           ExpressionContainer & k);
+
+	/// generates code for finding nearest direction from given directions set \p directions
+	/**
+		 \param directions vector set defining directions the directions are normalized internaly
+		 \param v the vector for which directions is seeked
+		 \param iDir the number of vector is stored here
+		 \param scalProd the scalar product of the vector with the corresponding normalized direction vector is stored here 
+		 \param k the kernel for the generated code
+	*/
+	void findNearestDirectionCode(const vector<asl::AVec<>> & directions, 
+	                           VectorOfElements v, 
+	                           VectorOfElements iDir,
+	                           VectorOfElements scalProduct,
+	                           ExpressionContainer & k);
+
+	/// generate expresion returning true if elements of v have different signs or one of them zerow 
+	VectorOfElements differentSign(VectorOfElements v);
+
+	/// generates Vector of elements wraping the \p a in order to avoid out of boundary acces
+	VectorOfElements generateVEOutOfBoundarySafe(const VectorOfElements & a);	
+
+	/// generates Vector of elements wraping the \p a in order to avoid out of boundary acces with given out of boundary value
+	VectorOfElements generateVEOutOfBoundarySafe(const VectorOfElements & a, 
+	                                             const VectorOfElements & outVal);	
+
+	
+}  //namespace acl
+
+#endif // ACLMATHALG_H
diff --git a/src/acl/aclMath/aclMatrixOfElements.cxx b/src/acl/aclMath/aclMatrixOfElements.cxx
new file mode 100644
index 0000000..ff2358c
--- /dev/null
+++ b/src/acl/aclMath/aclMatrixOfElements.cxx
@@ -0,0 +1,538 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclMatrixOfElements.h"
+#include "aclVectorOfElements.h"
+#include "aclGenerators.h"
+#include "acl.h"
+#include "../aslUtilities.h"
+#include <algorithm>
+
+
+using namespace std;
+using asl::errorMessage;
+
+namespace acl
+{
+	MatrixOfElements::MatrixOfElements(unsigned int nR, unsigned int nC):
+		nRow(nR),
+		nCol(nC),
+		ve(nR*nC)
+	{
+	}
+
+	unsigned int MatrixOfElements::ij2i(unsigned int i, unsigned int j) const
+	{
+		return i*nCol+j;
+	}
+	
+	void MatrixOfElements::setElement(unsigned int i, unsigned int j, Element a)
+	{
+		ve.at(ij2i(i,j))=a;
+	}
+
+	void MatrixOfElements::setRow(unsigned int r, const VectorOfElements & b)
+	{
+		if(nCol != b.size())
+			errorMessage("Error: MatrixOfElements::setRow: size of b does not match number of columns");
+		if(nRow < r)
+			errorMessage("Error: MatrixOfElements::setRow: r larger than number of rows");
+		for(unsigned int i(0); i < b.size(); ++i)
+			setElement(r,i,b[i]);
+	}
+
+	void MatrixOfElements::setColumn(unsigned int c, const VectorOfElements & b)
+	{
+		if(nRow != b.size())
+			errorMessage("Error: MatrixOfElements::setColumn: size of b does not match number of rows");
+		if(nCol < c)
+			errorMessage("Error: MatrixOfElements::setColumn: c larger than number of columns");
+		for(unsigned int i(0); i < b.size(); ++i)
+			setElement(i,c,b[i]);
+	}
+		
+	const Element MatrixOfElements::getElement(unsigned int i, unsigned int j) const
+	{
+		return ve.at(ij2i(i,j));
+	}
+
+	const VectorOfElements MatrixOfElements::getVE(unsigned int i, unsigned int j) const
+	{
+		return subVE(ve, ij2i(i,j));
+	}
+
+	const unsigned int MatrixOfElements::getNColumns() const
+	{
+		return nCol;
+	}
+
+	const unsigned int MatrixOfElements::getNRows() const
+	{
+		return nRow;
+	}
+	
+	VectorOfElements & MatrixOfElements::getInternalVector()
+	{
+		return ve;
+	}
+
+	const VectorOfElements & MatrixOfElements::getInternalVector() const
+	{
+		return ve;
+	}
+
+	MatrixOfElements MatrixOfElements::operator= (const MatrixOfElements & m)
+	{
+		MatrixOfElements res(nRow, nCol);
+		copy (ve = m.ve, res.ve);
+		return res;
+	}
+		
+		
+	void copy(const MatrixOfElements & source, MatrixOfElements & destination)
+	{
+		if((source.getNRows() != destination.getNRows()) || 
+		   (source.getNColumns() != destination.getNColumns()))
+			errorMessage("copy: matricess have different sizes");
+		copy(source.getInternalVector(),destination.getInternalVector());		
+	}
+
+	MatrixOfElements operator+(const MatrixOfElements & a, const MatrixOfElements & b)
+	{
+		if (a.getNRows() != b.getNRows() || a.getNColumns() != b.getNColumns())
+			errorMessage("operator+ - the sizes of two MatrixOfElements are incompatible");
+
+		MatrixOfElements m(a.getNRows(),a.getNColumns());
+		copy(a.getInternalVector()+b.getInternalVector(),m.getInternalVector());
+		return m;			
+	}
+
+	MatrixOfElements operator-(const MatrixOfElements & a, const MatrixOfElements & b)
+	{
+		if (a.getNRows() != b.getNRows() || a.getNColumns() != b.getNColumns())
+			errorMessage("operator- - the sizes of two MatrixOfElements are incompatible");
+
+		MatrixOfElements m(a.getNRows(),a.getNColumns());
+		copy(a.getInternalVector()-b.getInternalVector(),m.getInternalVector());
+		return m;
+	}
+		
+	MatrixOfElements operator*(const MatrixOfElements & a, const MatrixOfElements & b)
+	{
+		if (a.getNColumns() != b.getNRows() && 
+		    !(a.getNColumns()==1 && a.getNRows()==1) &&
+		    !(b.getNColumns()==1 && b.getNRows()==1))
+			errorMessage("operator* - the sizes of two MatrixOfElements are incompatible");
+
+		MatrixOfElements m;
+		if (a.getNColumns()==1 && a.getNRows()==1)
+		{
+			m.resize(b.getNRows(), b.getNColumns());
+			copy(b.getInternalVector() * a.getInternalVector(), 
+			     m.getInternalVector());
+		} 
+		else
+		{
+			if (b.getNColumns()==1 && b.getNRows()==1)
+			{
+				m.resize(a.getNRows(), a.getNColumns());
+				copy(a.getInternalVector() * b.getInternalVector(), 
+				     m.getInternalVector());
+			}
+			else
+			{
+				m.resize(a.getNRows(),b.getNColumns());
+				for (unsigned int i(0); i < a.getNRows(); ++i)
+					for (unsigned int j(0);j<b.getNColumns();++j)
+					{
+						using namespace elementOperators;
+						Element r(a.getElement(i,0)*b.getElement(0,j));
+						for (unsigned int k(1);k<b.getNRows();++k){
+							r=r+a.getElement(i,k)*b.getElement(k,j);
+						}
+						m.setElement(i,j,r);
+					}
+			}
+		}
+		return m;			
+	}
+
+	VectorOfElements operator*(const VectorOfElements & a, const MatrixOfElements & b)
+	{
+		if (a.size() != b.getNRows())
+			errorMessage("operator* - the sizes of VectorOfElements and MatrixOfElements are incompatible");
+			
+		VectorOfElements v(b.getNColumns());
+		for (unsigned int j(0);j<b.getNColumns();++j)
+		{
+			using namespace elementOperators;
+			Element r(a.at(0)*b.getElement(0,j));
+			for (unsigned int k(1);k<b.getNRows();++k)
+			{
+				r=r+a.at(k)*b.getElement(k,j);
+			}
+			v[j] = r;
+		}
+		return v;
+	}
+
+	VectorOfElements operator*(const MatrixOfElements & a, const VectorOfElements & b)
+	{
+		if (a.getNColumns() != b.size())
+			errorMessage("operator* - the sizes of MatrixOfElements and VectorOfElements are incompatible");
+
+			
+		VectorOfElements v(a.getNRows());
+		for (unsigned int i(0); i < a.getNRows(); ++i){
+			using namespace elementOperators;
+			Element r(a.getElement(i,0)*b.at(0));
+			for (unsigned int k(1);k<a.getNColumns();++k){
+				r=r+a.getElement(i,k)*b.at(k);
+			}
+			v[i] = r;
+		}
+		return v;
+	}
+
+	MatrixOfElements operator/(const MatrixOfElements & a, const VectorOfElements & b)
+	{
+		if (b.size() !=1)
+			errorMessage("operator/ - the sizes of Vector of elements is not 1");
+
+			
+		MatrixOfElements m(a.getNRows(),a.getNColumns());
+		copy(a.getInternalVector()/b,m.getInternalVector());
+		return m;
+	}
+		
+	MatrixOfElements elementProduct(const VectorOfElements & a, const VectorOfElements & b){
+		MatrixOfElements m(a.size(),b.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < a.size(); ++i)
+			for (unsigned int j(0);j<b.size();++j)
+				m.setElement(i,j,a[i]*b[j]);
+		return m;
+	}
+
+	VectorOfElements trace(const MatrixOfElements &a) 
+	{
+    	VectorOfElements c(a.getVE(0,0)); 
+		for (unsigned int i(1); i < a.getNRows(); ++i) 
+			copy(c + a.getVE(i, i), c); 
+		return c;
+	}
+
+	VectorOfElements trace(const MatrixOfElements & a, const MatrixOfElements & b) 
+	{
+    	VectorOfElements c(generateVEConstant(0.));
+		for (unsigned int i(0); i < a.getNRows(); ++i)
+			for (unsigned int j(0); j < a.getNColumns(); ++j)
+				copy(c + a.getVE(i,j) * b.getVE(j,i), c);
+		return c;
+	}
+
+		
+	MatrixOfElements generateME(const VectorOfElements & a)
+	{
+		MatrixOfElements m(1,a.size());
+		copy(a,m.getInternalVector());
+		return m;
+	}
+		
+	MatrixOfElements generateME(const VectorOfElements & a, 
+	                            const VectorOfElements & b)
+	{
+		if(a.size() != b.size())
+			errorMessage("generateME: vectors have different sizes" );
+		MatrixOfElements m(2,a.size());
+		copy(cat(a,b),m.getInternalVector());
+		return m;
+	}
+	
+	MatrixOfElements generateME(const VectorOfElements & a,
+	                            const VectorOfElements & b,
+	                            const VectorOfElements & c)
+	{
+		if((a.size() != b.size()) || (a.size() != c.size()))
+			errorMessage("generateME: vectors have different sizes" );
+		MatrixOfElements m(3,a.size());
+		copy(cat(a,b,c),m.getInternalVector());
+		return m;	
+	}
+		
+	MatrixOfElements generateME(const VectorOfElements *a, unsigned int n)
+	{
+		for(unsigned int i(1); i<n; ++i)
+			if((a[0].size() != a[i].size()))
+				errorMessage("generateME: some vectors have different sizes");
+
+		MatrixOfElements m(n, a[0].size());
+		for(unsigned int i(0); i<n; ++i)
+			for(unsigned int j(0); j<a[i].size(); ++j)
+				m.setElement(i,j,a[i][j]);
+		return m;
+	}
+
+	MatrixOfElements generateME(const vector<VectorOfElements> & a)
+	{
+		return generateME(&a[0], a.size());
+	}
+		
+	VectorOfElements getDiagonal(const MatrixOfElements & a)
+	{
+		if(a.getNColumns()!=a.getNRows())
+			errorMessage("Error: getDiagonal: the matrix is not square one");
+
+		unsigned int n(a.getNColumns());
+		VectorOfElements v(n);
+
+		for(unsigned int i(0); i<n; ++i)
+			v[i]=a.getElement(i,i);
+
+		return v;
+	}
+
+	VectorOfElements getOffDiagonalUp(const MatrixOfElements & a)
+	{
+		if(a.getNColumns()!=a.getNRows())
+			errorMessage("Error: getOffDiagonalUp: the matrix is not square one");
+
+		unsigned int n(a.getNColumns());
+		VectorOfElements v((n*n-n)/2);
+
+		unsigned int k(0);
+		for(unsigned int i(1); i<n; ++i)
+			for(unsigned int j(1); i<=i; ++j)
+			{
+				v[k]=a.getElement(i,j);
+				++k;
+			}
+		return v;
+	}
+
+	/// computes determinant expression fo cases 2x2 and 3x3 only
+	VectorOfElements det(const MatrixOfElements & m)
+	{
+		if(m.getNColumns()!=m.getNRows())
+			errorMessage("Error: det: the matrix is not square one");
+		if(m.getNColumns()>3)
+			errorMessage("Error: det: the matrix size is larger than 3");
+
+		VectorOfElements v(1);
+		
+		if(m.getNColumns()==1)
+			copy(m.getInternalVector(),v);
+		if(m.getNColumns()==2)
+			copy(m.getVE(0,0) * m.getVE(1,1) - m.getVE(0,1) * m.getVE(1,0),
+			     v);
+//			copy(mad(m.getVE(0,0), m.getVE(1,1), - m.getVE(0,1) * m.getVE(1,0)),
+//			     v);
+		if(m.getNColumns()==3)
+/*			copy(mad(m.getVE(0,0) * m.getVE(1,1),
+			         m.getVE(2,2),
+					 mad(m.getVE(1,0) * m.getVE(2,1), 
+					     m.getVE(0,2),
+						 mad(m.getVE(0,1) * m.getVE(1,2), 
+							 m.getVE(2,0),
+							 -mad(m.getVE(0,2) * m.getVE(1,1),
+							     m.getVE(2,0),
+							     mad(m.getVE(1,0) * m.getVE(0,1), 
+							         m.getVE(2,2), 
+							         m.getVE(2,1) * m.getVE(1,2) * m.getVE(0,0)))))),
+			     v);*/
+			copy(m.getVE(0,0) * m.getVE(1,1) * m.getVE(2,2) +
+			     m.getVE(1,0) * m.getVE(2,1) * m.getVE(0,2) +
+			     m.getVE(0,1) * m.getVE(1,2) * m.getVE(2,0) -
+			     m.getVE(0,2) * m.getVE(1,1) * m.getVE(2,0) -
+			     m.getVE(1,0) * m.getVE(0,1) * m.getVE(2,2) -
+			     m.getVE(2,1) * m.getVE(1,2) * m.getVE(0,0),
+			     v);
+
+		return v;
+	}
+
+	VectorOfElements solveSystem(const MatrixOfElements & a, 
+	                             const VectorOfElements & b)
+	{
+		if(a.getNColumns()!=a.getNRows())
+			errorMessage("Error: solveSystem: the matrix is not square one");
+		if(a.getNColumns()>3)
+			errorMessage("Error: solveSystem: the matrix size is larger than 3");
+		if(a.getNColumns()!=b.size())
+			errorMessage("Error: solveSystem: size of b does not match the size of matrix");
+
+		VectorOfElements v(b.size());
+
+		auto d(det(a));
+		VectorOfElements db(b.size());
+		for(unsigned int i(0); i < b.size(); ++i)
+			db[i] = (det(replaceColumn(a,b,i)))[0];
+			
+		return db/d;		
+	}
+
+	vector<Element> gcSolveSystem(const MatrixOfElements & a, 
+	                              const VectorOfElements & b,
+	                              const VectorOfElements & x)
+	{
+		if(a.getNColumns()!=a.getNRows())
+			errorMessage("Error: solveSystem: the matrix is not square one");
+		if(a.getNColumns()>3)
+			errorMessage("Error: solveSystem: the matrix size is larger than 3");
+		if(a.getNColumns()!=b.size())
+			errorMessage("Error: solveSystem: size of b does not match the size of matrix");
+
+		vector<Element> res(0);
+		res.push_back((subVE(x,0) =  1./det(a))[0]);
+
+		VectorOfElements db(b.size());
+		for(unsigned int i(1); i < b.size(); ++i)
+			res.push_back((subVE(x,i) = subVE(x,0) * det(replaceColumn(a,b,i)))[0]);
+		res.push_back((subVE(x,0) *= det(replaceColumn(a,b,0)))[0]);
+		return res;		
+	}
+
+	vector<Element> gcSolveSystemCG(const MatrixOfElements & a, 
+	                                const VectorOfElements & b,
+	                                const VectorOfElements & x)
+	{
+		if(a.getNColumns()!=a.getNRows())
+			errorMessage("Error: solveSystem: the matrix is not square one");
+		if(a.getNColumns()!=b.size())
+			errorMessage("Error: solveSystem: size of b does not match the size of matrix");
+		if(a.getNColumns()!=x.size())
+			errorMessage("Error: solveSystem: size of x does not match the size of matrix");
+
+		TypeID type(getElementType(x));
+		auto p(generateVEPrivateVariable(b.size(),type));
+		auto r(generateVEPrivateVariable(b.size(),type));
+		auto a_p(generateVEPrivateVariable(b.size(),type));
+		auto alpha(generateVEPrivateVariable(1,type));
+		auto rr(generateVEPrivateVariable(1,type));
+	
+		vector<Element> res(0);
+		res << (x=b);
+		res << (r=b-a*x);
+		res << (p=r);
+		res << (rr = r*r);
+		for(unsigned int i(0); i<b.size()-1; ++i)
+		{
+			res << (a_p = a * p);
+			res << (alpha=rr/(p*a_p));
+			res << (x+=alpha*p);
+			res << (r-=alpha*a_p);
+			// this line corresponds to beta
+			res << (alpha=1./rr);
+			res << (rr=r*r);
+			res << (p = r+ rr*alpha * p);
+		}
+		res << (a_p = a * p);
+		res << (alpha=rr/(p*a_p));
+		res << (x+=alpha*p);
+		
+		return res;		
+	}
+
+		
+	MatrixOfElements replaceRow(const MatrixOfElements & a,
+	                            const VectorOfElements & b, 
+	                            unsigned int r)
+	{
+		MatrixOfElements m(a.getNRows(),a.getNColumns());
+		copy(a,m);
+		m.setRow(r,b);
+		return m;
+	}
+
+	MatrixOfElements replaceColumn(const MatrixOfElements & a, 
+	                               const VectorOfElements & b, 
+	                               unsigned int c)
+	{
+		MatrixOfElements m(a.getNRows(),a.getNColumns());
+		copy(a,m);
+		m.setColumn(c,b);
+		return m;
+	}
+
+		
+	VectorOfElements matrixCofactor(const MatrixOfElements & a, 
+	                                unsigned int r, 
+	                                unsigned int c)
+	{
+		MatrixOfElements m(a.getNRows()-1, a.getNColumns()-1);
+		for(unsigned int i(0), im(0); im < m.getNRows(); ++i, ++im)
+		{
+			i += (i == r) ? 1 : 0;
+			for(unsigned int j(0), jm(0); jm < m.getNColumns(); ++j, ++jm)
+			{
+				j += (j == c) ? 1 : 0;
+				m.setElement(im, jm, a.getElement(i,j));
+			}
+		}
+		return det(m);			
+	}
+		
+	MatrixOfElements generateMatrixCofactors(const MatrixOfElements & a)
+	{
+		if(a.getNRows() != a.getNColumns())
+			errorMessage("Error: generateMatrixCofactors: the matrix is not rectangular one");
+		if(a.getNRows() > 3)
+			errorMessage("Error: generateMatrixCofactors: the matrix size is more than 3");
+		MatrixOfElements m(a.getNRows(), a.getNColumns());
+		int rfactor(-1);
+		for(unsigned int i(0); i < a.getNRows(); ++i){
+			rfactor*=-1;
+			int factor(-rfactor);
+			for(unsigned int j(0); j < a.getNColumns(); ++j)
+			{	
+				factor*=-1;
+				m.setElement(i,j, (factor * matrixCofactor(a,i,j))[0] );
+			}
+		}
+		return m;
+	}
+
+	/// returns vector of elements for computing the inverse matrix for cases 2x2 and 3x3 \relates MatrixOfElements 
+	vector<Element> gcMatrixInversion(const MatrixOfElements & a, MatrixOfElements & inv)
+	{
+		if((a.getNRows() != inv.getNRows()) || 
+		   (a.getNColumns() != inv.getNColumns()))
+			errorMessage("Error: generateMatrixInversionCode: two matrices have different sizes");
+		auto mc(generateMatrixCofactors(a));
+		auto d(det(a));
+
+		unsigned int nr(a.getNRows());
+		unsigned int nc(a.getNColumns());
+
+		auto lastEl(inv.getVE(nr-1, nc-1));
+		
+		auto op1(lastEl = 1./det(a));
+		auto op2(subVE(inv.getInternalVector(), 0, nr*nc-2) = 
+		         subVE(mc.getInternalVector(), 0, nr*nc-2) * lastEl);
+		auto op3(lastEl*=mc.getVE(nr-1, nc-1));
+
+		return cat(op1,op2,op3);
+	}
+		
+		
+} // namespace acl
diff --git a/src/acl/aclMath/aclMatrixOfElements.h b/src/acl/aclMath/aclMatrixOfElements.h
new file mode 100644
index 0000000..3011c7f
--- /dev/null
+++ b/src/acl/aclMath/aclMatrixOfElements.h
@@ -0,0 +1,223 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLMATRIXOFELEMENTS_H
+#define ACLMATRIXOFELEMENTS_H
+
+#include "aclVectorOfElementsDef.h"
+
+namespace acl
+{
+	/// The class represents a matrix elements of ::Element
+	/**
+		 \ingroup ComplexDataTypes
+	 */
+	class MatrixOfElements
+	{
+		private:
+			/// number of columns 
+			unsigned int nRow;
+			/// number of rows
+			unsigned int nCol;
+
+			VectorOfElements ve; 
+			/// defines convertion rule of matrix indeces \p i and \p j into vector one
+			unsigned int ij2i(unsigned int i, unsigned int j) const;
+		public:	
+			explicit MatrixOfElements(unsigned int nR = 0, unsigned int nC = 0);
+			
+			void setElement(unsigned int r, unsigned int c, Element a);
+			void setRow(unsigned int r,const VectorOfElements & a);
+			void setColumn(unsigned int c, const VectorOfElements & a);			
+			const Element getElement(unsigned int r, unsigned int c) const;
+			const VectorOfElements getVE(unsigned int r, unsigned int c) const;
+			const unsigned int getNColumns() const;
+			const unsigned int getNRows() const;
+			VectorOfElements & getInternalVector();
+			const VectorOfElements & getInternalVector() const;
+			inline void resize(unsigned int nr, unsigned int nc);
+			MatrixOfElements operator= (const MatrixOfElements & m);
+	};
+
+	///function copies the MatrixOfElements class. 
+	/**
+		 \relates MatrixOfElements
+	 */
+	void copy(const MatrixOfElements & source, MatrixOfElements & destination);
+
+	///summ of two matrices
+	/**
+		 \relates MatrixOfElements
+	 */	
+	MatrixOfElements operator+(const MatrixOfElements & a, const MatrixOfElements & b);
+	///difference of two matrices
+	/**
+		 \relates MatrixOfElements
+	 */	
+	MatrixOfElements operator-(const MatrixOfElements & a, const MatrixOfElements & b);	
+
+	///product of two matrices
+	/**
+		 \relates MatrixOfElements
+	 */	
+	MatrixOfElements operator*(const MatrixOfElements & a, const MatrixOfElements & b);	
+
+	///product of vector and matrix
+	/**
+		 \relates MatrixOfElements
+	 */		
+	VectorOfElements operator*(const VectorOfElements & a, const MatrixOfElements & b);
+
+	///product of vector and matrix
+	/**
+		 \relates MatrixOfElements
+	 */		
+	VectorOfElements operator*(const MatrixOfElements & a, const VectorOfElements & b);
+
+	///division of a matrix on a VectorOfElements with 1 element
+	/**
+		 \relates MatrixOfElements
+	 */		
+	MatrixOfElements operator/(const MatrixOfElements & a, const VectorOfElements & b);
+
+	
+	///transposed matrix
+	/**
+		 \relates MatrixOfElements
+	 */			
+	MatrixOfElements transpose(MatrixOfElements & source);
+
+	///element product of two vectors
+	/**
+		 \relates MatrixOfElements
+		 \f$ elementProduct\left(
+		                         \left[\begin{array}{c}
+		                               a_1\\ \vdots \\ a_n
+		                               \end{array}\right],
+		                         \left[\begin{array}{c}
+		                               b_1\\ \vdots \\ b_n
+		                               \end{array}\right]\right) =
+		                         \left[\begin{array}{ccc}
+		                               a_1b_1 & \cdots & a_1b_n\\
+		                               \vdots & \ddots & \vdots\\
+		                               a_nb_1 & \cdots & a_nb_n\\
+		                               \end{array}\right]
+		                         
+		 \f$, \f$A_{ij} = a_i b_j \f$ 
+	 */			
+	MatrixOfElements elementProduct(const VectorOfElements & a, const VectorOfElements & b);
+
+	///Trace of a matrix \f$Tr(A)\equiv A_{ii}\f$ \relates MatrixOfElements		
+	VectorOfElements trace(const MatrixOfElements & a); 
+
+	///Trace of a matrix product \f$Tr(A B)\equiv A_{ij}B_{ji}\f$ \relates MatrixOfElements	
+	VectorOfElements trace(const MatrixOfElements & a, const MatrixOfElements & b); 
+	
+	///	 generates a matrix with a row \relates MatrixOfElements
+	MatrixOfElements generateME(const VectorOfElements & a);
+	
+	///	 generates a matrix with two rows 	 \relates MatrixOfElements
+	MatrixOfElements generateME(const VectorOfElements & a,VectorOfElements & b);
+	
+	///	 generates a matrix with three rows  \relates MatrixOfElements
+	MatrixOfElements generateME(const VectorOfElements & a,
+	                            const VectorOfElements & b,
+	                            const VectorOfElements & c);
+
+	///	 generates a matrix with \p n rows \f$ generateME(\{u_i\}_j) = A_{ji}\f$ \relates MatrixOfElements
+	MatrixOfElements generateME(const VectorOfElements *a, unsigned int n);
+
+	///	 generates a matrix with \p n rows \f$ generateME(\{u_i\}_j) = A_{ji}\f$ \relates MatrixOfElements
+	MatrixOfElements generateME(const vector<VectorOfElements> &a);
+	
+	/// returns VectorOfElements containing the diagonal elements
+	/**
+		\relates MatrixOfElements 
+		the finction is valid only for square matrices
+	*/
+	VectorOfElements getDiagonal(const MatrixOfElements & a);
+	
+	/// returns VectorOfElements containing the uper off diagonal elements
+	/**
+		 \relates MatrixOfElements
+		the finction is valid only for square matrices
+	*/
+	VectorOfElements getOffDiagonalUp(const MatrixOfElements & a);
+
+	/// computes determinant expression fo cases 2x2 and 3x3 only
+	/**
+		 \relates MatrixOfElements		 
+	*/
+	VectorOfElements det(const MatrixOfElements & m);
+
+	/// returns solution of a system of linear equations
+	/**
+		\ingroup ComplexDataTypes		 
+	*/
+	VectorOfElements solveSystem(const MatrixOfElements & a, const VectorOfElements & b);
+
+	/// generates code for solving the solution of a system of linear equations
+	/**
+		\ingroup ComplexDataTypes
+		Solves system of  2 or 3 equations with the Cramer's rule  
+	*/
+	vector<Element> gcSolveSystem(const MatrixOfElements & a, 
+	                              const VectorOfElements & b, 
+	                              const VectorOfElements & x);
+
+	/// generates code for solving the solution of a system of linear equations
+	/**
+		\ingroup ComplexDataTypes		 
+		 Solves system of  an arbiterary number of equations with the conjugate gradient method. 
+		 The function constructs the algorithm with number of iterations of vector size. The initial
+		 value of \f$ x_0 \f$ is \f$b\f$.
+	*/
+	vector<Element> gcSolveSystemCG(const MatrixOfElements & a, 
+	                                const VectorOfElements & b, 
+	                                const VectorOfElements & x);
+	
+	/// generate matrix with content of the matrix \p a but with replaced row \p r by vector \p b \relates MatrixOfElements		 
+	MatrixOfElements replaceRow(const MatrixOfElements & a, const VectorOfElements & b, unsigned int r);
+
+	/// generate matrix with content of the matrix \p a but with replaced column \p c by vector \p b \relates MatrixOfElements		 
+	MatrixOfElements replaceColumn(const MatrixOfElements & a, const VectorOfElements & b, unsigned int c);
+
+	/// returns the matrix of cofactors for cases 2x2 and 3x3 \relates MatrixOfElements 
+	MatrixOfElements  generateMatrixCofactors(const MatrixOfElements & a);
+
+	/// returns vector of elements for computing the inverse matrix for cases 2x2 and 3x3 \relates MatrixOfElements 
+	vector<Element> gcMatrixInversion(const MatrixOfElements & a, MatrixOfElements & inv);
+
+// ------------------------------ Implementation -----------------
+
+	inline void MatrixOfElements::resize(unsigned int nr, unsigned int nc)
+	{
+		nRow=nr; 
+		nCol=nc;
+		ve.resize(nr*nc);
+	}
+	
+	
+}  //namespace acl
+
+#endif // ACLMATRIXOFELEMENTS_H
diff --git a/src/acl/aclMath/aclQuaternionOfElements.cxx b/src/acl/aclMath/aclQuaternionOfElements.cxx
new file mode 100644
index 0000000..6de1be7
--- /dev/null
+++ b/src/acl/aclMath/aclQuaternionOfElements.cxx
@@ -0,0 +1,129 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclQuaternionOfElements.h"
+#include "aclVectorOfElementsOperations.h"
+#include "aclGenerators.h"
+#include "aclElementBase.h"
+
+using namespace std;
+using asl::errorMessage;
+
+namespace acl
+{
+	QuaternionOfElements::QuaternionOfElements():
+		w(1),
+		u(3)
+	{
+	}
+
+	
+	void QuaternionOfElements::setWElement(Element a)
+	{
+		w[0]=a;
+	}
+
+	void QuaternionOfElements::setUElement(unsigned int i, Element a)
+	{
+		u.at(i)=a;
+	}
+		
+	const Element QuaternionOfElements::getWElement() const
+	{
+		return w[0];
+	}
+
+	const Element QuaternionOfElements::getUElement(unsigned int i) const
+	{
+		return u.at(i);
+	}
+	
+	VectorOfElements & QuaternionOfElements::getW()
+	{
+		return w;
+	}
+
+	VectorOfElements & QuaternionOfElements::getU()
+	{
+		return u;
+	}
+
+	const VectorOfElements & QuaternionOfElements::getW() const
+	{
+		return w;
+	}
+
+	const VectorOfElements & QuaternionOfElements::getU() const
+	{
+		return u;
+	}
+		
+		
+	void copy(const QuaternionOfElements & source,QuaternionOfElements  destination)
+	{
+		copy(source.getW(),destination.getW());		
+		copy(source.getU(),destination.getU());		
+	}
+
+	QuaternionOfElements operator+(QuaternionOfElements & a,QuaternionOfElements & b)
+	{
+		QuaternionOfElements m;
+		copy(a.getW()+b.getW(),m.getW());
+		copy(a.getU()+b.getU(),m.getU());
+		return m;			
+	}
+
+	QuaternionOfElements operator-(QuaternionOfElements & a,QuaternionOfElements & b)
+	{
+		QuaternionOfElements m;
+		copy(a.getW()-b.getW(),m.getW());
+		copy(a.getU()-b.getU(),m.getU());
+		return m;
+	}
+		
+	QuaternionOfElements operator*(const QuaternionOfElements & a, const QuaternionOfElements & b)
+	{
+		QuaternionOfElements m;
+		copy(a.getW()*b.getW()-a.getU()*b.getU(),m.getW());
+		copy(a.getW() * b.getU() + b.getW()*a.getU() +
+		     crossProduct(a.getU(), b.getU()), m.getU());
+		return m;			
+	}
+
+	VectorOfElements l2(QuaternionOfElements & a)
+	{
+		return l2(a.getW())+l2(a.getU());
+	}
+		
+	QuaternionOfElements normalize(QuaternionOfElements & a)
+	{
+		VectorOfElements il(generateVEPrivateVariable(1u,a.getW()[0]->getTypeID()));
+		VectorOfElements ileq(1);
+		copy(il=1./sqrt(l2(a)),ileq);
+		QuaternionOfElements m;
+		copy(a.getW()*ileq,m.getW());
+		copy(a.getU()*il,m.getU());
+		return m;
+	}	
+
+} // namespace acl
diff --git a/src/acl/aclMath/aclQuaternionOfElements.h b/src/acl/aclMath/aclQuaternionOfElements.h
new file mode 100644
index 0000000..e2b4ab4
--- /dev/null
+++ b/src/acl/aclMath/aclQuaternionOfElements.h
@@ -0,0 +1,91 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLQUATERNIONOFELEMENTS_H
+#define ACLQUATERNIONOFELEMENTS_H
+
+#include "aclVectorOfElements.h"
+
+namespace acl
+{
+	/// The class represents a matrix elements of ::Element
+	/**
+		 \ingroup ComplexDataTypes
+	 */
+	class QuaternionOfElements
+	{
+		private:
+			VectorOfElements w; 
+			VectorOfElements u; 
+		public:	
+			QuaternionOfElements();
+			
+			void setWElement(Element a);
+			void setUElement(unsigned int i, Element a);
+			const Element getWElement() const;
+			const Element getUElement(unsigned int i) const;
+			VectorOfElements & getU();
+			const VectorOfElements & getU() const;
+			VectorOfElements & getW();
+			const VectorOfElements & getW() const;
+	};
+
+	///function copies the QuaternionOfElements class. 
+	/**
+		 \relates QuaternionOfElements
+	 */
+	void copy(const QuaternionOfElements & source, QuaternionOfElements & destination);
+
+	///summ of two matrices
+	/**
+		 \relates QuaternionOfElements
+	 */	
+	QuaternionOfElements operator+(QuaternionOfElements & a, QuaternionOfElements & b);
+	///difference of two matrices
+	/**
+		 \relates QuaternionOfElements
+	 */	
+	QuaternionOfElements operator-(QuaternionOfElements & a,QuaternionOfElements & b);	
+
+	///product of two matrices
+	/**
+		 \relates QuaternionOfElements
+	 */	
+	QuaternionOfElements operator*(const QuaternionOfElements & a, const QuaternionOfElements & b);	
+
+	///L2 norm of a quaternion 
+	/**
+		 \relates QuaternionOfElements
+	 */	
+
+	VectorOfElements l2(QuaternionOfElements & a);
+
+	QuaternionOfElements normalize(QuaternionOfElements & a);
+
+	
+		
+	
+
+}  //namespace acl
+
+#endif // ACLQUATERNIONOFELEMENTS_H
diff --git a/src/acl/aclMath/aclReductionAlgGenerator.cxx b/src/acl/aclMath/aclReductionAlgGenerator.cxx
new file mode 100644
index 0000000..ff737aa
--- /dev/null
+++ b/src/acl/aclMath/aclReductionAlgGenerator.cxx
@@ -0,0 +1,372 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclReductionAlgGenerator.h"
+#include "aclVectorOfElementsOperations.h"
+#include <acl/acl.h>
+#include <acl/DataTypes/aclArray.h>
+#include <acl/aclGenerators.h>
+#include <acl/Kernels/aclKernel.h>
+
+namespace acl
+{
+	
+	inline const unsigned int nLocalGPU(unsigned int length, unsigned int nGroups)
+	{
+		return std::max(1u,std::min(8u, length/nGroups));
+	}
+	inline const unsigned int nLocalCPU(unsigned int length, unsigned int nGroups)
+	{
+		return 1;
+	}
+
+	unsigned int getLPerUnit(unsigned int length, unsigned int nUnits)
+	{
+		return ceil((double)length/nUnits);
+	}
+
+	unsigned int getNSaturatedUnits(unsigned int length, unsigned int nUnits)
+	{
+		return length/getLPerUnit(length,nUnits);
+	}
+		
+	unsigned int getLLastUnit(unsigned int length, unsigned int nUnits)
+	{
+		return length % getLPerUnit(length,nUnits);
+	}
+	
+	template <typename ResType, enum ReductionOperatorType Op> class GroupReduction
+	{
+	};
+
+	template <typename ResType> class GroupReduction<ResType, ROT_SUM>
+	{
+		public:
+			static void compute(std::vector<std::vector<ResType>> v, unsigned int l, asl::AVec<ResType> & res)
+		    {
+				for(unsigned int i(0); i<v.size(); ++i)
+				{
+					vector<ResType> & vv(v[i]);
+					ResType r(vv[0]);
+					for(unsigned int j(1); j<l; ++j)
+						r+=vv[j];
+					res[i]=r;
+				}				
+			}
+			static inline VectorOfElements op(VectorOfElements res, VectorOfElements v, acl::TypeID t)
+			{
+				return res+=v;
+			}
+	};
+//	template void GroupReduction<double, ROT_SUM>::compute(std::vector<std::vector<double>> v, 
+//	                                                      asl::AVec<double> & res); 
+//	template void GroupReduction<float, ROT_SUM>::compute(std::vector<std::vector<float>> v, 
+//	                                                     asl::AVec<float> & res); 
+	
+	template <typename ResType> class GroupReduction<ResType, ROT_PRODUCT>
+	{
+		public:
+			static void compute(std::vector<std::vector<ResType>> v, unsigned int l, asl::AVec<ResType> & res)
+		    {
+				for(unsigned int i(0); i<v.size(); ++i)
+				{
+					vector<ResType> & vv(v[i]);
+					ResType r(vv[0]);
+					for(unsigned int j(1); j<l; ++j)
+						r*=vv[j];
+					res[i]=r;
+				}				
+			}
+			static inline VectorOfElements op(VectorOfElements res, VectorOfElements v, acl::TypeID t)
+			{
+				return res*=v;
+			}
+	};
+//	template void GroupReduction<double, ROT_PRODUCT>::compute(std::vector<std::vector<double>> v, 
+//	                                                          asl::AVec<double> & res); 
+//	template void GroupReduction<float, ROT_PRODUCT>::compute(std::vector<std::vector<float>> v, 
+//	                                                         asl::AVec<float> & res); 
+	
+	template <typename ResType> class GroupReduction<ResType, ROT_MINIMUM>
+	{
+		public:
+			static void compute(std::vector<std::vector<ResType>> v, unsigned int l, asl::AVec<ResType> & res)
+		    {
+				for(unsigned int i(0); i<v.size(); ++i)
+				{
+					vector<ResType> & vv(v[i]);
+					ResType r(vv[0]);
+					for(unsigned int j(1); j<l; ++j)
+						r=std::min(r,vv[j]);
+					res[i]=r;
+				}				
+			}
+			static inline VectorOfElements op(VectorOfElements res, VectorOfElements v, acl::TypeID t)
+			{
+				return res=min(res,v,t);
+			}
+	};
+//	template void GroupReduction<double, ROT_MINIMUM>::compute(std::vector<std::vector<double>> v, 
+//	                                                          asl::AVec<double> & res); 
+//	template void GroupReduction<float, ROT_MINIMUM>::compute(std::vector<std::vector<float>> v, 
+//	                                                         asl::AVec<float> & res); 
+
+	template <typename ResType> class GroupReduction<ResType, ROT_MAXIMUM>
+	{
+		public:
+			static void compute(std::vector<std::vector<ResType>> v, unsigned int l, asl::AVec<ResType> & res)
+		    {
+				for(unsigned int i(0); i<v.size(); ++i)
+				{
+					vector<ResType> & vv(v[i]);
+					ResType r(vv[0]);
+					for(unsigned int j(1); j<l; ++j)
+						r=std::max(r,vv[j]);
+					res[i]=r;
+				}				
+			}
+			static inline VectorOfElements op(VectorOfElements res, VectorOfElements v, acl::TypeID t)
+			{
+				return res=max(res,v,t);
+			}			
+	};
+//	template void GroupReduction<double, ROT_MAXIMUM>::compute(std::vector<std::vector<double>> v, 
+//	                                                          asl::AVec<double> & res); 
+//	template void GroupReduction<float, ROT_MAXIMUM>::compute(std::vector<std::vector<float>> v, 
+//	                                                         asl::AVec<float> & res); 
+
+	template <typename ResType, enum ReductionOperatorType Op> 
+		void ReductionAlgGenerator<ResType, Op>::compute()
+	{
+		if(kernel) 
+			kernel->compute();
+		unsigned int nC(ve.size());
+		unsigned int veLength(ve[0]->getSize());
+		unsigned int nSaturatedUnits(getNSaturatedUnits(veLength, nGroups*nLocal));
+		unsigned int l(std::min(nSaturatedUnits+1,nGroups*nLocal));
+		for (unsigned int i(0); i < nC; ++i)
+			acl::copy(groupResACL[i], groupRes[i]);
+		GroupReduction<ResType, Op>::compute(groupRes, l, res.v());
+	};	
+	template void ReductionAlgGenerator<double, ROT_SUM>::compute();
+	template void ReductionAlgGenerator<float, ROT_SUM>::compute();
+	template void ReductionAlgGenerator<double, ROT_PRODUCT>::compute();
+	template void ReductionAlgGenerator<float, ROT_PRODUCT>::compute();
+	template void ReductionAlgGenerator<double, ROT_MINIMUM>::compute();
+	template void ReductionAlgGenerator<float, ROT_MINIMUM>::compute();
+	template void ReductionAlgGenerator<double, ROT_MAXIMUM>::compute();
+	template void ReductionAlgGenerator<float, ROT_MAXIMUM>::compute();
+	
+	template <typename ResType, enum ReductionOperatorType Op> 
+		void generateKernelCPU(VectorOfElements ve, VectorOfElements groupResACL, Kernel & k)
+	{		
+		auto nGroups(k.getGroupsNumber());
+		int veLength(ve[0]->getSize());
+		unsigned int nLocal(nLocalCPU(veLength,nGroups));	
+		unsigned int gSize(std::max(k.getSize(),nLocal));
+		auto type(getElementType(ve));
+		auto typeI(TYPE_SELECT[type]);
+		auto lVal(acl::generateVEPrivateVariable(ve.size(),type));
+		auto counter(acl::generateVEPrivateVariable(1,typeI));
+		auto counterEnd(acl::generateVEPrivateVariable(1,typeI));
+		int lPerGroup(getLPerUnit(veLength,nGroups));
+		int lLastGroup(getLLastUnit(veLength, nGroups));
+		int nSaturatedGroups(getNSaturatedUnits(veLength, nGroups));
+
+		k<<(counterEnd = select(generateVEConstant(lPerGroup), 
+		                        generateVEConstant(lLastGroup), 
+		                        generateVEGroupID()==nSaturatedGroups, 
+		                        type));
+		k<<(lVal = select(excerpt(ve,lPerGroup*generateVEGroupID()), counterEnd>0,type));
+		// this line ensuers that the conputations will take place on the 1st item only
+		k<<(counterEnd = select(counterEnd, generateVEIndex(gSize)==0, type));
+		vector<Element> body;
+		body<<(GroupReduction<ResType, Op>::
+			               op(lVal,excerpt(ve, 
+			                               int(lPerGroup)*generateVEGroupID() + 
+			                               counter),type));
+
+		auto loop(elementOperators::forLoop((counter = generateVEConstant(1))[0],
+		                                    (counter < counterEnd)[0],
+		                                    (counter += generateVEConstant(1))[0],
+		                                    body));
+		k.addExpression(loop);
+		k<<(excerpt(groupResACL,generateVEGroupID()) = lVal);
+	}
+
+	template <typename ResType, enum ReductionOperatorType Op> 
+		void generateKernelGPU(VectorOfElements ve, VectorOfElements groupResACL, Kernel & k)
+	{		
+		auto nGroups(k.getGroupsNumber());
+		int veLength(ve[0]->getSize());
+		unsigned int nLocal(nLocalGPU(veLength,nGroups));
+		unsigned int gSize(std::max(k.getSize(),nLocal));
+		auto type(getElementType(ve));
+		auto typeI(TYPE_SELECT[type]);
+		auto lVal(acl::generateVEPrivateVariable(ve.size(),type));
+		auto counter(acl::generateVEPrivateVariable(1,typeI));
+		auto counterEnd(acl::generateVEPrivateVariable(1,typeI));
+		auto nUnits(nGroups*nLocal);
+		int lPerUnit(getLPerUnit(veLength,nUnits));
+		int lLastUnit(getLLastUnit(veLength, nUnits));
+		unsigned int nSaturatedUnits(getNSaturatedUnits(veLength, nUnits));
+		auto unitID(generateVEGroupID()*nLocal +generateVEIndex());
+
+		if(nSaturatedUnits<nUnits)
+			k<<(counterEnd = select(generateVEConstant(lPerUnit), 
+			                        generateVEConstant(lLastUnit), 
+			                        unitID==nSaturatedUnits, 
+			                        typeI));
+		if((nSaturatedUnits+1)<nUnits)
+			k<<(counterEnd = select(counterEnd, 
+			                        unitID<=nSaturatedUnits, 
+			                        typeI));
+			
+		// this line ensuers that the conputations will take place on first item only
+		k<<(counterEnd = select(counterEnd, generateVEIndex(gSize)<nLocal, type));
+		k<<(lVal = select(excerpt(ve,lPerUnit*unitID), counterEnd>0,type));
+		vector<Element> body;
+		body<<(GroupReduction<ResType, Op>::
+			               op(lVal,excerpt(ve, lPerUnit*unitID + counter),type));
+
+		auto loop(elementOperators::forLoop((counter = generateVEConstant(1))[0],
+		                                    (counter < counterEnd)[0],
+		                                    (counter += generateVEConstant(1))[0],
+		                                    body));
+		k.addExpression(loop);
+		k<<(excerpt(groupResACL,unitID) = lVal);
+	}
+	
+	template <typename ResType, enum ReductionOperatorType Op> 
+		void ReductionAlgGenerator<ResType, Op>::generateAlg(Kernel & k)
+	{
+		if(!k.getConfiguration().local)
+			asl::errorMessage("ReductionAlgGenerator::generateAlg: The kernel should be local");
+
+		nGroups= k.getGroupsNumber();
+		unsigned int veLength(ve[0]->getSize());
+		nLocal=(getDeviceType(ve[0]->getQueue())== CL_DEVICE_TYPE_CPU ? 
+		        nLocalCPU(veLength,nGroups) : nLocalGPU(veLength,nGroups));
+		for(unsigned int i(0); i<ve.size(); ++i)
+			groupRes[i]=std::vector<ResType>(nGroups*nLocal);
+		copy(generateVEData<ResType>(nGroups*nLocal,ve.size()),groupResACL);
+
+		
+		switch (getDeviceType(ve[0]->getQueue()))
+		{
+			case CL_DEVICE_TYPE_CPU:  
+				generateKernelCPU<ResType, Op>(ve,groupResACL,k);
+				k.setup();
+			break;
+			case CL_DEVICE_TYPE_GPU:  
+				generateKernelGPU<ResType, Op>(ve,groupResACL,k);
+				k.setup();
+			break;
+			default: errorMessage("ReductionAlgGenerator: device type " + 
+			                      numToStr(getDeviceType(k.getQueue())) + " is unknown!");
+		}
+	}
+
+	template void ReductionAlgGenerator<double, ROT_SUM>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<float, ROT_SUM>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<double, ROT_PRODUCT>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<float, ROT_PRODUCT>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<double, ROT_MINIMUM>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<float, ROT_MINIMUM>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<double, ROT_MAXIMUM>::generateAlg(Kernel & k);
+	template void ReductionAlgGenerator<float, ROT_MAXIMUM>::generateAlg(Kernel & k);
+
+	template <typename ResType, enum ReductionOperatorType Op> 
+		void ReductionAlgGenerator<ResType, Op>::generateAlg()
+	{
+		KernelConfiguration kConf(KERNEL_BASIC);
+		kConf.local = true;
+		
+		kernel=std::make_shared<Kernel>(kConf);
+		unsigned int groupsNumber = getNComputeUnits(ve[0]->getQueue());
+		kernel->setGroupsNumber(groupsNumber);
+		
+		generateAlg(*kernel);
+	};	
+	template void ReductionAlgGenerator<double, ROT_SUM>::generateAlg();
+	template void ReductionAlgGenerator<float, ROT_SUM>::generateAlg();
+	template void ReductionAlgGenerator<double, ROT_PRODUCT>::generateAlg();
+	template void ReductionAlgGenerator<float, ROT_PRODUCT>::generateAlg();
+	template void ReductionAlgGenerator<double, ROT_MINIMUM>::generateAlg();
+	template void ReductionAlgGenerator<float, ROT_MINIMUM>::generateAlg();
+	template void ReductionAlgGenerator<double, ROT_MAXIMUM>::generateAlg();
+	template void ReductionAlgGenerator<float, ROT_MAXIMUM>::generateAlg();
+
+	template <typename ResType, enum ReductionOperatorType Op> 
+		ReductionAlgGenerator<ResType, Op>::ReductionAlgGenerator(VectorOfElements v):
+			ve(v),		 
+			res(asl::AVec<ResType>(ve.size())),
+			groupRes(ve.size())
+	{
+	}
+	
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_SUM>> 
+		generateSumAlg(VectorOfElements v)
+	{
+		return make_shared<ReductionAlgGenerator<ResType, ROT_SUM>>(v);
+	}
+
+	template std::shared_ptr<ReductionAlgGenerator<double, ROT_SUM>> 
+		generateSumAlg<double>(VectorOfElements v);
+	template std::shared_ptr<ReductionAlgGenerator<float, ROT_SUM>> 
+		generateSumAlg<float>(VectorOfElements v);
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MINIMUM>> 
+		generateMinAlg(VectorOfElements v)
+	{
+		return make_shared<ReductionAlgGenerator<ResType, ROT_MINIMUM>>(v);
+	}
+
+	template std::shared_ptr<ReductionAlgGenerator<double, ROT_MINIMUM>> 
+		generateMinAlg<double>(VectorOfElements v);
+	template std::shared_ptr<ReductionAlgGenerator<float, ROT_MINIMUM>> 
+		generateMinAlg<float>(VectorOfElements v);
+		
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MAXIMUM>> 
+		generateMaxAlg(VectorOfElements v)
+	{
+		return make_shared<ReductionAlgGenerator<ResType, ROT_MAXIMUM>>(v);
+	}
+
+	template std::shared_ptr<ReductionAlgGenerator<double, ROT_MAXIMUM>> 
+		generateMaxAlg<double>(VectorOfElements v);
+	template std::shared_ptr<ReductionAlgGenerator<float, ROT_MAXIMUM>> 
+		generateMaxAlg<float>(VectorOfElements v);
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_PRODUCT>> 
+		generateProductAlg(VectorOfElements v)
+	{
+		return make_shared<ReductionAlgGenerator<ResType, ROT_PRODUCT>>(v);
+	}
+
+	template std::shared_ptr<ReductionAlgGenerator<double, ROT_PRODUCT>> 
+		generateProductAlg<double>(VectorOfElements v);
+	template std::shared_ptr<ReductionAlgGenerator<float, ROT_PRODUCT>> 
+		generateProductAlg<float>(VectorOfElements v);
+		
+} // namespace acl
diff --git a/src/acl/aclMath/aclReductionAlgGenerator.h b/src/acl/aclMath/aclReductionAlgGenerator.h
new file mode 100644
index 0000000..634a115
--- /dev/null
+++ b/src/acl/aclMath/aclReductionAlgGenerator.h
@@ -0,0 +1,77 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLREDUCTIONALGGENERATUR_H
+#define ACLREDUCTIONALGGENERATUR_H
+
+#include "aclVectorOfElementsDef.h"
+#include <math/aslVectors.h>
+#include <utilities/aslUValue.h>
+
+
+namespace acl
+{
+	class Kernel;
+	enum ReductionOperatorType {ROT_SUM, ROT_PRODUCT, ROT_MINIMUM, ROT_MAXIMUM};
+		
+	/// The class generates code corresponding to a reduction operation of elements 
+	/**
+		 \ingroup ComplexDataTypes
+	 */
+	template <typename ResType, enum ReductionOperatorType Op> class ReductionAlgGenerator
+	{
+		private:
+			VectorOfElements ve;
+			unsigned int nGroups;
+			unsigned int nLocal;
+		public:
+		    asl::UValue<asl::AVec<ResType>> res;
+		private:
+			std::vector<std::vector<ResType>> groupRes;
+			VectorOfElementsData groupResACL;
+
+			shared_ptr<Kernel> kernel;
+			
+		public:	
+			ReductionAlgGenerator(VectorOfElements v);
+			void compute();	
+			void generateAlg(Kernel & k);
+			void generateAlg();
+	};
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_SUM>> 
+		generateSumAlg(VectorOfElements v);
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MINIMUM>> 
+		generateMinAlg(VectorOfElements v);
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MAXIMUM>> 
+		generateMaxAlg(VectorOfElements v);
+
+	template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_PRODUCT>> 
+		generateProductAlg(VectorOfElements v);
+	
+
+}  //namespace acl
+
+#endif // ACLREDUCTIONALGGENERATUR_H
diff --git a/src/acl/aclMath/aclVectorOfElements.h b/src/acl/aclMath/aclVectorOfElements.h
new file mode 100644
index 0000000..812480e
--- /dev/null
+++ b/src/acl/aclMath/aclVectorOfElements.h
@@ -0,0 +1,31 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVECTORELEMENTS_H
+#define ACLVECTORELEMENTS_H
+
+#include "aclVectorOfElementsDef.h"
+#include "aclVectorOfElementsOperations.h"		 
+
+
+#endif // ACLVECTORELEMENTS_H
diff --git a/src/acl/aclMath/aclVectorOfElementsDef.cxx b/src/acl/aclMath/aclVectorOfElementsDef.cxx
new file mode 100644
index 0000000..aa15d4c
--- /dev/null
+++ b/src/acl/aclMath/aclVectorOfElementsDef.cxx
@@ -0,0 +1,184 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclVectorOfElementsDef.h"
+#include "aclVectorOfElementsOperations.h"
+#include <aclUtilities.h>
+#include <acl.h>
+#include <DataTypes/aclConstant.h>
+#include <../aslUtilities.h>
+#include <algorithm>
+#include <Kernels/aclKernel.h>
+
+#include <acl/DataTypes/aclArray.h>
+#include"../aclHardware.h"
+
+#include "aclTypesList.h"
+
+using asl::errorMessage;
+
+using namespace std;
+
+namespace acl
+{
+	VectorOfElementsData::VectorOfElementsData():
+		std::vector<ElementData>()
+	{
+	}
+
+
+	VectorOfElementsData::VectorOfElementsData(unsigned int n):
+		std::vector<ElementData>(n)
+	{
+	}
+
+	template <typename T> VectorOfElementsData::VectorOfElementsData(unsigned int n,
+	                                                                 unsigned int s,
+	                                                                 T,
+	                                                                 CommandQueue queue):
+		std::vector<ElementData>(n)
+	{
+		for (unsigned int i(0); i < n; ++i)
+			(*this)[i] = ElementData(new Array<T>(s, queue));
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElementsData::VectorOfElementsData(unsigned int n, unsigned int s, t, CommandQueue queue);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> VectorOfElementsData::VectorOfElementsData(unsigned int n,
+	                                                                 unsigned int s,
+	                                                                 T):
+		VectorOfElementsData(n,s,T(0),hardware.defaultQueue)
+	{
+	}
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template VectorOfElementsData::VectorOfElementsData(unsigned int n, unsigned int s, t);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+		
+
+	void VectorOfElementsData::resizeElements(unsigned int n)
+	{
+		if ((*this)[0].get() == 0)
+			return ;
+		else
+			if ((*this)[0]->getSize() == n)
+				return ;
+
+		auto q((*this)[0]->getQueue());
+		
+		for (unsigned int i(0); i < size(); ++i)
+		{
+			TypeID t((*this)[i]->getTypeID());
+			(*this)[i] = generateElementArray(t, n, q);
+		}
+	}
+	
+
+	VectorOfElements VectorOfElementsData::operator=(const VectorOfElements &a) const
+	{
+		return assignmentSafe(*this, a);
+	}
+
+	VectorOfElements VectorOfElementsData::operator=(const VectorOfElementsData &a) const
+	{
+		return assignmentSafe(*this, a);
+	}
+		
+		
+
+	VectorOfElements::VectorOfElements():
+		std::vector<Element>()
+	{
+	}
+
+		
+	VectorOfElements::VectorOfElements(unsigned int n):
+		std::vector<Element>(n, Element(new Constant<cl_int>(0)))
+	{
+	}
+
+
+	VectorOfElements::VectorOfElements(const VectorOfElementsData & a):
+		std::vector<Element>(a.size())
+	{
+		for (unsigned int i(0); i < a.size(); ++i)
+			(*this)[i] = a[i];
+	}
+		
+	
+	VectorOfElements VectorOfElements::operator=(const VectorOfElements &a) const
+	{
+		if (size() != a.size())
+			errorMessage("operator= - the sizes of two VectorOfElements are incompatible: "
+			             + numToStr(size()) + " and " + numToStr(a.size()));
+
+		VectorOfElements ve(a.size());
+		for (unsigned int i(0); i < size(); ++i)
+			ve[i] = elementOperators::operatorAssignment((*this)[i], a[i]);
+		return ve;
+	}		
+
+	/// \todoIgal change name to: compatible()?
+	bool VectorOfElements::checkCompatibility() const
+	{
+		unsigned int s((*this)[0]->getSize());
+		CommandQueue queue((*this)[0]->getQueue());
+		bool isCompatible(true);
+		for (unsigned int i = 1; i < size(); ++i)
+		{
+			isCompatible &= compatible(s, queue, (*this)[i]);
+			s = std::max(s, (*this)[i]->getSize());
+			CommandQueue q((*this)[0]->getQueue());
+			queue = (q.get() != 0 ? q : queue);
+		}
+		return isCompatible;
+	}
+
+
+	/// \todoIgal change name to: compatibleSizes()?
+	bool VectorOfElements::checkSizesCompatibility(unsigned int n) const
+	{
+		bool isCompatible(true);
+		for (unsigned int i = 0; i < size(); ++i)
+		{
+			isCompatible &= compatibleSizes(n, (*this)[i]);
+		}
+		return isCompatible;
+	}
+
+	unsigned int getElementsSize(const VectorOfElements & a)
+	{
+		if (a.size() > 0 && a[0].get() != 0)
+			return a[0]->getSize();
+		else
+			return 0;
+	}
+		
+	acl::TypeID getElementType(const VectorOfElements & a, unsigned int i)
+	{
+		return a.at(i)->getTypeID();
+	}
+} // namespace acl
diff --git a/src/acl/aclMath/aclVectorOfElementsDef.h b/src/acl/aclMath/aclVectorOfElementsDef.h
new file mode 100644
index 0000000..c6ad5ff
--- /dev/null
+++ b/src/acl/aclMath/aclVectorOfElementsDef.h
@@ -0,0 +1,126 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVECTORELEMENTSDEF_H
+#define ACLVECTORELEMENTSDEF_H
+
+#include <memory>
+#include <vector>
+#include "../aclTypes.h"
+
+using namespace std;
+
+namespace cl
+{
+	class CommandQueue;
+}
+
+namespace acl
+{
+	
+	class ElementBase;
+	class MemBlock;
+	
+	typedef std::shared_ptr<ElementBase> Element;
+	typedef std::shared_ptr<MemBlock> ElementData;
+
+	class VectorOfElements;
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
+	
+	/// The class represents several ::ElementData
+	/**
+		 \ingroup ComplexDataTypes
+		 Basicaly the class is identical to the std::vector class. The only 
+		 difference is the assigment operator and mathematical operations.
+	 */
+	class VectorOfElementsData: public std::vector<ElementData>
+	{
+			/// checks whether all Elements have sizes compatible
+			/// with each other and reside on the same device
+			bool checkCompatibility() const;
+		public:
+			/// checks whether all Elements have sizes compatible with \p n
+			bool checkSizesCompatibility(unsigned int n) const;
+			VectorOfElementsData();
+			explicit VectorOfElementsData(unsigned int n);
+			/**
+			 \param n number of ElementData
+			 \param s size of each ElementData
+			 \param T type of ElementData: e.g. float double etc.
+			 \param queue defines a device where the DataElements should be placed
+			 */
+			template <typename T> VectorOfElementsData(unsigned int n,
+			                                           unsigned int s,
+			                                           T);
+			template <typename T> VectorOfElementsData(unsigned int n,
+			                                           unsigned int s,
+			                                           T,
+			                                           CommandQueue queue);
+
+			VectorOfElements operator=(const VectorOfElements & a) const;
+			VectorOfElements operator=(const VectorOfElementsData & a) const;
+			void resizeElements(unsigned int n);
+	};
+
+	/// The class represents several ::Element
+	/**
+		 \ingroup ComplexDataTypes
+		 Basicaly the class is identical to the std::vector class. The only 
+		 difference is the assigment operator and mathematical operations.
+	 */
+	class VectorOfElements: public std::vector<Element>
+	{
+			/// checks whether all Elements have sizes compatible
+			/// with each other and reside on the same device
+			bool checkCompatibility() const;
+		public:						
+			/// checks whether all Elements have sizes compatible with \p n
+			bool checkSizesCompatibility(unsigned int n) const;
+			VectorOfElements();
+			explicit VectorOfElements(unsigned int n);
+			VectorOfElements(const VectorOfElementsData & a);
+			VectorOfElements operator=(const VectorOfElements & a) const;
+	};
+
+	typedef shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
+	typedef shared_ptr<VectorOfElements> SPVectorOfElements;
+
+	inline bool compatibleSizes (unsigned int s, const VectorOfElements & a);
+
+	///\related VectorOfElements
+	acl::TypeID getElementType(const VectorOfElements & a, unsigned int i = 0);
+	
+	///\related VectorOfElements
+	unsigned int getElementsSize(const VectorOfElements & a);
+	
+//------------------------- Implementation -----------------
+	
+	inline bool compatibleSizes(unsigned int s, const VectorOfElements & a)
+	{
+		return a.checkSizesCompatibility(s);
+	}
+
+	
+}  // namespace acl
+
+#endif // ACLVECTORELEMENTSDEF_H
diff --git a/src/acl/aclMath/aclVectorOfElementsOperations.cxx b/src/acl/aclMath/aclVectorOfElementsOperations.cxx
new file mode 100644
index 0000000..cc56da0
--- /dev/null
+++ b/src/acl/aclMath/aclVectorOfElementsOperations.cxx
@@ -0,0 +1,1248 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclVectorOfElementsOperations.h"
+#include "aclUtilities.h"
+#include "acl.h"
+#include "DataTypes/aclConstant.h"
+#include "../aslUtilities.h"
+#include <algorithm>
+#include "Kernels/aclKernel.h"
+#include "Kernels/aclKernelConfigurationTemplates.h"
+
+#include <acl/DataTypes/aclArray.h>
+
+#include <acl/aclGenerators.h>
+
+using asl::errorMessage;
+
+using namespace std;
+
+namespace acl
+{
+
+	VectorOfElementsData clone(VectorOfElementsData a)
+	{
+		if (a.size() == 0)
+			return VectorOfElementsData(0u);
+
+		VectorOfElementsData v(a.size());
+		auto queue(a[0]->getQueue());
+		
+		for (unsigned int i(0); i < a.size(); ++i)
+			v[i] = generateElementArray(a[i]->getTypeID(), a[i]->getSize(), queue);
+		return v;
+	}
+
+	VectorOfElementsData clone(VectorOfElementsData a, unsigned int n)
+	{
+		if (a.size() < n)
+			errorMessage("clone: number n is larger than size of the input vector");
+		
+		if (a.size() == 0)
+			return VectorOfElementsData(0u);
+
+		VectorOfElementsData v(n);
+		auto queue(a[0]->getQueue());
+		
+		for (unsigned int i(0); i < n; ++i)
+			v[i] = generateElementArray(a[i]->getTypeID(), a[i]->getSize(), queue);
+		return v;
+	}
+	
+
+
+	VectorOfElements assignmentSafe(const VectorOfElements & a,
+	                                const VectorOfElements &b)
+	{
+		if (a.size() != b.size())
+			errorMessage("assignmentSafe - the sizes of two VectorOfElements are incompatible: "
+			             + asl::numToStr(a.size()) + " and " + asl::numToStr(b.size()));
+
+		VectorOfElements ve(a.size());
+		for (unsigned int i(0); i < a.size(); ++i)
+			ve[i] = elementOperators::operatorAssignmentSafe(a[i], b[i]);
+
+		return ve;
+	}
+
+	void copy(const vector<Element> & source,
+	          VectorOfElements & destination)
+	{
+		destination.resize(source.size());
+		for (unsigned int i(0); i < destination.size(); ++i)
+			destination[i] = source[i];
+	}
+
+	void copy(const vector<ElementData> & source,
+	          VectorOfElements & destination)
+	{
+		destination.resize(source.size());
+		for (unsigned int i(0); i < destination.size(); ++i)
+			destination[i] = source[i];
+	}
+
+	
+	void copy(const vector<Element> & source,
+	          VectorOfElements & destination, unsigned int start, unsigned int end)
+	{
+		if (source.size() <= end )
+			errorMessage("copy: attempt to copy besides the vector range");
+		
+		destination.resize(1+end-start);
+		for (unsigned int i(start); i <= end; ++i)
+			destination[i] = source[i];
+	}
+
+	void copy(const VectorOfElementsData & source,
+	          VectorOfElementsData & destination)
+	{
+		destination.resize(source.size());
+		for (unsigned int i(0); i < destination.size(); ++i)
+			destination[i] = source[i];
+	}
+
+
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       unsigned int start, unsigned int end)
+	{
+		if (source.size() <= end )
+			errorMessage("subVE: attempt to copy besides the vector range");
+		
+		VectorOfElements destination(1 + end - start);
+		for (unsigned int i(start); i <= end; ++i)
+			destination[i - start] = source[i];
+		return destination;
+	}
+
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       unsigned int i)
+	{
+		if (source.size() <= i )
+			errorMessage("subVE: attempt to copy besides the vector range");
+		
+		VectorOfElements destination(1);
+			destination[0] = source[i];
+		return destination;
+	}
+
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       const vector<unsigned int> & iList)
+	{
+		VectorOfElements destination(iList.size());
+		for (unsigned int i(0); i < iList.size(); ++i)
+		{
+			if (source.size() <= iList[i] )
+				errorMessage("subVE: attempt to copy besides the vector range");
+			destination[i] = source[iList[i]];
+		}
+		return destination;
+	}
+	
+		
+	VectorOfElementsData subVE(const VectorOfElementsData & source,
+	                           unsigned int start, unsigned int end)
+	{
+		if (source.size() <= end )
+			errorMessage("subVE: attempt to copy besides the vector range");
+		
+		VectorOfElementsData destination(1 + end - start);
+		for (unsigned int i(start); i <= end; ++i)
+			destination[i - start] = source[i];
+		return destination;
+	}
+
+	VectorOfElements cat(const VectorOfElements * a, 
+	                     unsigned int n)
+	{
+		unsigned int s(0);
+		for(unsigned int j(0); j < n; ++j)
+			s+=a[j].size();
+
+		VectorOfElements c(s);
+		s=0;
+		for(unsigned int i(0); i < n; ++i)
+			for(unsigned int j(0); j < a[i].size(); ++j)
+			{
+				c[s] = a[i][j];
+				s++;
+			}
+		return c;
+	}
+	
+
+	VectorOfElements catN(const VectorOfElements & a, 
+	                      unsigned int n)
+	{
+		VectorOfElements c(a.size()*n);
+		for(unsigned int j(0); j < a.size(); ++j)
+			for(unsigned int i(0); i < n; ++i)
+				c[j+i*a.size()] = a[j];		
+		return c;
+	}
+
+	void initData(VectorOfElements a,
+	              VectorOfElements initializationValue)
+	{
+		initData(a, initializationValue, KERNEL_SIMD);
+	}
+
+	
+	void initData(VectorOfElements a,
+	              VectorOfElements initializationValue,
+	              const KernelConfiguration & kernelConfig)
+	{
+		Kernel k(kernelConfig);
+		k << acl::assignmentSafe(a, initializationValue);
+		k.setup();
+		k.compute();
+	}
+
+
+	/// \todoIgal do they have to be on the same device?
+	void swapBuffers(const VectorOfElementsData & a, const VectorOfElementsData & b)
+	{ 
+		if (a.size() == 0)
+			errorMessage("swapBuffers - first VectorsOfEllementsData has zero size");		
+		if (b.size() == 0)
+			errorMessage("swapBuffers - second VectorsOfEllementsData has zero size");		
+		if (a.size() != b.size())
+			errorMessage("swapBuffers - twoVectorOfElementsData have different sizes");
+
+		for (unsigned int i(0); i < a.size(); ++i)
+			swapBuffers(*a[i], *b[i]);
+	}
+		
+
+	VectorOfElements  operator-(const VectorOfElements & a)
+	{ 
+		VectorOfElements c(a.size());
+		using namespace elementOperators;			
+		for (unsigned int i(0); i < c.size(); ++i)
+		{
+			c[i]= - a[i];
+		}
+		return c;
+	}
+
+
+	VectorOfElements  operator+=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator+= - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i]=( a[i] += b[i]);
+		return c;
+	}
+
+
+	VectorOfElements  operator-=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(a.size());
+		/// \todoIgal on same device? and all the rest of operators...
+		if (a.size() == b.size())
+		{
+			using namespace elementOperators;			
+			for (unsigned int i(0); i < c.size(); ++i)
+				c[i] = (a[i] -= b[i]);
+		}
+		else
+			errorMessage("operator-= - two VectorOfElements have different sizes");		
+		return c;
+	}
+
+
+	VectorOfElements  operator*=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(a.size());
+		if (b.size() == 1)
+		{	
+			using namespace elementOperators;
+			for (unsigned int i(0); i < a.size(); ++i)
+				c[i] = (a[i] *= b[0]);
+		}
+		else
+			errorMessage("operator*= - the second VectorOfElements has more than 1 element");		
+		return c;
+	}
+
+
+	VectorOfElements  operator/=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(a.size());
+		if (b.size() == 1)
+		{
+			using namespace elementOperators;
+			for (unsigned int i(0); i < a.size(); ++i)
+				c[i] = (a[i] /= b[0]);
+		}
+		else
+			errorMessage("operator/= - the second VectorOfElements has more than 1 element");		
+		return c;
+	}
+
+
+	VectorOfElements  operator+(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator+ - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = (a[i] + b[i]);
+		return c;
+	}
+
+
+	VectorOfElements  operator-(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator- - two VectorOfElements have different sizes:"+ 
+			             asl::numToStr(a.size()) + ", " +
+			             asl::numToStr(b.size()));
+		
+		VectorOfElements c(a.size());
+		using namespace elementOperators;			
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = ( a[i] - b[i]);					
+		return c;
+	}
+
+
+	VectorOfElements  operator*(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(1);
+		if (a.size() == b.size())
+		{
+			using namespace elementOperators;
+			c[0] = a[0] * b[0];
+			for (unsigned int i(1); i < a.size(); ++i)
+				c[0] = c[0] + a[i] * b[i];
+			return c;
+		}
+		if (a.size() == 1)
+		{
+			c.resize(b.size());	
+			using namespace elementOperators;
+			for (unsigned int i(0); i < c.size(); ++i)
+				c[i] = a[0] * b[i];
+			return c;
+		}
+		if (b.size() == 1)
+		{
+			c.resize(a.size());	
+			using namespace elementOperators;
+			for (unsigned int i(0); i < c.size(); ++i)
+				c[i] = a[i] * b[0];
+			return c;
+		}
+		
+		errorMessage("operator* - two VectorOfElements have different sizes or nor of one has size 1");		
+		return c;
+	}
+
+
+	VectorOfElements  operator/(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (b.size() != 1u)
+			errorMessage("operator/ - size of second VectorOfElements is not 1");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i]= a[i] / b[0];
+		return c;
+	}
+
+	VectorOfElements  operator%(const VectorOfElements & a, 
+	                            const VectorOfElements & b)
+	{ 
+		if (b.size() != 1u)
+			errorMessage("operator% - size of second VectorOfElements is not 1");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i]= a[i] % b[0];
+		return c;
+	}
+
+	VectorOfElements operator==(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(1);
+		if (a.size() == b.size())
+		{
+			using namespace elementOperators;
+			c[0] = isEqual(a[0], b[0]);
+			for (unsigned int i(1); i < c.size(); ++i)
+				c[0] = (c[0] && isEqual(a[i], b[i]));
+			return c;
+		}
+		else
+			errorMessage("operator== - two VectorOfElements have different sizes");		
+		return c;
+	}
+
+
+	VectorOfElements  operator!=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(1);
+		if (a.size() == b.size())
+		{
+			using namespace elementOperators;
+			c[0] = isNotEqual(a[0], b[0]);
+			for (unsigned int i(1); i < c.size(); ++i)
+				c[0] = (c[0] || isNotEqual(a[i], b[i]));
+			return c;
+		}		
+		errorMessage("operator!=  - two VectorOfElements have different sizes");		
+		return c;
+	}
+
+
+	VectorOfElements  operator>(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(1);
+		if (a.size() == b.size())
+		{
+			using namespace elementOperators;
+			c[0] = (a[0] > b[0]);
+			for (unsigned int i(1); i < a.size(); ++i)
+				c[0] = (c[0] && a[i] > b[i]);
+			return c;
+		}		
+		errorMessage("operator> - two VectorOfElements have different sizes");		
+		return c;
+	}
+
+	VectorOfElements  operator&&(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator&& - two VectorOfElements have different sizes");		
+			
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = a[i] && b[i];
+		return c;
+	}
+
+	VectorOfElements  operator||(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator|| - two VectorOfElements have different sizes");		
+			
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = a[i] || b[i];
+		return c;
+	}
+	
+	VectorOfElements  operator<(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator< - two VectorOfElements have different sizes");			
+
+		VectorOfElements c(1);		
+		using namespace elementOperators;
+		c[0] = (a[0] < b[0]);
+		for (unsigned int i(1); i < a.size(); ++i)
+			c[0] = (c[0] && a[i] < b[i]);
+		return c;
+	}
+
+	VectorOfElements  operator<=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator<= - two VectorOfElements have different sizes");			
+
+		VectorOfElements c(1);		
+		using namespace elementOperators;
+		c[0] = (a[0] <= b[0]);
+		for (unsigned int i(1); i < a.size(); ++i)
+			c[0] = (c[0] && a[i] <= b[i]);
+		return c;
+	}
+
+	VectorOfElements  operator>=(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("operator>= - two VectorOfElements have different sizes");			
+
+		VectorOfElements c(1);		
+		using namespace elementOperators;
+		c[0] = (a[0] >= b[0]);
+		for (unsigned int i(1); i < a.size(); ++i)
+			c[0] = (c[0] && a[i] >= b[i]);
+		return c;
+	}
+	
+	VectorOfElements  operator!(const VectorOfElements & a)
+	{ 
+		VectorOfElements c(a.size());
+		using namespace elementOperators;			
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i]= !a[i];
+		return c;
+	}
+	
+	VectorOfElements crossProduct(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("crossProduct - two VectorOfElements have different sizes");		
+		if (a.size() == 1)
+			errorMessage("crossProduct - is undefined for size 1 of VectorOfElements");		
+		if (a.size() > 3)
+			errorMessage("crossProduct - is undefined for size more than 3 of VectorOfElements");		
+
+		VectorOfElements c(a.size()==2 ? 1 :3);
+		using namespace elementOperators;
+		
+		if (a.size() == 2)
+			c[0] = a[0] * b[1] - a[1] * b[0];
+		else
+		{
+			c[0] = a[1] * b[2] - a[2] * b[1];
+			c[1] = a[2] * b[0] - a[0] * b[2];
+			c[2] = a[0] * b[1] - a[1] * b[0];	
+		}
+		return c;
+	}
+	
+
+	VectorOfElements productOfElements(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("productOfElements - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = a[i] * b[i];
+		return c;
+	}
+
+	VectorOfElements productOfElements(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		using namespace elementOperators;
+		c[0]=a[0];
+		for (unsigned int i(1); i < a.size(); ++i)
+			c[0] = c[0] * a[i];
+		return c;
+	}
+
+	VectorOfElements divisionOfElements(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("divisionOfElements - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = a[i] / b[i];
+		return c;
+	}
+
+	VectorOfElements min(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("min - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = min(a[i],b[i]);
+		return c;
+	}
+
+	VectorOfElements min(const VectorOfElements & a, const VectorOfElements & b, TypeID type)
+	{
+		return min(convert(type, a, false), convert(type, b, false));
+	}	
+	
+	VectorOfElements minAbs(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("minAbs: two VectorOfElements have different sizes");		
+
+		acl::TypeID type(getElementType(a));
+		
+		VectorOfElements c(a.size());
+		copy(select(b, a, fabs(a)<fabs(b), type), c);
+		return c;
+	}
+	
+	VectorOfElements max(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("max - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = max(a[i],b[i]);
+		return c;
+	}
+
+	VectorOfElements max(const VectorOfElements & a, const VectorOfElements & b, TypeID type)
+	{
+		return max(convert(type, a, false), convert(type, b, false));
+	}
+
+	
+	VectorOfElements copysign(const VectorOfElements & a, const VectorOfElements & b)
+	{
+		if (a.size() != b.size())
+			errorMessage("max - two VectorOfElements have different sizes");		
+
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = copysign(a[i],b[i]);
+		return c;
+	}
+
+	VectorOfElements copysign(const VectorOfElements & a,
+	                          const VectorOfElements & b,
+	                          TypeID t)
+	{
+		return copysign(convert(t,a,false),convert(t,b,false));
+	}
+
+	VectorOfElements sign(const VectorOfElements & a)
+	{
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = sign(a[i]);
+		return c;
+	}
+	
+	VectorOfElements excerpt(const VectorOfElements & source, const VectorOfElements & filter)
+	{
+		if (filter.size() != 1)
+			errorMessage("exerpt - filter has more than 1 component");		
+
+		VectorOfElements c(source.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+		{
+			c[i] = excerpt(source[i], filter[0]);
+		}
+		return c;
+	}
+		
+	VectorOfElements select(const VectorOfElements & a,
+	                        const VectorOfElements & b,
+	                        const VectorOfElements & c)
+	{ 
+		VectorOfElements r(a.size());
+		if (c.size() == 1)
+		{
+			if (a.size() == b.size())
+			{
+				using namespace elementOperators;
+				for (unsigned int i(0); i < a.size(); ++i)
+					r[i] = select(a[i], b[i], c[0]);
+				return r;
+			}		
+			errorMessage("select - VectorOfElements a and b have different sizes");		
+		}
+		else
+		{
+			if (a.size() == b.size() && c.size() == b.size())
+			{
+				using namespace elementOperators;
+				for (unsigned int i(0); i < c.size(); ++i)
+					r[i] = select(a[i], b[i], c[i]);
+				return r;
+			}		
+			errorMessage("select - VectorOfElements a, b and c have different sizes");		
+		}
+		return r;
+	}
+
+	VectorOfElements select(const VectorOfElements & a,
+	                        const VectorOfElements & b,
+	                        const VectorOfElements & c, 
+	                        TypeID t)
+	{
+		return select(convert(t,a,false), 
+		              convert(t,b,false), 
+		              convert(TYPE_SELECT[t],c,false));
+	}
+
+	VectorOfElements select(const VectorOfElements & b,
+	                        const VectorOfElements & c, 
+	                        TypeID t)
+	{
+		return select(convert(t,generateVEConstantN(b.size(),0),false), 
+		              convert(t,b,false), 
+		              convert(TYPE_SELECT[t],c,false));
+	}
+
+	VectorOfElements mad(const VectorOfElements & a, 
+	                     const VectorOfElements & b, 
+	                     const VectorOfElements & c)
+	{ 
+		if (a.size() != 1 || b.size() != 1 || c.size() != 1)
+			errorMessage("mad - the function defined only fo sigle value VectorOfElements");		
+		using namespace elementOperators;
+		VectorOfElements r(1);
+		r[0] = mad(a[0], b[0], c[0]);
+		return r;
+	}
+
+	VectorOfElements mad(const VectorOfElements & a, 
+	                     const VectorOfElements & b, 
+	                     const VectorOfElements & c,
+	                     TypeID t)
+	{ 
+		return mad(convert(t,a,false), 
+		              convert(t,b,false), 
+		              convert(t,c,false));
+	}
+	
+		
+	VectorOfElements powI(const VectorOfElements & a, unsigned int i)
+	{ 
+		VectorOfElements c(1);
+		if (a.size() != 1)
+			errorMessage("powI - the input vector has number of elements unequal to 1");		
+
+		using namespace elementOperators;
+		c[0] = powI(a[0], i);
+		return c;
+	}
+
+	VectorOfElements exp(const VectorOfElements & a)
+	{ 
+		if (a.size() != 1)
+			errorMessage("exp- the input vector has number of elements unequal to 1");		
+
+		VectorOfElements c(1);
+		c[0] = elementOperators::exp(a[0]);
+		return c;
+	}
+
+	VectorOfElements sqrt(const VectorOfElements & a)
+	{ 
+		if (a.size() != 1)
+			errorMessage("sqrt- the input vector has number of elements unequal to 1");		
+
+		VectorOfElements c(1);
+		c[0] = elementOperators::sqrt(a[0]);
+		return c;
+	}
+
+	VectorOfElements rsqrt(const VectorOfElements & a)
+	{ 
+		if (a.size() != 1)
+			errorMessage("rsqrt- the input vector has number of elements unequal to 1");		
+
+		VectorOfElements c(1);
+		c[0] = elementOperators::rsqrt(a[0]);
+		return c;
+	}
+	
+	VectorOfElements fabs(const VectorOfElements & a)
+	{ 
+		VectorOfElements c(a.size());
+		for(unsigned int i(0); i < a.size(); ++i)
+			c[i] = elementOperators::fabs(a[i]);
+		return c;
+	}
+
+	VectorOfElements abs(const VectorOfElements & a)
+	{ 
+		VectorOfElements c(a.size());
+		for(unsigned int i(0); i < a.size(); ++i)
+			c[i] = elementOperators::abs(a[i]);
+		return c;
+	}
+
+	VectorOfElements abs_diff(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		if (a.size() != b.size())
+			errorMessage("abs_diff - two VectorOfElements have different sizes");		
+		
+		VectorOfElements c(a.size());
+		for(unsigned int i(0); i < a.size(); ++i)
+			c[i] = elementOperators::abs_diff(a[i],b[i]);
+		return c;
+	}
+	
+	VectorOfElements floor(const VectorOfElements & a)
+	{ 
+		VectorOfElements c(a.size());
+		for(unsigned int i(0); i < a.size(); ++i)
+			c[i] = elementOperators::floor(a[i]);
+		return c;
+	}
+	
+	VectorOfElements convert(acl::TypeID type,const VectorOfElements & a, bool strong)
+	{
+		VectorOfElements c(a.size());
+		using namespace elementOperators;
+		for (unsigned int i(0); i < c.size(); ++i)
+			c[i] = convert(type,a[i],strong);
+		return c;
+	}
+	
+	
+		
+		
+	VectorOfElements log(const VectorOfElements & a)
+	{ 
+		if (a.size() != 1)
+			errorMessage("log - the input vector has number of elements unequal to 1");		
+		VectorOfElements c(1);
+		c[0] = elementOperators::log(a[0]);		
+		return c;
+	}
+
+
+	VectorOfElements log10(const VectorOfElements & a)
+	{ 
+		if (a.size() != 1)
+			errorMessage("log10 - the input vector has number of elements unequal to 1");		
+		VectorOfElements c(1);
+		c[0] = elementOperators::log10(a[0]);		
+		return c;
+	}
+		
+
+	VectorOfElements minElement(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		c[0]=min(a[0], a[1]);
+		for(unsigned int i(2); i<a.size(); ++i)
+			c[0]=acl::elementOperators::min(c[0], a[i]);
+		return c;
+	}
+
+	VectorOfElements minAbsElement(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		acl::TypeID type(getElementType(a));
+		using namespace elementOperators;
+		c[0]=select(a[0], a[1], convert(TYPE_SELECT[type],
+		                                fabs(a[1])<fabs(a[0]),
+		                                false));
+		for(unsigned int i(2); i<a.size(); ++i)
+			c[0]=select(c[0], a[i], convert(TYPE_SELECT[type],
+			                                fabs(a[i])<fabs(c[0]), 
+			                                false));
+		return c;
+	}
+	
+	VectorOfElements maxElement(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		c[0]=min(a[0], a[1]);
+		for(unsigned int i(2); i < a.size(); ++i)
+			c[0]=acl::elementOperators::max(c[0], a[i]);
+		return c;
+	}
+
+	VectorOfElements sumOfElements(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		c[0]=acl::elementOperators::operator+(a[0], a[1]);
+		for(unsigned int i(2); i < a.size(); ++i)
+			c[0]=acl::elementOperators::operator+(c[0], a[i]);
+		return c;
+	}
+
+	VectorOfElements andOfElements(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		c[0]=acl::elementOperators::operator&&(a[0], a[1]);
+		for(unsigned int i(2); i < a.size(); ++i)
+			c[0]=acl::elementOperators::operator&&(c[0], a[i]);
+		return c;
+	}
+
+	VectorOfElements orOfElements(const VectorOfElements & a)
+	{
+		VectorOfElements c(1);
+		c[0]=acl::elementOperators::operator||(a[0], a[1]);
+		for(unsigned int i(2); i < a.size(); ++i)
+			c[0]=acl::elementOperators::operator||(c[0], a[i]);
+		return c;
+	}
+	
+	VectorOfElements cat(const VectorOfElements & a, const VectorOfElements & b)
+	{ 
+		VectorOfElements c(a.size() + b.size());
+		using namespace elementOperators;			
+		for (unsigned int i(0); i < a.size(); ++i)
+			c[i] = ( a[i]);
+		for (unsigned int i(0); i < b.size(); ++i)
+			c[a.size() + i] = b[i];
+		return c;
+	}
+
+	VectorOfElementsData cat(const VectorOfElementsData & a, const VectorOfElementsData & b)
+	{ 
+		VectorOfElementsData c(a.size() + b.size());
+		using namespace elementOperators;			
+		for (unsigned int i(0); i < a.size(); ++i)
+			c[i] = ( a[i]);
+		for (unsigned int i(0); i < b.size(); ++i)
+			c[a.size() + i] = b[i];
+		return c;
+	}
+
+	VectorOfElements cat(const VectorOfElements & a, 
+	                     const VectorOfElements & b, 
+	                     const VectorOfElements & c)
+	{ 
+		VectorOfElements z(cat(a,b));
+		return cat(z,c);
+	}
+
+	template <typename T> VectorOfElements operator+=(const VectorOfElements & a, const T & b)
+	{
+		return a+=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator+=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator+=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator+=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator+=(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator-=(const VectorOfElements & a, const T & b)
+	{
+		return a-=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator-=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator-=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator-=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator-=(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator*=(const VectorOfElements & a, const T & b)
+	{
+		return a*=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator*=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator*=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator*=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator*=(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator/=(const VectorOfElements & a, const T & b)
+	{
+		return a/=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator/=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator/=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator/=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator/=(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator+(const VectorOfElements & a, const T & b)
+	{
+		return a+generateVEConstant(b);
+	}
+
+	template VectorOfElements operator+(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const cl_int & b);	
+	template VectorOfElements operator+(const VectorOfElements & a, const AVec<cl_double> & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const AVec<cl_float> & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const AVec<cl_uint> & b);
+	template VectorOfElements operator+(const VectorOfElements & a, const AVec<cl_int> & b);	
+	
+	template <typename T> inline VectorOfElements operator+(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)+b;
+	}
+
+	template VectorOfElements operator+(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const cl_uint & a, const VectorOfElements & b);	
+	template VectorOfElements operator+(const AVec<cl_double> & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const AVec<cl_float> & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const AVec<cl_int> & a, const VectorOfElements & b);
+	template VectorOfElements operator+(const AVec<cl_uint> & a, const VectorOfElements & b);	
+	
+	template <typename T> VectorOfElements operator-(const VectorOfElements & a, const T & b)
+	{
+		return a-generateVEConstant(b);
+	}
+
+	template VectorOfElements operator-(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const cl_int & b);	
+	template VectorOfElements operator-(const VectorOfElements & a, const AVec<cl_double> & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const AVec<cl_float> & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const AVec<cl_uint> & b);
+	template VectorOfElements operator-(const VectorOfElements & a, const AVec<cl_int> & b);	
+	
+	template <typename T> VectorOfElements operator-(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)-b;
+	}
+
+	template VectorOfElements operator-(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const cl_uint & a, const VectorOfElements & b);	
+	template VectorOfElements operator-(const AVec<cl_double> & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const AVec<cl_float> & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const AVec<cl_int> & a, const VectorOfElements & b);
+	template VectorOfElements operator-(const AVec<cl_uint> & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator*(const VectorOfElements & a,const T & b)
+	{
+		return a*generateVEConstant(b);
+	}
+
+	template VectorOfElements operator*(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator*(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator*(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator*(const VectorOfElements & a, const cl_int & b);	
+	template VectorOfElements operator*(const VectorOfElements & a, const AVec<cl_double> & b);		
+	template VectorOfElements operator*(const VectorOfElements & a, const AVec<cl_float> & b);		
+	template VectorOfElements operator*(const VectorOfElements & a, const AVec<cl_int> & b);		
+
+	template <typename T> VectorOfElements operator*(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)*b;
+	}
+
+	template VectorOfElements operator*(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator*(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator*(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator*(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator/(const VectorOfElements & a, const T & b)
+	{
+		return a/generateVEConstant(b);
+	}
+
+	template VectorOfElements operator/(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator/(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator/(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator/(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator/(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)/b;
+	}
+
+	template VectorOfElements operator/(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator/(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator/(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator/(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator%(const VectorOfElements & a, const T & b)
+	{
+		return a%generateVEConstant(b);
+	}
+
+	template VectorOfElements operator%(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator%(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator%(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator%(const VectorOfElements & a, const cl_int & b);	
+
+	template <typename T> VectorOfElements operator%(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)%b;
+	}
+
+	template VectorOfElements operator%(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator%(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator%(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator%(const cl_uint & a, const VectorOfElements & b);	
+	
+	template <typename T> VectorOfElements operator>(const VectorOfElements & a, const T & b)
+	{
+		return a>generateVEConstant(b);
+	}
+
+	template VectorOfElements operator>(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator>(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator>(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator>(const VectorOfElements & a, const cl_int & b);	
+	
+	template <typename T> VectorOfElements operator>(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)>b;
+	}
+
+	template VectorOfElements operator>(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator>(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator>(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator>(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator<(const VectorOfElements & a, const T & b)
+	{
+		return a<generateVEConstant(b);
+	}
+
+	template VectorOfElements operator<(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator<(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator<(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator<(const VectorOfElements & a, const cl_int & b);	
+	
+	template <typename T> VectorOfElements operator<(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)<b;
+	}
+
+	template VectorOfElements operator<(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator<(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator<(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator<(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator>=(const VectorOfElements & a, const T & b)
+	{
+		return a>=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator>=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator>=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator>=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator>=(const VectorOfElements & a, const cl_int & b);	
+	
+	template <typename T> VectorOfElements operator>=(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)>=b;
+	}
+
+	template VectorOfElements operator>=(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator>=(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator>=(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator>=(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator<=(const VectorOfElements & a, const T & b)
+	{
+		return a<=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator<=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator<=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator<=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator<=(const VectorOfElements & a, const cl_int & b);	
+	
+	template <typename T> VectorOfElements operator<=(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)<=b;
+	}
+
+	template VectorOfElements operator<=(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator<=(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator<=(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator<=(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator==(const VectorOfElements & a,
+	                                                  const T & b)
+	{
+		return a == generateVEConstant(b);
+	}
+
+	template VectorOfElements operator==(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator==(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator==(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator==(const VectorOfElements & a, const cl_int & b);	
+	
+
+	template <typename T> VectorOfElements operator==(const T & a,
+	                                                  const VectorOfElements & b)
+	{
+		return generateVEConstant(a) == b;
+	}
+
+	template VectorOfElements operator==(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator==(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator==(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator==(const cl_uint & a, const VectorOfElements & b);	
+
+	template <typename T> VectorOfElements operator!=(const VectorOfElements & a, const T & b)
+	{
+		return a!=generateVEConstant(b);
+	}
+
+	template VectorOfElements operator!=(const VectorOfElements & a, const cl_double & b);
+	template VectorOfElements operator!=(const VectorOfElements & a, const cl_float & b);
+	template VectorOfElements operator!=(const VectorOfElements & a, const cl_uint & b);
+	template VectorOfElements operator!=(const VectorOfElements & a, const cl_int & b);	
+	
+	template <typename T> VectorOfElements operator!=(const T & a, const VectorOfElements & b)
+	{
+		return generateVEConstant(a)!=b;
+	}
+
+	template VectorOfElements operator!=(const cl_double & a, const VectorOfElements & b);
+	template VectorOfElements operator!=(const cl_float & a, const VectorOfElements & b);
+	template VectorOfElements operator!=(const cl_int & a, const VectorOfElements & b);
+	template VectorOfElements operator!=(const cl_uint & a, const VectorOfElements & b);	
+
+	vector<Element> gcLength2(const VectorOfElements & a, const VectorOfElements & l2)
+	{
+		auto type(getElementType(l2));
+		auto temp(acl::generateVEPrivateVariable(1u, type));
+		vector<Element> code;
+		code<<(temp=subVE(a,0));
+		code<<(l2=temp*temp);
+		for(unsigned int i(1); i<a.size(); ++i)
+		{
+			code<<(temp=subVE(a,i));
+			code<<(l2+=temp*temp);
+		}
+		return code;
+	}
+
+	vector<Element> gcLength(const VectorOfElements & a, const VectorOfElements & l)
+	{
+		auto code(gcLength2(a,l));
+		code.push_back((l=sqrt(l))[0]);
+		return code;
+	}
+	
+	vector<Element> gcNormalize(const VectorOfElements & a)
+	{
+		auto type(getElementType(a));
+		auto len(acl::generateVEPrivateVariable(1u, type));
+		auto code(gcLength(a,len));
+		auto res(a /= len);
+		copy(res.begin(), res.end(), back_inserter(code));
+			
+		return code;
+	}
+	
+
+	
+} // namespace acl
diff --git a/src/acl/aclMath/aclVectorOfElementsOperations.h b/src/acl/aclMath/aclVectorOfElementsOperations.h
new file mode 100644
index 0000000..d79928a
--- /dev/null
+++ b/src/acl/aclMath/aclVectorOfElementsOperations.h
@@ -0,0 +1,759 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLVECTORELEMENTSOPERATIONS_H
+#define ACLVECTORELEMENTSOPERATIONS_H
+
+#include "aclVectorOfElementsDef.h"
+
+namespace acl
+{
+	
+	class ElementBase;
+	class MemBlock;
+	class KernelConfiguration;
+
+
+	typedef std::shared_ptr<ElementBase> Element;
+	typedef std::shared_ptr<MemBlock> ElementData;
+
+	class VectorOfElements;
+
+	typedef shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
+	typedef shared_ptr<VectorOfElements> SPVectorOfElements;
+
+	/// Creates VectorOfElementsData with same structure ElementData objects as \p a
+	/// \relates VectorOfElementsData
+	VectorOfElementsData clone(VectorOfElementsData a);
+
+	/// Creates VectorOfElementsData with same structure ElementData objects as \p a and with \p n numbers of elements
+	/// \relates VectorOfElementsData
+	VectorOfElementsData clone(VectorOfElementsData a, unsigned int n);
+	
+	
+	/// Writes data from \p initializationValue to \p a
+	/// \relates VectorOfElements
+	void initData(VectorOfElements a,
+	              VectorOfElements initializationValue,
+	              const KernelConfiguration & kernelConfig);
+
+	/// Writes data from \p initializationValue to \p a
+	/// \relates VectorOfElements
+	void initData(VectorOfElements a,
+	              VectorOfElements initializationValue);
+	
+
+	/// Copies the VectorOfElements class. 
+	/** \relates VectorOfElements 
+		the \p destination is resized automaticaly
+	*/
+	void copy(const vector<Element> & source,
+	          VectorOfElements & destination);
+
+	/// Copies the VectorOfElements class. 
+	/** \relates VectorOfElements 
+		the \p destination is resized automaticaly
+	*/
+	void copy(const vector<ElementData> & source,
+	          VectorOfElements & destination);
+	
+	/// Copies the VectorOfElements class. 
+	/** \relates VectorOfElements 
+		the \p destination is resized automaticaly
+		 \p start and \p end define elements to copy: [start: end]
+	*/
+	void copy(const vector<Element> & source,
+	          VectorOfElements & destination, unsigned int start, unsigned int end);
+	
+
+	/// Copies the VectorOfElementsData class. 
+	/** \relates VectorOfElementsData
+		the \p destination is resized automaticaly
+	*/
+	void copy(const VectorOfElementsData & source,
+	          VectorOfElementsData & destination);
+
+
+	/// returns VectorOfElements class containing several elements of \p a. 
+	/// \relates VectorOfElements 
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       unsigned int start,
+	                       unsigned int end);
+
+	/// returns VectorOfElements class containing one element \p i of \p a. 
+	/// \relates VectorOfElements 
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       unsigned int i);
+
+	/// returns VectorOfElements class containing elements with numbers \p iList of \p source. 
+	/// \relates VectorOfElements 
+	VectorOfElements subVE(const VectorOfElements & source,
+	                       const vector<unsigned int> & iList);
+	
+	/// returns VectorOfElements class containing several elements of \p a. 
+	/// \relates VectorOfElements 
+	VectorOfElementsData subVE(const VectorOfElementsData & source,
+	                           unsigned int start,
+	                           unsigned int end);
+
+
+	/// Swaps buffers between corresponding
+	/// elements of two VectorOfElementsData classes. 
+	/// \relates VectorOfElementsData
+	void swapBuffers(const VectorOfElementsData & a,
+	                 const VectorOfElementsData & b);
+
+	///\defgroup VectorOfElementsOp VectorOfElements Operations 
+
+	///\defgroup VectorOfElementsVectorOfElementsOp  VectorOfElements-VectorOfElements Operations 	
+	///@{ 
+		
+	/// Creates VectorOfElements containing assignment operation result \p a=\p b  
+	/// \relates VectorOfElements
+	VectorOfElements assignmentSafe(const VectorOfElements & a,
+	                                const VectorOfElements & b);	
+	
+
+	/// Creates VectorOfElements containing operation result of element \p a  
+	///	\relates VectorOfElements
+	VectorOfElements operator-(const VectorOfElements & a);	
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and \p b 
+	///	\relates VectorOfElements
+	VectorOfElements operator+=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator-=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	///	It is assumed that size of \p b is 1
+	VectorOfElements operator*=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates  VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	/// It is supposed that size of \p b is 1
+	VectorOfElements operator/=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator+(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator-(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+
+	/// Creates  VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	/// In case of sizes of \p a and \p b are equal the product is a scalar (dot)
+	/// product. If one of sizes is 1 than the function results product of a scalar on vector
+	VectorOfElements operator*(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator/(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+	/// Creates VectorOfElements containing operation result of elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator%(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+	
+
+	/// Creates VectorOfElements containing operation result of elements \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator==(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator!=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements  \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator>(const VectorOfElements & a, const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation result of elements \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator<(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+	/// Creates VectorOfElements containing operation result of elements \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator<=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+
+	/// Creates VectorOfElements containing operation result of elements \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator>=(const VectorOfElements & a,
+	                            const VectorOfElements & b);
+	
+	/// Creates VectorOfElements containing operation result of elements \p a && \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator&&(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+	/// Creates VectorOfElements containing operation result of elements \p a || \p b 
+	/// \relates VectorOfElements
+	VectorOfElements operator||(const VectorOfElements & a,
+	                           const VectorOfElements & b);
+
+	/// Creates VectorOfElements containing operation result of element \p a  
+	///	\relates VectorOfElements
+	VectorOfElements operator!(const VectorOfElements & a);	
+
+	
+	/// Creates VectorOfElements \p c which elements are crossproduct of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	/// The function is defined for 2D and 3D cases
+	VectorOfElements crossProduct(const VectorOfElements & a,
+	                              const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements \p b corresponding to a scala product a*a 
+	/// \relates VectorOfElements
+	/// The function is defined for 2D and 3D cases
+	inline VectorOfElements l2(const VectorOfElements & a);
+	
+
+	/// Creates VectorOfElements \p c which
+	/// elements are product of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements productOfElements(const VectorOfElements & a,
+	                                   const VectorOfElements & b);
+
+	/// Creates VectorOfElements \p c which
+	/// element is a product of all elements of \p a 
+	/// \relates VectorOfElements
+	VectorOfElements productOfElements(const VectorOfElements & a);
+
+	/// Creates VectorOfElements \p c which elements are division of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements divisionOfElements(const VectorOfElements & a,
+	                                    const VectorOfElements & b);
+	
+	/// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements min(const VectorOfElements & a,
+	                     const VectorOfElements & b);
+
+	/// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b with type specification 
+	/// \relates VectorOfElements
+	VectorOfElements min(const VectorOfElements & a,
+	                     const VectorOfElements & b,
+	                     TypeID type);
+	
+	/// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements minAbs(const VectorOfElements & a,
+	                        const VectorOfElements & b);
+	
+	/// Creates VectorOfElements \p c which elements are max of corresponding elements of \p a and \p b 
+	/// \relates VectorOfElements
+	VectorOfElements max(const VectorOfElements & a,
+	                     const VectorOfElements & b);
+
+	/// Creates VectorOfElements \p c which elements are max of corresponding elements of \p a and \p b with type specification 
+	/// \relates VectorOfElements
+	VectorOfElements max(const VectorOfElements & a,
+	                     const VectorOfElements & b,
+	                     TypeID type);
+
+	///returns a with sign of b copysign(a,b)
+	/// \relates VectorOfElements
+	VectorOfElements copysign(const VectorOfElements & a,
+	                          const VectorOfElements & b);
+
+	///returns a with sign of b copysign(a,b) with type specification
+	/// \relates VectorOfElements
+	VectorOfElements copysign(const VectorOfElements & a,
+	                          const VectorOfElements & b,
+	                          TypeID t);
+
+	///returns sign of a 
+	/// \relates VectorOfElements
+	VectorOfElements sign(const VectorOfElements & a);
+	
+	/// Creates VectorOfElements which elements are result of excerpt
+	/// operation of \p source and \p filter elements
+	/// \relates VectorOfElements
+	/// The \p filter shoule have only 1 component
+	VectorOfElements excerpt(const VectorOfElements & source,
+	                         const VectorOfElements & filter);
+		 
+	
+	/// Creates VectorOfElements containing operation
+	/// result of elements \p a, \p b and \p c 
+	/// For a scalar type, result = c ? b : a
+	/** 
+		 \relates VectorOfElements
+		 The function can operate in two modes: \p c has 1 components and 
+		 several components. 
+	*/
+	VectorOfElements select(const VectorOfElements & a,
+	                        const VectorOfElements & b,
+	                        const VectorOfElements & c);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements \p a, \p b and \p c 
+	/// For a scalar type, result = c ? b : a, with type specification
+	/** 
+		 \relates VectorOfElements
+		 The function can operate in two modes: \p c has 1 components and 
+		 several components. 
+	*/
+	VectorOfElements select(const VectorOfElements & a,
+	                        const VectorOfElements & b,
+	                        const VectorOfElements & c, 
+	                        TypeID t);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements \p a, \p b and \p c 
+	/// For a scalar type, result = c ? b : 0, with type specification
+	/** 
+		 \relates VectorOfElements
+		 The function can operate in two modes: \p c has 1 components and 
+		 several components. 
+	*/
+	VectorOfElements select(const VectorOfElements & b,
+	                        const VectorOfElements & c, 
+	                        TypeID t);
+	
+	/// Creates VectorOfElements containing operation
+	/// result of elements \p a, \p b and \p c 
+	/// For a scalar type, result = a * b + c
+	/// \relates VectorOfElements
+	VectorOfElements mad(const VectorOfElements & a,
+	                     const VectorOfElements & b,
+	                     const VectorOfElements & c);
+	
+	/// Creates VectorOfElements containing operation
+	/// result of elements \p a, \p b and \p c with type specification 
+	/// For a scalar type, result = a * b + c
+	/// \relates VectorOfElements
+	VectorOfElements mad(const VectorOfElements & a,
+	                     const VectorOfElements & b,
+	                     const VectorOfElements & c,
+	                     TypeID t);
+	
+	/// Creates VectorOfElements containing result log(a); a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements log(const VectorOfElements & a);
+
+
+	/// Creates VectorOfElements containing result log10(a); a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements log10(const VectorOfElements & a);
+
+	
+	/// Creates VectorOfElements containing result a^i; a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements powI(const VectorOfElements & a, unsigned int i);
+
+
+	/// Creates VectorOfElements containing result exp(a); a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements exp(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing result exp(a); a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements sqrt(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing result exp(a); a should contain only one element 
+	/// \relates VectorOfElements
+	VectorOfElements rsqrt(const VectorOfElements & a);
+	
+	/// Creates VectorOfElements containing result element-wise operation fabs(a);
+	/// \relates VectorOfElements
+	VectorOfElements fabs(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing result element-wise operation abs(a);
+	/// \relates VectorOfElements
+	VectorOfElements abs(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing result element-wise operation abs_diff(a, b);
+	/// \relates VectorOfElements
+	VectorOfElements abs_diff(const VectorOfElements & a, const VectorOfElements & b);
+	
+	/// Creates VectorOfElements containing result element-wise operation \f$ floor(a_i) \f$ 
+	/// \relates VectorOfElements
+	VectorOfElements floor(const VectorOfElements & a);
+	
+	/// Creates VectorOfElements with openCL type casting;
+	/// \relates VectorOfElements
+	VectorOfElements convert(acl::TypeID type, const VectorOfElements & a, bool strong=true);
+	
+	/// Creates VectorOfElements containing a min element 
+	/// \relates VectorOfElements
+	VectorOfElements minElement(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing an element with minimal absolute value 
+	/// \relates VectorOfElements
+	VectorOfElements minAbsElement(const VectorOfElements & a);
+	
+	/// Creates VectorOfElements containing a min element 
+	/// \relates VectorOfElements
+	VectorOfElements maxElement(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing a sum of elements 
+	/// \relates VectorOfElements
+	VectorOfElements sumOfElements(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing a && operation result of elements 
+	/// \relates VectorOfElements
+	VectorOfElements andOfElements(const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing a || operation result of elements 
+	/// \relates VectorOfElements
+	VectorOfElements orOfElements(const VectorOfElements & a);
+	
+	/// Concatinates two vectors \p a and \p b
+	/// \relates VectorOfElements
+	/**	\f$ cat\left(
+		          \left[\begin{array}{c}
+		             a_1\\a_2\\...\\a_n\\
+		          \end{array}\right],
+		          \left[\begin{array}{c}
+		             b_1\\b_2\\...\\b_m\\
+		          \end{array}\right]
+		          \right)=
+		 		          \left[\begin{array}{c}
+		             a_1\\a_2\\ \vdots \\a_n\\
+	                 b_1\\b_2\\ \vdots \\b_m\\
+		          \end{array}\right]. \f$		 
+	 */
+	VectorOfElements cat(const VectorOfElements & a,
+	                     const VectorOfElements & b);
+
+	/// Concatinates two vectors \p a and \p b
+	/// \relates VectorOfElements
+	/**	\f$ cat\left(
+		          \left[\begin{array}{c}
+		             a_1\\a_2\\...\\a_n\\
+		          \end{array}\right],
+		          \left[\begin{array}{c}
+		             b_1\\b_2\\...\\b_m\\
+		          \end{array}\right]
+		          \right)=
+		 		          \left[\begin{array}{c}
+		             a_1\\a_2\\ \vdots \\a_n\\
+	                 b_1\\b_2\\ \vdots \\b_m\\
+		          \end{array}\right]. \f$		 
+	 */
+	VectorOfElementsData cat(const VectorOfElementsData & a,
+	                         const VectorOfElementsData & b);
+
+	/// Concatinates three vectors \p a  \p b and \p c
+	/// \relates VectorOfElements
+	/**	\f$ cat\left(
+		          \left[\begin{array}{c}
+		             a_1\\...\\a_n\\
+		          \end{array}\right],
+		          \left[\begin{array}{c}
+		             b_1\\...\\b_m\\
+		          \end{array}\right],
+		          \left[\begin{array}{c}
+		             c_1\\...\\c_l\\
+		          \end{array}\right]
+		          \right)=
+		 		          \left[\begin{array}{c}
+		             a_1\\...\\a_n\\
+	                 b_1\\...\\b_m\\
+	                 c_1\\...\\c_l\\
+		          \end{array}\right]. \f$		 
+		 
+	 */
+	VectorOfElements cat(const VectorOfElements & a,
+	                     const VectorOfElements & b,
+	                     const VectorOfElements & c);
+
+	/// Concatinates \p n VectorOfElements \p a   
+	/// \relates VectorOfElements
+	VectorOfElements cat(const VectorOfElements * a, 
+	                     unsigned int n);
+
+	/// Concatinates VectorOfElements \p a to itself \p n times
+	/// \relates VectorOfElements
+	VectorOfElements catN(const VectorOfElements & a, 
+	                      unsigned int n);
+
+	
+	/// Creates VectorOfElements containing operation result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator+=(const VectorOfElements & a,
+	                                                  const T & b);
+
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator-=(const VectorOfElements & a,
+	                                                  const T & b);
+
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator*=(const VectorOfElements & a,
+	                                                  const T & b);
+
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator/=(const VectorOfElements & a,
+	                                                  const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator+(const VectorOfElements & a,
+	                                                 const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator+(const T & a,
+	                                                 const VectorOfElements & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator-(const VectorOfElements & a,
+	                                                 const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator-(const T & a,
+	                                                 const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator*(const VectorOfElements & a,
+	                                                 const T & b);
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double 
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator*(const T & a,
+	                                                 const VectorOfElements & b);
+
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator/(const VectorOfElements & a,
+	                                                 const T & b);
+	
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator%(const VectorOfElements & a,
+	                                                 const T & b);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator/(const T & b,
+	                                                 const VectorOfElements & a);
+	
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator%(const T & b,
+	                                                 const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator>(const VectorOfElements & a,
+	                                                 const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator>(const T & b,
+	                                                 const VectorOfElements & a);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator<(const VectorOfElements & a,
+	                                                 const T & b);
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator<(const T & b,
+	                                                 const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator>=(const VectorOfElements & a,
+	                                                  const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator>=(const T & b,
+	                                                  const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator<=(const VectorOfElements & a,
+	                                                  const T & b);
+	
+
+	/// Creates VectorOfElements containing operation
+	/// result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator<=(const T & b,
+	                                                  const VectorOfElements & a);
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator==(const VectorOfElements & a,
+	                                                  const T & b);
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double \p b 
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator==(const T & b,
+	                                                  const VectorOfElements & a);
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double \p b
+	/**	\relates VectorOfElements
+		 The function creates automaticaly a constant of a corresponding type
+	*/
+	template <typename T> VectorOfElements operator!=(const VectorOfElements & a,
+	                                                  const T & b);
+	
+
+	/// Creates VectorOfElements containing
+	/// operation result of elements of \p a and a double \p b  
+	///	\relates VectorOfElements
+	/// The function creates automaticaly a constant of a corresponding type
+	template <typename T> VectorOfElements operator!=(const T & b,
+	                                                  const VectorOfElements & a);		
+	///@} 
+
+	/// generates code corresponding \f$ \vec a /= |\vec a|\f$ 	
+	vector<Element> gcNormalize(const VectorOfElements & a);
+	/// generates code corresponding \f$ |\vec a|^2 \f$. Result will be stored in \p l2 	
+	vector<Element> gcLength2(const VectorOfElements & a, const VectorOfElements & l2);
+	/// generates code corresponding \f$ |\vec a| \f$. Result will be stored in \p l 	
+	vector<Element> gcLength(const VectorOfElements & a, const VectorOfElements & l);
+	
+		
+//------------------------------ Implementation ----------------
+
+	inline VectorOfElements l2(const VectorOfElements & a)
+	{
+		return a * a;
+	}
+
+		
+}  //namespace acl
+
+#endif // ACLVECTORELEMENTSOPERATIONS_H
diff --git a/src/acl/aclStdIncludes.h b/src/acl/aclStdIncludes.h
new file mode 100644
index 0000000..69a09a7
--- /dev/null
+++ b/src/acl/aclStdIncludes.h
@@ -0,0 +1,35 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLSTDINCLUDES_H
+#define ACLSTDINCLUDES_H
+
+#include <vector>
+#include <string>
+#include <iostream>
+#include <stdlib.h>
+#include <sstream>
+#include <algorithm>
+#include <iterator>
+
+#endif // ACLSTDINCLUDES_H
diff --git a/src/acl/aclTypes.h b/src/acl/aclTypes.h
new file mode 100644
index 0000000..cc2e256
--- /dev/null
+++ b/src/acl/aclTypes.h
@@ -0,0 +1,48 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLTYPES_H
+#define ACLTYPES_H
+
+namespace acl
+{
+	enum Extension
+	{
+		CL_KHR_FP64,
+		CL_KHR_INT64_BASE_ATOMICS,
+		CL_KHR_INT64_EXTENDED_ATOMICS,
+		CL_KHR_GL_SHARING,
+	};
+
+
+	enum TypeID
+	{
+		TYPE_INT,
+		TYPE_UINT,
+		TYPE_FLOAT,
+		TYPE_DOUBLE,
+		TYPE_LONG,
+	};
+}
+
+#endif // ACLTYPES_H
diff --git a/src/acl/aclTypesList.h b/src/acl/aclTypesList.h
new file mode 100644
index 0000000..b84c255
--- /dev/null
+++ b/src/acl/aclTypesList.h
@@ -0,0 +1,34 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLTYPESLIST_H
+#define ACLTYPESLIST_H
+
+
+#include <boost/preprocessor/seq.hpp>
+#include <CL/cl.hpp>
+
+#define BOOST_TT_acl_types (cl_int)(cl_uint)(cl_float)(cl_double)(cl_long)
+
+
+#endif // ACLTYPESLIST_H
diff --git a/src/acl/aclUtilities.cxx b/src/acl/aclUtilities.cxx
new file mode 100644
index 0000000..751b489
--- /dev/null
+++ b/src/acl/aclUtilities.cxx
@@ -0,0 +1,151 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aclUtilities.h"
+#include "Kernels/aclKernelConfigurationTemplates.h"
+#include <acl/aclElementBase.h>
+
+#include "aclTypesList.h"
+#include "aclHardware.h"
+
+using namespace std;
+
+namespace acl
+{
+
+	bool compatible(unsigned int size1,
+	                CommandQueue queue1,
+	                unsigned int size2,
+	                CommandQueue queue2)
+	{
+		return ((compatibleSizes(size1, size2)) && (onSameDevice(queue1, queue2)));
+	}
+
+
+	bool compatible(unsigned int size, CommandQueue queue, Element e)
+	{
+		return compatible(size, queue, e->getSize(), e->getQueue());
+	}
+
+
+	bool compatible(Element e1, Element e2)
+	{
+		return compatible(e1->getSize(), e1->getQueue(), e2->getSize(), e2->getQueue());
+	}
+
+	
+	bool compatibleSizes(Element e1, Element e2)
+	{
+		return compatibleSizes(e1->getSize(), e2->getSize());
+	}
+
+
+	bool compatibleSizes(unsigned int s, Element e)
+	{
+		return compatibleSizes(s, e->getSize());
+	}
+
+
+	bool onSameDevice(CommandQueue queue1, CommandQueue queue2)
+	{
+		return ((queue1 == queue2) || (queue1.get() == 0) || (queue2.get() == 0));
+	}
+
+	bool onSameDevice(CommandQueue queue, Element e)
+	{
+		return onSameDevice(queue, e->getQueue());
+	}
+
+	
+	bool onSameDevice(Element e1, Element e2)
+	{
+		return onSameDevice(e1->getQueue(), e2->getQueue());
+	}
+
+
+	bool isDeclarable(Element e)
+	{
+		return ((e->getTypeSignature(KERNEL_BASIC) != "") || (e->getLocalDeclaration(KERNEL_BASIC) != ""));
+	}
+
+
+	bool isArgument(Element e)
+	{
+		return (e->getTypeSignature(KERNEL_BASIC) != "");
+	}
+
+	
+	void addElementToKernelSource(Element e,
+	                              vector<Element> & arguments,
+			                      vector<Element> & localDeclarations)
+	{
+		// adds expression_ either to arguments or to localDeclarations
+		// in a case that expression_ isDeclarable
+		if (isDeclarable(e))
+		{
+			if (isArgument(e))
+			{
+				arguments.push_back(e);
+			}
+			else
+			{
+				localDeclarations.push_back(e);
+			}
+		}
+		else
+		{
+			// adds expressions' elements either to arguments or to localDeclarations;
+			// multiply occurences of the same element possible.
+			// needs to be filtered
+			e->addToKernelSource(arguments, localDeclarations);
+		}
+	}
+
+
+	unsigned int paddingBytes(unsigned int size, unsigned int typeSize, CommandQueue queue)
+	{
+		// second modulo is added in order to make padding = 0 in the case
+		// that (size * typeSize) is divisible by getAlignment(queue)
+		return (getAlignment(queue) - ((size * typeSize)  % getAlignment(queue))) % getAlignment(queue);
+	}
+
+
+	unsigned int paddingElements(unsigned int size, const KernelConfiguration & kernelConfig)
+	{
+		// second modulo is added in order to make padding = 0 in the case
+		// that size is divisible by kernelConfig.vectorWidth
+		return (kernelConfig.vectorWidth - (size  % kernelConfig.vectorWidth)) % kernelConfig.vectorWidth;
+	}
+
+	template <typename T> const std::string& typeToStr()
+	{
+		return TYPE[typeToTypeID<T>()];
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+	template const std::string& typeToStr<T>();
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	
+} // namespace acl
diff --git a/src/acl/aclUtilities.h b/src/acl/aclUtilities.h
new file mode 100644
index 0000000..ea43199
--- /dev/null
+++ b/src/acl/aclUtilities.h
@@ -0,0 +1,132 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ACLUTILITIES_H
+#define ACLUTILITIES_H
+
+#include <aslUtilities.h>
+#include "Kernels/aclKernelConfiguration.h"
+//#include "aclHardware.h"
+#include "aclTypes.h"
+
+namespace cl
+{
+	class CommandQueue;
+}
+
+namespace acl
+{
+	
+	extern const std::string INDEX;
+	extern const KernelConfiguration KERNEL_BASIC;
+
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
+	
+	/// determines whether two elements are compatible
+	/// i.e. have compatible sizes and reside on the same device
+	bool compatible(unsigned int size1, CommandQueue queue1,
+	                unsigned int size2, CommandQueue queue2);
+	bool compatible(unsigned int size, CommandQueue queue, Element e);
+	bool compatible(Element e1, Element e2);
+
+	/// if \p s and size of \p e are the same or at least one of them is 0
+	inline bool compatibleSizes(unsigned int s1, unsigned int s2);
+	/// if both elements have the same size or size of at least one of them is 0
+	bool compatibleSizes(Element e1, Element e2);
+	/// if \p s and size of \p e are the same or at least one of them is 0
+	bool compatibleSizes(unsigned int s, Element e);
+
+	/// Adds padding in bytes based on the device's alignment
+	unsigned int paddingBytes(unsigned int size,
+	                          unsigned int typeSize,
+	                          CommandQueue queue);
+
+
+	/// Adds padding in elements based on vector width
+	unsigned int paddingElements(unsigned int size,
+	                             const KernelConfiguration & kernelConfig);
+	
+	/// checks whether both elements reside on the same device
+	bool onSameDevice(CommandQueue queue1, CommandQueue queue2);
+	bool onSameDevice(CommandQueue queue, Element e);
+	bool onSameDevice(Element e1, Element e2);
+
+	bool isDeclarable(Element e);
+
+	bool isArgument(Element e);
+
+	/// adds \p e either to \p arguments or to \p localDeclarations
+	void addElementToKernelSource(Element e,
+	                              std::vector<Element> & arguments,
+			                      std::vector<Element> & localDeclarations);
+	
+	template <typename T> const std::string& typeToStr();
+	template <typename T> inline const std::string typeToStr(unsigned int i);
+
+	template <typename T> inline constexpr const TypeID typeToTypeID();
+	
+// ------------------------Implementation ---------------
+
+	inline bool compatibleSizes(unsigned int s1, unsigned int s2)
+	{
+		return (s1 == s2 || (s1 * s2) == 0);
+	}
+
+	template <> inline constexpr const TypeID typeToTypeID<cl_double>()
+	{
+		return TYPE_DOUBLE;
+	}
+
+	template <> inline constexpr const TypeID typeToTypeID<cl_float>()
+	{
+		return TYPE_FLOAT;
+	}
+
+	template <> inline constexpr const TypeID typeToTypeID<cl_int>()
+	{
+		return TYPE_INT;
+	}
+
+	template <> inline constexpr const TypeID typeToTypeID<cl_uint>()
+	{
+		return TYPE_UINT;
+	}
+
+	template <> inline constexpr const TypeID typeToTypeID<cl_long>()
+	{
+		return TYPE_LONG;
+	}
+		
+	template <typename T> inline const std::string typeToStr(unsigned int i)
+	{
+		if (i == 1)
+			return typeToStr<T>();
+		else
+			return typeToStr<T>() + asl::numToStr(i);		
+	}
+	
+	
+} // namespace acl
+#endif // ACLUTILITIES_H
diff --git a/src/aslDataInc.cxx b/src/aslDataInc.cxx
new file mode 100644
index 0000000..85cf0f5
--- /dev/null
+++ b/src/aslDataInc.cxx
@@ -0,0 +1,43 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "data/aslDataWrapper.h"
+#include "acl/aclUtilities.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+
+
+namespace asl
+{
+
+	void initData(SPAbstractData d, double a)
+	{
+		acl::initData(d->getEContainer(), acl::generateVEConstant(a));
+	}
+
+	void initData(SPAbstractData d, const AVec<> & a)
+	{
+		acl::initData(d->getEContainer(), acl::generateVEConstant(a));
+	}
+	
+} // namespace asl
diff --git a/src/aslDataInc.h b/src/aslDataInc.h
new file mode 100644
index 0000000..f8a6ad9
--- /dev/null
+++ b/src/aslDataInc.h
@@ -0,0 +1,42 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDATAINC_H
+#define ASLDATAINC_H
+
+#include"aslGenerators.h"
+#include"data/aslDataWithGhostNodes.h"
+
+namespace asl
+{
+//	class AbstractData;
+//	typedef shared_ptr<AbstractData> SPAbstractData;
+	template <typename T> class AVec;
+	
+	void initData(SPAbstractData d, double a);
+	void initData(SPAbstractData d, const AVec<double> & a);
+
+	
+}
+
+#endif // ASLDATAINC_H
diff --git a/src/aslGenerators.cxx b/src/aslGenerators.cxx
new file mode 100644
index 0000000..2a3cbe1
--- /dev/null
+++ b/src/aslGenerators.cxx
@@ -0,0 +1,158 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslGenerators.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclMathAlg.h"
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/aclHardware.h"
+
+#include "acl/aclTypesList.h"
+
+
+namespace asl
+{
+
+	SPDataWrapperACL generateDataContainer_SP(const Block &b, const acl::VectorOfElements & a)
+	{
+		auto aa(std::make_shared<DataWrapperACL>(b));
+		aa->setContainer (a);
+		return aa;
+	}
+	
+	SPDataWithGhostNodesACL generateDataContainer_SP(const Block &b, const acl::VectorOfElements & a, unsigned int gN)
+	{
+		auto aa(std::make_shared<DataWithGhostNodesACL>(b,gN));
+		aa->setContainer (a);
+		return aa;
+	}
+
+	SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b, 
+	                                                        acl::TypeID t, 
+	                                                        unsigned int n, 
+	                                                        unsigned int gN,
+	                                                        acl::CommandQueue queue)
+	{
+		auto a(std::make_shared<DataWithGhostNodesACLData>(b,gN));
+		a->setContainer(acl::generateVEData(productOfElements(a->getBlock().getSize()),
+		                                    t,
+		                                    n,
+		                                    queue
+		                                    ));
+		return a;
+	}
+
+	SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b, 
+	                                                        acl::TypeID t, 
+	                                                        unsigned int n, 
+	                                                        unsigned int gN)
+	{
+		return generateDataContainerACL_SP(b, t, n, gN, acl::hardware.defaultQueue);
+	}
+	
+
+	SPAbstractDataWithGhostNodes generateDCFullSafe(SPAbstractDataWithGhostNodes d)
+	{
+		auto & b(d->getBlock());
+
+		auto a(std::make_shared<DataWithGhostNodesACL>(b,0));
+		a->setContainer(acl::generateVEOutOfBoundarySafe(d->getEContainer()));
+		
+		return a;
+	}
+
+	SPAbstractDataWithGhostNodes generateDCFullSafe(SPAbstractDataWithGhostNodes d, double outVal)
+	{
+		auto & b(d->getBlock());
+
+		auto a(std::make_shared<DataWithGhostNodesACL>(b,0));
+		a->setContainer(acl::generateVEOutOfBoundarySafe(d->getEContainer(), 
+		                                                 acl::generateVEConstant(outVal)));
+		
+		return a;
+	}
+
+	template <typename T> SPDataWrapperACLData 
+		generateDataContainerACL_SP(const Block &b, unsigned int n)
+	{
+		auto a(std::make_shared<DataWrapperACLData>(b));
+		a->setContainer(acl::generateVEData<T>(productOfElements(b.getSize()),n));
+		return a;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template SPDataWrapperACLData generateDataContainerACL_SP<t>(const Block &b, unsigned int n);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	template <typename T> SPDataWithGhostNodesACLData 
+		generateDataContainerACL_SP(const Block &b,
+		                            unsigned int n, 
+	                                unsigned int gN,
+	                                acl::CommandQueue queue)
+	{
+		auto a(std::make_shared<DataWithGhostNodesACLData>(b,gN));
+		a->setContainer(acl::VectorOfElementsData(n,
+		                                          productOfElements(a->getBlock().getSize()),
+		                                          T(0), 
+		                                          queue));
+		return a;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template SPDataWithGhostNodesACLData generateDataContainerACL_SP<t>(const Block &b, unsigned int n, unsigned int gN, acl::CommandQueue queue);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> SPDataWithGhostNodesACLData 
+		generateDataContainerACL_SP(const Block &b,
+		                            unsigned int n, 
+	                                unsigned int gN)
+	{
+		return generateDataContainerACL_SP<T>(b, n, gN, acl::hardware.defaultQueue);
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template SPDataWithGhostNodesACLData generateDataContainerACL_SP<t>(const Block &b, unsigned int n, unsigned int gN);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+		
+	template <typename T> SPDataWithGhostNodesACL 
+		generateDataContainerConst_SP(const Block &b,T a, unsigned int gN)
+	{
+		auto aa(std::make_shared<DataWithGhostNodesACL>(b,gN));
+		aa->setContainer(acl::generateVEConstant(a));
+		return aa;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template SPDataWithGhostNodesACL generateDataContainerConst_SP(const Block &b,t a, unsigned int gN);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template SPDataWithGhostNodesACL generateDataContainerConst_SP(const Block &b, AVec<t> a, unsigned int gN);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	
+} // namespace asl
diff --git a/src/aslGenerators.h b/src/aslGenerators.h
new file mode 100644
index 0000000..de1eb86
--- /dev/null
+++ b/src/aslGenerators.h
@@ -0,0 +1,129 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLGENERATORS_H
+#define ASLGENERATORS_H
+
+#include<memory>
+//#include<acl/aclHardware.h>
+#include<acl/aclTypes.h>
+
+namespace cl
+{
+	class CommandQueue;
+}
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;	
+}
+
+namespace asl
+{
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
+	typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	template <typename V> class DataWrapper;
+	typedef DataWrapper<acl::VectorOfElementsData> DataWrapperACLData;
+	typedef std::shared_ptr<DataWrapperACLData> SPDataWrapperACLData;
+	typedef DataWrapper<acl::VectorOfElements> DataWrapperACL;
+	typedef std::shared_ptr<DataWrapperACL> SPDataWrapperACL;
+	class Block;
+
+	
+	/// generates pointer to ACL Data field with \p n components	
+	/**
+		 \ingroup DataFields
+	*/
+	template <typename T> SPDataWrapperACLData generateDataContainerACL_SP(const Block &b,
+	                                                                       unsigned int n = 1);
+
+	/// generates pointer to ACL Data field with \p n components and \p gN ghost nodes
+	/**
+		 \ingroup DataFields
+	*/
+	template <typename T> SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b,
+	                                                                              unsigned int n,
+	                                                                              unsigned int gN);
+
+	/// generates pointer to ACL Data field with \p n components and \p gN ghost nodes
+	/**
+		 \ingroup DataFields
+	*/
+	template <typename T> SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b,
+	                                                                              unsigned int n,
+	                                                                              unsigned int gN,
+	                                                                              acl::CommandQueue queue);
+	
+	/// generates pointer to ACL Data field with \p n components of type \p t and \p gN ghost nodes
+	/**
+		 \ingroup DataFields
+	*/
+	SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b, 
+	                                                        acl::TypeID t,
+	                                                        unsigned int n, 
+	                                                        unsigned int gN, 
+	                                                        acl::CommandQueue queue);
+
+	/// generates pointer to ACL Data field with \p n components of type \p t and \p gN ghost nodes
+	/**
+		 \ingroup DataFields
+	*/
+	SPDataWithGhostNodesACLData generateDataContainerACL_SP(const Block &b, 
+	                                                        acl::TypeID t,
+	                                                        unsigned int n, 
+	                                                        unsigned int gN);
+	
+	///	 \ingroup DataFields
+	SPDataWrapperACL generateDataContainer_SP(const Block &b, const acl::VectorOfElements & a);	
+	
+	/// generates pointer to ACL Data field with container \p a and \p gN ghost nodes
+	/**
+		 \ingroup DataFields
+	*/
+	SPDataWithGhostNodesACL generateDataContainer_SP(const Block &b, 
+	                                                 const acl::VectorOfElements & a, 
+	                                                 unsigned int gN);
+
+	
+	///	 \ingroup DataFields
+	template <typename T> SPDataWithGhostNodesACL generateDataContainerConst_SP(const Block &b, T a, unsigned int gN);	
+
+	/// generates data container without ghost nodes and safe outOfboundary element acces \ingroup DataFields
+	SPAbstractDataWithGhostNodes generateDCFullSafe(SPAbstractDataWithGhostNodes d);
+
+	/// generates data container without ghost nodes and safe outOfboundary element acces \ingroup DataFields
+	SPAbstractDataWithGhostNodes generateDCFullSafe(SPAbstractDataWithGhostNodes d, double outVal);
+	
+	
+
+	
+}  //namespace acl
+
+#endif // ASLGenerator_H
diff --git a/src/aslGeomInc.cxx b/src/aslGeomInc.cxx
new file mode 100644
index 0000000..5750665
--- /dev/null
+++ b/src/aslGeomInc.cxx
@@ -0,0 +1,223 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslGeomInc.h"
+#include <math/aslDistanceFunction.h>
+#include "acl/aclMath/aclVectorOfElements.h"
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <data/aslBlocks.h>
+#include <aslGenerators.h>
+#include <math/aslIndex2Position.h>
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+#include <acl/Kernels/aclKernel.h>
+#include <data/aslDataWithGhostNodes.h>
+
+namespace asl
+{
+
+	SPDistanceFunction operator&(SPDistanceFunction a, SPDistanceFunction b)
+	{
+		if ((a.get() == 0) && (b.get() == 0))
+			errorMessage("DistanceFunction::operator& - both operands are not initialized");
+
+		if (a.get() == 0)
+			return b;
+
+		if (b.get() == 0)
+			return a;
+		
+		return SPDistanceFunction(new DistFOperationAnd(a, b));
+	}
+	
+	
+	SPDistanceFunction operator|(SPDistanceFunction a, SPDistanceFunction b)
+	{
+		if ((a.get() == 0) && (b.get() == 0))
+			errorMessage("DistanceFunction::operator| - both operands are not initialized");
+
+		if (a.get() == 0)
+			return b;
+
+		if (b.get() == 0)
+			return a;
+
+		return SPDistanceFunction(new DistFOperationOr(a, b));
+	}
+
+	
+	SPDistanceFunction operator-(SPDistanceFunction a)
+	{
+		if (a.get() == 0)
+			errorMessage("DistanceFunction::operator- - operand is not initialized");
+
+		return SPDistanceFunction(new DistFOperationInversion(a));
+	}
+
+
+	SPDistanceFunction normalize(SPDistanceFunction a, double dx)
+	{
+		if (a.get() == 0)
+			errorMessage("DistanceFunction::normalize - argument is not initialized");
+
+		return SPDistanceFunction(new DistFNormalization(a, dx));
+	}
+	
+	SPDistanceFunction generateDFSphere(double r, const AVec<double> & c)
+	{
+		return SPDistanceFunction(new DistFSphere(r,c));
+	}
+
+	SPDistanceFunction generateDFCylinderInf(double r, 
+	                                      const AVec<double> & l, 
+	                                      const AVec<double> & c)
+	{
+		return SPDistanceFunction(new DistFCylinder(r, l, c));
+	}
+
+	SPDistanceFunction generateDFCylinder(double r, 
+	                                      const AVec<double> & l, 
+	                                      const AVec<double> & c)
+	{
+		auto cyl(generateDFCylinderInf(r, l, c));
+		auto p1(generateDFPlane(l, c + l * .5));
+		auto p2(generateDFPlane(-l, c - l * .5));
+		return cyl & p1 & p2;
+	}
+
+	SPDistanceFunction generateDFCone(double r, 
+	                                  const AVec<double> & l, 
+	                                  const AVec<double> & a)
+	{
+		auto cone(SPDistanceFunction(new DistFCone(r/sqrt(l2(l)), l, a)));
+		auto p1(generateDFPlane(l, a + l));
+		auto p2(generateDFPlane(-l, a));
+		return cone & p1 & p2;
+	}
+		
+	SPDistanceFunction generateDFPlane(const AVec<double> & n, const AVec<double> & p0)
+	{
+		return SPDistanceFunction(new DistFPlane(n,p0));
+	}
+		
+	SPDistanceFunction generateDFConvexPolygonPrism(vector<AVec<double>> points)
+	{
+		AVec<double> center(points[0]);
+		for(unsigned int i(1); i < points.size(); ++i)
+			center+=points[i];
+		center = center / double(points.size());
+
+		auto axis(crossProduct(points[0]-center, points[1]-center));
+
+		
+		auto res(generateDFPlane(crossProduct(points[1]-points[0], axis),
+		                         points[0]));
+		for(unsigned int i(1); i < points.size(); ++i)
+			res = res & generateDFPlane(crossProduct(points[(i+1) % points.size()]-points[i], axis),
+			                            points[i]);
+		return res;
+	}
+
+	SPDistanceFunction generateDFConvexPolygonPyramid(vector<AVec<double>> points, 
+	                                                AVec<double> a)
+	{
+		AVec<double> center(points[0]);
+		for(unsigned int i(1); i < points.size(); ++i)
+			center+=points[i];
+		center = center / double(points.size());
+
+		auto axis(crossProduct(points[0]-center, points[1]-center));
+
+		
+		auto res(generateDFPlane(crossProduct(points[1]-points[0], a - points[0]),
+		                         points[0]));
+		for(unsigned int i(1); i < points.size(); ++i)
+			res = res & generateDFPlane(crossProduct(points[(i+1) % points.size()]-points[i], 
+			                                         a - points[i]),
+			                            points[i]);
+		res = res & generateDFPlane(-axis,center);
+		return res;
+	}
+		
+	SPDistanceFunction generateDFInBlock(const Block & b, unsigned int nG)	
+	{
+		unsigned int nd(nD(b));
+		AVec<> n(nd, 0.);
+
+		AVec<> nc(n);
+		nc[0] = 1.;
+		AVec<> offs(nd, (double(nG) - .5) * b.dx);
+		AVec<> p0(b.position + offs);
+		AVec<> pE(b.getBPosition() - offs);
+		auto res(generateDFPlane(nc, p0) | generateDFPlane(-nc, pE));
+		if(nd >= 2 )
+		{
+			nc = n; nc[1] = 1;
+			res = res | generateDFPlane(nc, p0) | generateDFPlane(-nc, pE);
+		}
+		if(nd >= 3 )
+		{
+			nc = n; nc[2] = 1;
+			res = res | generateDFPlane(nc, p0) | generateDFPlane(-nc, pE);
+		}
+		
+		return res;
+	}
+
+	SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b, 
+	                                                      SPDistanceFunction df, 
+							      unsigned int gN,
+	                                                      acl::TypeID t)
+	{
+		asl::Index2PositionACL i2p(offset(b, gN), t);
+
+		return generateDataContainer_SP(b, df->getDistance(i2p.positionWithInit), gN);
+	}
+
+
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPDistanceFunction f)
+	{		
+		initData(d, f, acl::KERNEL_SIMD);
+	}
+		
+
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPDistanceFunction f, 
+	              const acl::KernelConfiguration & kernelConfig)
+	{
+		if (f.get() == 0)
+			errorMessage("DistanceFunction::initData - argument is not initialized");
+
+		auto type(getElementType(d->getEContainer()));
+		asl::Index2PositionACL i2p(d->getBlock(),type);
+
+		acl::Kernel k(kernelConfig);
+		k << i2p.initPosition;
+		k << acl::assignmentSafe(d->getEContainer(), f->getDistance(i2p.position));
+		k.setup();
+		k.compute();
+	}
+		
+		
+} // asl
diff --git a/src/aslGeomInc.h b/src/aslGeomInc.h
new file mode 100644
index 0000000..f7d2e69
--- /dev/null
+++ b/src/aslGeomInc.h
@@ -0,0 +1,154 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLGEOMINC_H
+#define ASLGEOMINC_H
+
+#include<memory>
+#include<vector>
+#include<acl/aclHardware.h>
+
+namespace acl
+{
+	class KernelConfiguration;
+}
+
+namespace asl {
+
+	template <typename T> class AVec;
+	class Block;
+
+	class AbstractDataWithGhostNodes; 
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	class DistanceFunction;
+	typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;
+
+	
+	
+	///generates sphere \ingroup Geom
+	/**
+	 \param r radius
+	 \param c center
+	 */
+	SPDistanceFunction generateDFSphere(double r, const AVec<double> & c);
+
+
+	///generates infinite cylinder \ingroup Geom
+	/**
+	 \param r radius
+	 \param l orientation
+	 \param c center
+	 */
+	SPDistanceFunction generateDFCylinderInf(double r, 
+	                                      const AVec<double> & l, 
+	                                      const AVec<double> & c);
+
+	///generates cylinder \ingroup Geom
+	/**
+	 \param r radius
+	 \param l orientation and length
+	 \param c center
+	 */
+	SPDistanceFunction generateDFCylinder(double r, 
+	                                      const AVec<double> & l, 
+	                                      const AVec<double> & c);
+	
+	///generates cone \ingroup Geom
+	/**
+	 \param r radius
+	 \param l orientation and length, from apex to base
+	 \param a apex
+	 */
+	SPDistanceFunction generateDFCone(double r, 
+	                                  const AVec<double> & l, 
+	                                  const AVec<double> & a);
+
+	/// generates a plane \ingroup Geom
+	/// \param n vector orthogonal to the plane
+	/// \param p0 point on the plane
+	SPDistanceFunction generateDFPlane(const AVec<double> & n,
+	                                   const AVec<double> & p0);
+
+
+	/// generates infinite prism with convex polygon at its base \ingroup Geom
+	/**
+		 \param points list of points in 3D space. 
+
+		 The prism axis is oriented orthogonal to the plane of the triangle defined by 
+		 a center and first two points. Points of the base polygon must
+		 be provided in continuous manner.
+	*/
+	SPDistanceFunction generateDFConvexPolygonPrism(std::vector<AVec<double>> points);
+
+
+	///generates pyramid with convex polygon at its base and apex \p a \ingroup Geom
+	/**
+		 \param points list of points in 3D space. 
+
+		 the pyramid base plane is defined by a center and fist two points
+		 the points should be ordered counter clock rotation for an observer placed in \p a
+	*/
+	SPDistanceFunction generateDFConvexPolygonPyramid(std::vector<AVec<double>> points, 
+	                                                  AVec<double> a);
+	
+
+	/// generates map corresponding to external (ghost) part of the block \ingroup Geom
+	SPDistanceFunction generateDFInBlock(const Block & b, unsigned int nG);
+
+
+	/// \ingroup Geom
+	/**
+		If both operands are not initialized - it leads to an error. 
+	    If only one operand is not initialized - it is ignored and the second is returned.
+	*/
+	SPDistanceFunction operator&(SPDistanceFunction a, SPDistanceFunction b);
+	/// \ingroup Geom
+	/**
+	 If both operands are not initialized - it leads to an error. 
+	 If only one operand is not initialized - it is ignored and the second is returned.
+	*/
+	SPDistanceFunction operator|(SPDistanceFunction a, SPDistanceFunction b);
+	/// \ingroup Geom
+	SPDistanceFunction operator-(SPDistanceFunction a);
+	/// \ingroup Geom
+	SPDistanceFunction normalize(SPDistanceFunction a, double dx);
+
+	/// \ingroup Geom
+	SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b, 
+	                                                      SPDistanceFunction df, 
+	                                                      unsigned int gN,
+	                                                      acl::TypeID t);
+	
+
+	/// Initialize \p d by \p f
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPDistanceFunction f);
+	/// Initialize \p d by \p f
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPDistanceFunction f, 
+	              const acl::KernelConfiguration & k);
+	
+} // asl
+
+#endif // ASLDISTANCEFUNCTION
diff --git a/src/aslUtilities.cxx b/src/aslUtilities.cxx
new file mode 100644
index 0000000..690151b
--- /dev/null
+++ b/src/aslUtilities.cxx
@@ -0,0 +1,123 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslUtilities.h"
+#include <acl/aclUtilities.h>
+
+using namespace std;
+
+namespace asl
+{
+
+	template <typename T> T strToNum(string s)
+	{
+		istringstream i(s);
+		T x;
+		int decimal(0);
+		char c;
+
+		if (!(i >> x))
+			errorMessage("strToNum() - unable to convert " + s + " to " + acl::typeToStr<T>());
+
+		if (i.get(c))
+			warningMessage("strToNum() - " + s + " contains character");
+ 
+		if (acl::typeToTypeID<T>() == acl::TYPE_INT)
+		{
+			i >> decimal;
+			if (decimal != 0)
+				warningMessage("strToNum() - " + s + " is not an integer");
+		}
+
+		return x;
+	}
+
+
+	template cl_int strToNum<cl_int>(string s);
+	template cl_uint strToNum<cl_uint>(string s);
+	template cl_long strToNum<cl_long>(string s);
+	template cl_float strToNum<cl_float>(string s);
+	template cl_double strToNum<cl_double>(string s);
+
+
+	void errorMessage(cl_int status, const char *errorMessage)
+	{
+		if (status != CL_SUCCESS)
+		{
+			cerr << "ASL ERROR: " << errorMessage << " (" << status << ")." << endl;
+			exit(EXIT_FAILURE);
+		}
+	}
+
+
+	void errorMessage(cl_int status, const string &errorMessage)
+	{
+		if (status != CL_SUCCESS)
+		{
+			cerr << "ASL ERROR: " << errorMessage << " (" << status << ")." << endl;
+			exit(EXIT_FAILURE);
+		}
+	}
+	
+
+	void errorMessage(const char *errorMessage)
+	{
+		cerr << "ASL ERROR: " << errorMessage << "." << endl;
+		exit(EXIT_FAILURE);
+	}
+
+
+	void errorMessage(const string & errorMessage)
+	{
+		cerr << "ASL ERROR: " << errorMessage << "." << endl;
+		exit(EXIT_FAILURE);
+	}
+
+
+	void errorMessage(bool status)
+	{
+		if (status)
+			cout << " Ok" << endl;
+		else
+			cerr << " ERROR" << endl;
+	}
+
+	
+	void warningMessage(const char *warningMessage)
+	{
+		cout << "ASL WARNING: " << warningMessage << "." << endl;
+	}
+
+
+	void warningMessage(const string & warningMessage)
+	{
+		cout << "ASL WARNING: " << warningMessage << "." << endl;
+	}
+
+	
+	string warningString(const char *warningMessage)
+	{
+		return string("ASL WARNING: ") + warningMessage + ".";
+	}
+
+} // asl namespace
diff --git a/src/aslUtilities.h b/src/aslUtilities.h
new file mode 100644
index 0000000..e193115
--- /dev/null
+++ b/src/aslUtilities.h
@@ -0,0 +1,259 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslUtilities.h useful common utilities
+
+#ifndef ASLUTILITIES_H
+#define ASLUTILITIES_H
+
+#include <acl/aclStdIncludes.h>
+#include <CL/cl.hpp>
+#include <math.h>
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+#include <vector>
+#include <memory>
+#include <list>
+#include <typeinfo>
+
+/// Advanced Simulation Library
+namespace asl
+{
+	
+	/// Converts numbers or an other type to string \ingroup Utilities
+	template <typename T> inline std::string numToStr(T i)
+	{
+		std::stringstream s;
+		s << i;
+		return s.str();
+	}
+
+
+	/// Converts numbers or an other type to string with given value of positions with 0 before \ingroup Utilities
+	template <typename T> std::string numToStr(T i, int numberOf0)
+	{
+		std::stringstream s;
+		s << std::setfill('0') << std::setw(numberOf0) << i;
+		return s.str();
+	}
+
+
+	/// Converts string to number, exits if not able to convert
+	template <typename T> T strToNum(std::string s);
+	
+	/// This class is used in order to overload function according to an integer parameter
+	template <int I>class I2T{public: static const int i = I;};
+
+	/// Realization of \f$ a^I \f$ 
+	template <int I> inline const double P(const double& a){return P<I-1>(a)*a;}
+	template <int I> inline const float P(const float& a){return P<I-1>(a)*a;}
+	template <int I> inline const int P(const int& a){return P<I-1>(a)*a;}	
+
+	/// \cond NEVER
+	template <> inline const double P<1>(const double& a){return a;}
+	template <> inline const float P<1>(const float& a){return a;}
+	template <> inline const int P<1>(const int& a){return a;}	
+	/// \endcond
+
+
+	/// Checks the belonging to a closed interval [x1,x2], \f$ xx \in [x1,x2] \f$ 
+	template <typename T> inline  bool in(const T& xx, const T& x1, const T& x2)
+	{
+		return (((x1-xx)*(x2-xx))<=0);
+	}
+
+	/// Checks the belonging to an open interval (x1,x2), \f$ xx \in (x1,x2) \f$
+	template <typename T> inline  bool inO(const T& xx, const T& x1, const T& x2)
+	{
+		return (((x1 - xx) * (x2 - xx)) < 0);
+	}
+
+	static const double pi=4.*atan(1.); ///<\f$\pi\f$	
+
+	/// Translation radians to degrees
+	inline const double deg(double a){return a/pi*180.;}
+	inline const float deg(float a){return a/pi*180.;}	
+	/// Translation degrees to radians
+	inline const double rad(double a){return a*pi/180.;}
+	inline const float rad(float a){return a*pi/180.;}	
+
+	/// Approximately equal; the precision is defined as \p p_
+	inline const bool approxEqual(const double &a, const double &b, const double p_ = 1e-6)
+	{
+		return fabs(a-b) < p_ * fabs(a) && fabs(a-b) < p_ * fabs(b);
+	}
+	
+	inline const bool approxEqual(const float &a, const float &b, const float p_ = 1e-6)
+	{
+		return fabs(a - b) < p_ * fabs(a) && fabs(a - b) < p_ * fabs(b);
+	}
+
+
+	/// Prints errorMessage and exits depending on the status \ingroup ErrorMessaging
+	void errorMessage(cl_int status, const char *errorMessage);
+
+	/// Prints errorMessage and exits depending on the status \ingroup ErrorMessaging
+	void errorMessage(cl_int status, const std::string  & errorMessage);
+	
+	/// Prints " Ok" or " ERROR" depending on status \ingroup ErrorMessaging
+	void errorMessage(bool status);
+
+	/// Prints errorMessage and exits \ingroup ErrorMessaging
+	void errorMessage(const char *errorMessage);
+
+	/// Prints errorMessage and exits \ingroup ErrorMessaging
+	void errorMessage(const std::string & errorMessage);
+
+
+	/// Prints warningMessage \ingroup ErrorMessaging
+	void warningMessage(const char *warningMessage);
+	
+
+	/// Prints warningMessage \ingroup ErrorMessaging
+	void warningMessage(const std::string & warningMessage);
+	
+
+	/// Returns warningMessage \ingroup ErrorMessaging
+	std::string warningString(const char *warningMessage);
+
+
+	/// Prints elements of the vector separated by space
+	template <typename T> std::ostream & operator<<(std::ostream & output, 
+	                                                const std::vector<T> & vector);
+
+
+	/// Compares two vectors
+	template <typename T> bool operator==(const std::vector<T> & vector1, 
+	                                      const std::vector<T> & vector2);
+
+	
+	/// Makes output 1  of \p n times 
+	template <class T, int N> inline void output1OfN(const std::string &s);
+
+
+	template <class T>inline void setupAll(std::vector<std::shared_ptr<T> > & v);
+
+
+	template <class T>inline void computeAll(std::vector<std::shared_ptr<T> > & v);
+
+	/// sorts two vectors with respect of the fist one
+	template <class T1, class T2> inline void sortTwoVectors(std::vector<T1> & v1, std::vector<T2> & v2);
+
+	/// reorders vector according to indeces
+	template <class T> inline void reorderVector(std::vector<unsigned int> & ind, std::vector<T> & v);
+
+	
+//---------------------------- Implementations ----------------------------
+
+	/// Prints elements of the vector separated by space
+	template <typename T> std::ostream & operator<<(std::ostream & output, const std::vector<T> & vector)
+	{
+		typename std::vector<T>::const_iterator iter;
+
+		for (iter = vector.begin(); iter != vector.end(); ++iter)
+			output << *iter << " ";
+		output << std::endl;
+		return output;
+	}
+
+
+	/// compares two vectors
+	template <typename T> bool operator==(const std::vector<T> & vector1, 
+	                                      const std::vector<T> & vector2)
+	{
+		if (vector1.size() != vector2.size())
+			return false;
+
+		bool equal = false;
+		unsigned int i = 0;
+
+		do
+		{
+			equal = (vector1[i] == vector2[i]);
+			++i;
+		} while ((i < vector1.size()) && equal);
+		
+		return equal;
+	}
+
+
+	template <class T, int N> inline void output1OfN(const std::string &s)
+	{
+		static int i(0);
+		if (!(i % N))
+			std::cout << s << std::endl;		
+		++i;
+	}
+
+	template <class T> void setupAll(std::vector<std::shared_ptr<T> > &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->setup();
+	}
+
+	template <class T> void computeAll(std::vector<std::shared_ptr<T> > &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->compute();
+	}
+
+	template <typename T1> class comparatorIndeces {
+		private:
+			std::vector<T1> & v1;
+		public:	
+			comparatorIndeces(std::vector<T1> & v): v1(v){}	
+			inline bool operator()(unsigned int i, unsigned int j) {return v1[i]<v1[j];}
+	};
+	
+	template <typename T1, typename T2> inline void sortTwoVectors(std::vector<T1> & v1, std::vector<T2> & v2)
+	{
+		if(v1.size()!=v2.size())
+			errorMessage("sortTwoVectors: the vectors have different sizes");
+		
+		// creates index vector
+		std::vector<unsigned int> ind(v1.size());
+		for(unsigned int i(0); i<v1.size(); ++i) 
+			ind[i]=i;
+		
+		sort(ind.begin(), ind.end(), comparatorIndeces<T1>(v1));
+		reorderVector(ind,v1);
+		reorderVector(ind,v2);
+	}
+
+	template <class T> inline void reorderVector(std::vector<unsigned int> & ind, std::vector<T> & v)
+	{
+		if(ind.size()!=v.size())
+			errorMessage("reorderVector: the vectors have different sizes");
+
+		unsigned int n(v.size());
+		std::vector<T> nContainer(n);
+		for(unsigned int i(0); i<n; ++i)
+			nContainer[i]=v[ind[i]];
+		v.swap(nContainer);
+	}
+	
+	
+} // asl namespace
+
+#endif // ASLUTILITIES_H
diff --git a/src/data/CMakeLists.txt b/src/data/CMakeLists.txt
new file mode 100644
index 0000000..5737c14
--- /dev/null
+++ b/src/data/CMakeLists.txt
@@ -0,0 +1,26 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+# asldata
+
+set(asldata_PUBLIC_HEADERS
+	aslMemElement.h
+	aslDataUtilities.h
+	aslBlocks.h
+	aslDataWrapper.h
+	aslDataWithGhostNodes.h
+	aslProbe.h
+)
+
+set(asldata_SOURCES
+	${asldata_PUBLIC_HEADERS}
+	aslMemElement.cxx
+	aslDataUtilities.cxx
+	aslBlocks.cxx
+	aslDataWrapper.cxx
+	aslDataWithGhostNodes.cxx
+	aslProbe.cxx
+)
+
+add_library(asldata ${asldata_SOURCES})
+INSTALL_SUBLIB(asldata asldata_PUBLIC_HEADERS)
diff --git a/src/data/aslBlocks.cxx b/src/data/aslBlocks.cxx
new file mode 100644
index 0000000..58ac300
--- /dev/null
+++ b/src/data/aslBlocks.cxx
@@ -0,0 +1,39 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslBlocks.h"
+
+namespace asl{
+	
+	const Block offset(const Block & bl, int a)
+	{
+		if (minComponent(bl.getSize())<-a*2) 
+			errorMessage("The inset is larger than the block size");
+		Block b(bl.getSize().getSize());
+		b.position=bl.position-Block::V(bl.getSize().getSize(),a*bl.dx);
+		b.setSize(bl.getSize()+Block::DV(b.getSize().getSize(),a*2));
+		b.dx=bl.dx;
+		return b;
+	}
+
+}// asl
diff --git a/src/data/aslBlocks.h b/src/data/aslBlocks.h
new file mode 100644
index 0000000..7473f57
--- /dev/null
+++ b/src/data/aslBlocks.h
@@ -0,0 +1,240 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLBLOCKS_H
+#define ASLBLOCKS_H
+
+#include <iostream>
+#include <fstream>
+#include "../math/aslVectors.h"
+
+namespace acl
+{
+	class VectorOfElements;
+}
+
+namespace asl
+{
+
+	/// The block without discretization (size and position are float)
+	class Box
+	{
+		public:
+			typedef AVec<> V; ///< Type of a vector
+			V size;
+			V position;
+
+			/// the size and position are taken 0
+			inline explicit Box(unsigned int nd);
+	};
+	
+	
+	/// Simple block with position
+	/// \ingroup DataFields 
+	/// The Block describes the simulation grid
+	/// and is defined by the position and by the size.
+	class Block
+	{
+		public:
+			typedef AVec<int> DV; ///<Discrete Vector
+		private:	
+			DV size;		
+		public:
+			typedef AVec<> V; ///<Type of the position
+
+			V position;
+			double dx;
+			DV c2iTransformVector;
+
+			/// the size is taken 1, the position is taken to be 0
+			inline Block();
+			inline explicit Block(unsigned int nd);
+			inline Block(const DV & s, double dx, const V & p);
+			inline explicit Block(const DV & s, double dx = 1);
+			inline Block(const Block & b);	
+			inline const Block& operator=(const Block & b); 
+			/// defines convertion rule of 1D/2D/3D index \p i into container one
+			int c2i(const Block::DV & c) const;
+			inline void setSize(const DV & s);
+			inline const DV & getSize() const;
+			/// returns position of the point diagonal to (0) one
+			/// returns Body Diagonal (or space diagonal) that starts at (0)
+			inline const V getBPosition() const;
+			acl::VectorOfElements initACLPositionDiscrete();
+			acl::VectorOfElements initACLPosition();
+
+			acl::VectorOfElements getACLPositionDiscrete();
+			acl::VectorOfElements getACLPosition();
+	};
+
+
+	/// results Block which is inset or outset of the \p bl on value of a
+	/// \ingroup DataFields
+	const Block offset(const Block & bl, int a = 1);
+
+
+	/// Dimensionality of the block \ingroup DataFields
+	/// \todo rename here and everywhere to dimNum???
+	inline const unsigned int nD(const Block & b);
+
+	/// Checks whether \p a inside of \p b
+	/// \ingroup DataFields
+	inline const bool in(const Block & b, AVec<> a);
+
+	/// Checks whether \p a inside of \p b
+	/// \ingroup DataFields
+	inline const bool in(const Block & b, AVec<int> a);
+
+	
+	inline const AVec<int> continiousToDiscret(const Block & b, AVec<> a);
+
+	//--------------- Implementation----------------
+
+	inline Box::Box(unsigned int nd):size(nd),position(nd)
+	{
+	}	
+
+
+	inline AVec<int> castTransformVector(AVec<int> s)
+	{
+		unsigned int n(s.getSize());
+		AVec<int> r(n, 1);
+		int a(1);
+		for (unsigned int i = 0; i < n - 1; ++i)
+		{
+			a *= s[n - 1 - i];
+			r[n - 2 - i] = a;			
+		}
+		return r;
+	}
+	
+
+	inline Block::Block(unsigned int nd):
+		size(nd),
+		position(nd),
+		dx(1),
+		c2iTransformVector(castTransformVector(size))
+	{
+	}
+
+
+	inline Block::Block():
+		size(1),
+		position(1,0.),
+		dx(1),
+		c2iTransformVector(castTransformVector(size))
+	{
+	}
+	
+
+	inline Block::Block(const Block::DV & s, double d):
+		size(s),
+		position(V(s.getSize())),
+		dx(d),
+		c2iTransformVector(castTransformVector(s))
+	{
+	}
+
+
+	inline Block::Block(const Block::DV & s, double d, const Block::V & p):
+		size(s),
+		position(p),
+		dx(d),
+		c2iTransformVector(castTransformVector(s))			
+	{
+		if (p.getSize() != s.getSize())
+			errorMessage ("Block::Block() Size and Position dimensionalities are different");
+	}
+
+
+	inline Block::Block(const Block & b):
+		size(b.size),
+		position(b.position),
+		dx(b.dx),
+		c2iTransformVector(b.c2iTransformVector)		
+	{
+	}
+
+
+	inline const Block & Block::operator=(const Block & b)
+	{
+		position=b.position;
+		size = b.size;
+		dx = b.dx;
+		c2iTransformVector = b.c2iTransformVector;
+		return *this;
+	}
+
+
+	inline int Block::c2i(const DV & c) const
+	{
+		unsigned int n(c2iTransformVector.getSize());
+		if (c.getSize() != n) 
+			errorMessage("Block::c2i() - The input vector size does not correspond to the block dimensionality");
+		
+		return c * c2iTransformVector;
+	}
+		
+
+	inline void Block::setSize(const DV & s)
+	{
+		size = s;
+		if(position.getSize()!= s.getSize())
+			position=V(s.getSize());
+		c2iTransformVector = castTransformVector(s);
+	}
+
+
+	inline const Block::DV & Block::getSize() const
+	{
+		return size;
+	}
+
+
+	inline const Block::V Block::getBPosition() const
+	{
+		return position + (V(size - DV(size.getSize(), 1.)) ) * dx;
+	}
+
+
+	inline const unsigned int nD(const Block & b)
+	{
+		return b.position.getSize();
+	}
+		
+
+	inline const bool in(const Block & b, AVec<> a)
+	{
+		return positive(a-b.position) && positive(b.getBPosition() - a);   
+	}
+
+
+	inline const bool in(const Block & b, AVec<int> a)
+	{
+		return positive(a) && positive(b.getSize() - a);   
+	}
+				
+}	//asl
+
+#endif //ASLBLOCKS_H
+
diff --git a/src/data/aslDataUtilities.cxx b/src/data/aslDataUtilities.cxx
new file mode 100644
index 0000000..d24d1a6
--- /dev/null
+++ b/src/data/aslDataUtilities.cxx
@@ -0,0 +1,136 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDataUtilities.h"
+#include "aslGenerators.h"
+#include "acl/aclElementBase.h"
+#include "math/aslVectorsDynamicLengthOperations.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/DataTypes/aclIndex.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "acl/acl.h"
+#include "acl/Kernels/aclKernel.h"
+#include "math/aslIndex2Position.h"
+#include "acl/aclUtilities.h"
+#include "acl/Operators/aclElementIfElse.h"
+
+
+namespace asl
+{
+
+	void checkDimensionsNumCompatibility(AbstractData & source,
+	                                     const AVec<int> & size)
+	{
+		if (nD(source.getBlock()) !=  nD(size))
+			errorMessage("uploadToLocalMem() - dimensions mismatch");
+	}
+
+
+	void checkTessellability(AbstractData & source,
+	                         const AVec<int> & size)
+	{
+		const AVec<int> s(source.getBlock().getSize());
+		for (unsigned int i(0); i < nD(s); ++i)
+			if (s[i] % size[i] != 0)
+				errorMessage("uploadToLocalMem() - size of source is not evenly divisible by the block\'s size");
+	}
+	
+	
+	acl::VectorOfElements uploadToLocalMem(AbstractData & source,
+	                                       const AVec<int> & size,
+	                                       unsigned int groupSize,
+	                                       acl::Kernel & kernel)
+	{
+		checkDimensionsNumCompatibility(source,size);
+		checkTessellability(source, size);
+		
+		AVec<int> groupTableSize(divisionOfElements(source.getBlock().getSize(),
+		                                            size));
+
+		unsigned int totalPointsNum = productOfElements(size);
+		unsigned int uploadsPerWorkItem = totalPointsNum / groupSize;
+		unsigned int uploadsPerWorkItemRemainder = totalPointsNum % groupSize;
+
+		unsigned int componentsNum = source.getEContainer().size();
+		acl::VectorOfElements uploadedData(componentsNum);
+
+		copy(generateVELocalArray(totalPointsNum,
+		                          source.getEContainer()[0]->getTypeID(),
+		                          componentsNum),
+		     uploadedData);
+
+		Block localBlock(size);
+		Index2PositionDiscreteACL ind(localBlock, false);
+		Block groupTableBlock(groupTableSize);
+		Index2PositionDiscreteACL indGroup(groupTableBlock);
+
+		acl::VectorOfElements transformVec(acl::generateVEConstant(source.getBlock().c2iTransformVector));	
+
+		acl::VectorOfElements offset(productOfElements(acl::excerpt(indGroup.positionWithInit,
+		                                                            acl::generateVEGroupID()),
+		                                               acl::generateVEConstant(size)));
+
+		acl::VectorOfElements singleUpload(uploadedData = acl::excerpt(source.getEContainer(),
+		                                                               (ind.positionWithInit + offset) * transformVec));
+
+		acl::VectorOfElements index(acl::generateVEIndex(groupSize));
+
+		for (unsigned int i = 0; i < uploadsPerWorkItem; ++i)
+		{
+			kernel << (excerpt(singleUpload,
+			                   groupSize * i + index));
+		}
+
+		acl::Element uploadsPerWorkItemRem(new acl::Constant<cl_int>(uploadsPerWorkItemRemainder));
+		acl::Element indexRemainder(new acl::Index());
+
+		using namespace acl::elementOperators;
+		acl::Element ife(ifElse(indexRemainder < uploadsPerWorkItemRem,
+		                        excerpt(singleUpload,
+		                                groupSize * uploadsPerWorkItem + index),
+		                        {}));
+		kernel.addExpression(ife);
+
+		return uploadedData;
+	}
+
+	SPDataWrapperACL generateSubData(SPDataWrapperACL d, AVec<int> a, AVec<int> b)
+	{
+		const Block & bIn(d->getBlock());
+		unsigned int nd(nD(a));
+		Block bOut(b - a + AVec<int>(nd,1), bIn.dx, bIn.position+bIn.dx*AVec<>(a));
+
+		acl::VectorOfElements c(d->getEContainer().size());
+
+		Index2PositionDiscreteACL t2p(bOut);
+		acl::VectorOfElements newIndex((t2p.positionWithInit + a) *
+		                                bIn.c2iTransformVector);
+		
+		copy(acl::excerpt(d->getEContainer(), newIndex), c);		
+
+		return generateDataContainer_SP(bOut,c);
+	}
+
+
+} // namespace asl
diff --git a/src/data/aslDataUtilities.h b/src/data/aslDataUtilities.h
new file mode 100644
index 0000000..40b14e8
--- /dev/null
+++ b/src/data/aslDataUtilities.h
@@ -0,0 +1,58 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDATAUTILITIES_H
+#define ASLDATAUTILITIES_H
+
+#include "aslDataWrapper.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl
+{
+	class Kernel;
+}
+namespace asl
+{
+
+	/// Uploads \p source from global to local memory in portion
+	/// defined by \p size with group size \p groupSize.
+	/// Returns destination (local VectorOfElements).
+	/// \ingroup DataUtilities
+	acl::VectorOfElements uploadToLocalMem(AbstractData & source,
+	                                       const AVec<int> & size,
+	                                       unsigned int groupSize,
+	                                       acl::Kernel & kernel);
+
+	/// generates DataWraper with points placed inside a widow
+	/**
+		 \param a the point corresponding to 0 coner
+		 \param b the point corresponding to diagonal to 0 one coner
+		 \ingroup DataUtilities
+
+		 \todo errorMessages
+	*/
+	SPDataWrapperACL generateSubData(SPDataWrapperACL d, AVec<int> a, AVec<int> b);
+	
+}
+#endif // ASLDATAUTILITIES_H
+
diff --git a/src/data/aslDataWithGhostNodes.cxx b/src/data/aslDataWithGhostNodes.cxx
new file mode 100644
index 0000000..627b327
--- /dev/null
+++ b/src/data/aslDataWithGhostNodes.cxx
@@ -0,0 +1,71 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDataWithGhostNodes.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+
+namespace asl
+{
+
+	template<class V> acl::VectorOfElements DataWithGhostNodes<V>::getSubContainer ()
+	{
+		return acl::generateVESubElements(dw.getEContainer(),getSubContainerSize(),getSubContainerOffset());
+	}
+
+	template acl::VectorOfElements DataWithGhostNodesACLData::getSubContainer ();
+	template acl::VectorOfElements DataWithGhostNodesACL::getSubContainer ();
+
+	template<class V> const acl::VectorOfElements DataWithGhostNodes<V>::getEContainer ()
+	{
+		return dw.getEContainer();
+	}
+
+	template const acl::VectorOfElements DataWithGhostNodesACLData::getEContainer ();
+	template const acl::VectorOfElements DataWithGhostNodesACL::getEContainer ();
+
+	template<class V>const  acl::VectorOfElementsData DataWithGhostNodes<V>::getDContainer () const
+	{
+		return dw.getDContainer();
+	}
+
+	template const acl::VectorOfElementsData DataWithGhostNodesACLData::getDContainer () const;
+	template const acl::VectorOfElementsData DataWithGhostNodesACL::getDContainer () const;
+
+	SPDataWithGhostNodesACLData clone(SPDataWithGhostNodesACLData d)
+	{
+		auto newd(std::make_shared<DataWithGhostNodesACLData>(d->getInternalBlock(),
+		                                                      d->getGhostBorder()));
+		newd->setContainer(clone(d->getDContainer()));
+		return newd;
+	}
+
+	SPDataWithGhostNodesACLData clone(SPDataWithGhostNodesACLData d, unsigned int n)
+	{
+		auto newd(std::make_shared<DataWithGhostNodesACLData>(d->getInternalBlock(),
+		                                                      d->getGhostBorder()));
+		newd->setContainer(clone(d->getDContainer(), n));
+		return newd;
+	}
+	
+}// asl
diff --git a/src/data/aslDataWithGhostNodes.h b/src/data/aslDataWithGhostNodes.h
new file mode 100644
index 0000000..5e80dca
--- /dev/null
+++ b/src/data/aslDataWithGhostNodes.h
@@ -0,0 +1,171 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDATAWITHGHOSTNODES_H
+#define ASLDATAWITHGHOSTNODES_H
+
+#include "aslDataWrapper.h"
+#include <iostream>
+#include <fstream>
+
+using  namespace std;
+
+namespace asl
+{
+
+	///		 \ingroup DataFields
+	///	\todo resolve consistency issue with AbstractData::setBlock()
+	class AbstractDataWithGhostNodes: public AbstractData
+	{
+		protected:
+			Block internalBlock;
+			/// num of cells within the border
+			unsigned int ghostBorder;
+			/// flag represents whther the data acces on the borders is allowed
+			bool bordersDataAcces;
+			inline AbstractDataWithGhostNodes();					
+			inline AbstractDataWithGhostNodes(const Block & b, int nGN = 1, bool bDA = true);			
+		public:
+			inline int getSubContainerOffset() const;	
+			inline unsigned int getSubContainerSize() const;	
+			inline const Block & getInternalBlock() const;
+			inline const unsigned int getGhostBorder() const;
+			virtual acl::VectorOfElements getSubContainer() = 0;	
+	};
+
+	///	 \ingroup DataFields
+	template <typename V> class DataWithGhostNodes: public AbstractDataWithGhostNodes
+	{
+		private: 
+			DataWrapper<V> dw;
+		public:
+			inline DataWithGhostNodes();
+			inline DataWithGhostNodes(const Block & b, int nGN = 1, bool bDA = true);
+			inline DataWithGhostNodes(DataWrapper<V> & d, int nGN = 1);
+			virtual acl::VectorOfElements getSubContainer();	
+			virtual const acl::VectorOfElements getEContainer();	
+			virtual const acl::VectorOfElementsData getDContainer() const;				
+			inline void setContainer(const V & cont);
+			inline V & getContainer();	
+	};
+
+	typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+//	typedef DataWithGhostNodes<vector<MemElement> > DataWithGhostNodesMem;
+
+	typedef shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
+	typedef shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	typedef shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+	///Creates new DataWithGhostNodesACLData with same data structure like \p d
+	/// \ingroup DataFields
+	SPDataWithGhostNodesACLData clone(SPDataWithGhostNodesACLData d);
+
+	///Creates new DataWithGhostNodesACLData with same data structure like \p d containing \p n first elements
+	/// \ingroup DataFields
+	SPDataWithGhostNodesACLData clone(SPDataWithGhostNodesACLData d, unsigned int n);
+	
+	template <typename V> inline std::shared_ptr<DataWithGhostNodes<V>> 
+		resizeGhostNodes(std::shared_ptr<DataWithGhostNodes<V>> d, unsigned int newGN);
+
+//--------------------------- Implementation --------------------------
+
+	AbstractDataWithGhostNodes::AbstractDataWithGhostNodes()
+	{
+	}
+
+	AbstractDataWithGhostNodes::AbstractDataWithGhostNodes(const Block & b, int nGN,bool bDA): 
+		AbstractData (offset(b, nGN)),
+		internalBlock(b),
+		ghostBorder(nGN),
+		bordersDataAcces(bDA)
+	{		
+	}
+		
+
+	template <typename V> DataWithGhostNodes<V>::DataWithGhostNodes()
+	{
+	}
+	
+	template <typename V> DataWithGhostNodes<V>::DataWithGhostNodes(const Block & b, int nGN,bool bDA): 
+		AbstractDataWithGhostNodes (b,nGN,bDA),
+		dw(offset(b, nGN))
+	{		
+	}
+
+	template <typename V> DataWithGhostNodes<V>::DataWithGhostNodes(DataWrapper<V> & d, int nGN): 
+		AbstractDataWithGhostNodes (offset(d.getBlock(), -nGN), nGN, true),
+		dw(d)
+	{		
+	}
+		
+	const Block & AbstractDataWithGhostNodes::getInternalBlock() const
+	{
+		return internalBlock;
+	}
+
+	const unsigned int AbstractDataWithGhostNodes::getGhostBorder() const
+	{
+		return ghostBorder;
+	}
+
+	inline int AbstractDataWithGhostNodes::getSubContainerOffset() const
+	{
+		Block b(offset(internalBlock, ghostBorder));		
+		int nD(b.getSize().getSize());
+		return b.c2i(AVec<int>(nD,ghostBorder));
+	}
+	
+	inline unsigned int AbstractDataWithGhostNodes::getSubContainerSize() const
+	{
+		const Block b(offset(internalBlock, ghostBorder));
+		int nD(b.getSize().getSize());
+		int s(b.c2i(b.getSize()-AVec<int>(nD,ghostBorder+1)) - b.c2i(AVec<int>(nD,ghostBorder))+1);
+		return s>0?s:0;
+	}
+
+	template <class V > inline void DataWithGhostNodes<V>::setContainer(const V & cont)
+	{
+		dw.setContainer (cont);
+	}
+
+	template <class V > inline V & DataWithGhostNodes<V>::getContainer()
+	{
+		return dw.getContainer();
+	}
+		
+	template <typename V> inline std::shared_ptr<DataWithGhostNodes<V>> 
+		resizeGhostNodes(std::shared_ptr<DataWithGhostNodes<V>> d, unsigned int newGN)
+	{
+		Block b(offset(d->getBlock(),newGN));
+		std::shared_ptr<DataWithGhostNodes<V>> 
+			nd(new DataWithGhostNodes<V>(b, 0));			
+		nd->setContainer(d->getContainer());
+		return nd;
+	}
+
+		
+} //asl
+
+#endif // ASLDATAWITHGHOSTNODES_H
+
diff --git a/src/data/aslDataWrapper.cxx b/src/data/aslDataWrapper.cxx
new file mode 100644
index 0000000..dfef97b
--- /dev/null
+++ b/src/data/aslDataWrapper.cxx
@@ -0,0 +1,58 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDataWrapper.h"
+#include "acl/aclUtilities.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+
+namespace asl
+{
+	template <typename V> bool DataWrapper<V>::checkConsistency() const 
+	{
+		return compatibleSizes((unsigned int)productOfElements(block.getSize()),
+		                        container);
+	}
+
+	template bool DataWrapperACL::checkConsistency() const;
+	template bool DataWrapperACLData::checkConsistency() const;
+
+	template <class V> const acl::VectorOfElements DataWrapper<V>::getEContainer()
+	{
+		return acl::VectorOfElements(container);
+	}
+
+	template const acl::VectorOfElements DataWrapperACL::getEContainer();
+	template const acl::VectorOfElements DataWrapperACLData::getEContainer();
+	
+	template <> const acl::VectorOfElementsData DataWrapperACL::getDContainer() const
+	{
+		return acl::VectorOfElementsData();
+	}
+
+	template <> const acl::VectorOfElementsData DataWrapperACLData::getDContainer() const
+	{
+		return container;
+	}
+	
+} // namespace asl
diff --git a/src/data/aslDataWrapper.h b/src/data/aslDataWrapper.h
new file mode 100644
index 0000000..a26ba1c
--- /dev/null
+++ b/src/data/aslDataWrapper.h
@@ -0,0 +1,147 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDATAWRAPPER_H
+#define ASLDATAWRAPPER_H
+
+#include "aslBlocks.h"
+#include "../acl/aclMath/aclVectorOfElementsDef.h"
+#include <iostream>
+#include <fstream>
+
+/**
+ \defgroup DataFields Data Fileds
+ \ingroup Numerics
+ */
+
+namespace acl
+{
+	void copy(const vector<Element> & source,
+	          VectorOfElements & destination);
+	void copy(const VectorOfElementsData & source,
+	          VectorOfElementsData & destination);
+}
+
+
+using  namespace std;
+
+namespace asl
+{
+
+	/// \ingroup DataFields
+	class AbstractData
+	{
+		protected:
+			Block block;
+			inline AbstractData();
+			inline explicit AbstractData(const Block & b);
+		public:	
+			virtual const acl::VectorOfElements getEContainer() = 0;	
+			virtual const acl::VectorOfElementsData getDContainer() const = 0;	
+			inline const Block & getBlock() const;
+			inline void setBlock(const Block & b);
+	};
+
+	typedef shared_ptr<AbstractData> SPAbstractData;
+
+		
+    /// Class defines a folding rule into a 1D/2D/3D bulk 
+    /** 
+		 \param V is type of the container
+		 \ingroup DataFields
+
+		 \todo resolve consistency issue with setBlock()
+		 
+    */
+	template <typename V> class DataWrapper: public AbstractData
+	{
+		protected:
+			V container;
+			virtual bool checkConsistency() const;
+		public:
+			inline DataWrapper();
+			inline explicit DataWrapper(const Block & b);
+			inline DataWrapper(DataWrapper & d);
+			virtual const acl::VectorOfElements getEContainer();	
+			virtual const acl::VectorOfElementsData getDContainer() const;	
+			inline V & getContainer();	
+			inline void setContainer(const V & cont);
+	};
+
+	typedef DataWrapper<acl::VectorOfElements> DataWrapperACL;
+	typedef DataWrapper<acl::VectorOfElementsData> DataWrapperACLData;
+
+	typedef shared_ptr<DataWrapperACL> SPDataWrapperACL;
+	typedef shared_ptr<DataWrapperACLData> SPDataWrapperACLData;
+
+	
+// ---------------------------- Implementation ---------------------------
+
+	AbstractData::AbstractData()
+	{
+	}
+	
+	AbstractData::AbstractData(const Block & b): 
+		block(b)
+	{
+	}
+
+	template <typename V> DataWrapper<V>::DataWrapper():
+		AbstractData()
+	{
+	}
+	
+	template <typename V> DataWrapper<V>::DataWrapper(const Block & b): 
+		AbstractData(b)
+	{		
+	}
+
+	template <typename V> DataWrapper<V>::DataWrapper(DataWrapper & d): 
+		AbstractData(d.block),
+		container(d.container)
+	{		
+	}
+		
+	template <typename V> inline V & DataWrapper<V>::getContainer()
+	{
+		return container;
+	}
+	
+	template <typename V> inline  void DataWrapper<V>::setContainer(const V & cont)
+	{
+		copy(cont, container);
+	}
+
+	inline const Block & AbstractData::getBlock() const
+	{
+		return block;
+	}
+	
+	inline void AbstractData::setBlock(const Block & b)
+	{
+		block=b;
+	}
+		
+}
+#endif
+
diff --git a/src/data/aslMemElement.cxx b/src/data/aslMemElement.cxx
new file mode 100644
index 0000000..9b3dc8a
--- /dev/null
+++ b/src/data/aslMemElement.cxx
@@ -0,0 +1,60 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslMemElement.h"
+
+namespace asl{
+
+	template <typename T> MemVector<T>::MemVector(unsigned int n):
+		MemElementBase(n),container(new T[n]),createdContainer(true)
+	{
+	}
+
+	template <typename T> MemVector<T>::~MemVector()
+	{
+		if (createdContainer)
+			delete[] container;
+	}
+
+	template <typename T> void MemVector<T>::resize(unsigned int n)
+	{
+		if (createdContainer)
+			delete[] container;
+		container=new T[n];
+		createdContainer=true;
+		size=n;
+	}
+
+	template <typename T> void MemVector<T>::setContainer(unsigned int n, T* p)
+	{
+		if (createdContainer)
+			delete[] container;
+		container=p;
+		createdContainer=false;
+		size=n;
+	}
+	
+
+}//asl
+
+
diff --git a/src/data/aslMemElement.h b/src/data/aslMemElement.h
new file mode 100644
index 0000000..56239e6
--- /dev/null
+++ b/src/data/aslMemElement.h
@@ -0,0 +1,78 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLMEMELEMENT
+#define ASLMEMELEMENT
+
+#include <memory>
+
+
+using  namespace std;
+
+namespace asl
+{
+
+	class MemElementBase
+	{
+		protected:
+			unsigned int size;
+			
+			inline MemElementBase(unsigned int n = 0);
+		public:			
+			virtual ~MemElementBase() = 0;
+			inline unsigned int getSize() const;
+			virtual void resize() = 0;
+			
+	};
+
+	typedef std::shared_ptr<MemElementBase> MemElement;
+
+	template <typename T> class MemVector: public MemElementBase
+	{
+		private:
+			T* container;
+			bool createdContainer;
+		public:
+			MemVector(unsigned int n = 0);
+			virtual ~MemVector();			
+			virtual void resize(unsigned int n);
+			void setContainer(unsigned int n, T* p);
+	};
+
+
+//------------------------ Implementations -----------------------
+
+	inline MemElementBase::MemElementBase(unsigned int n): size(n)
+	{
+	}
+
+	inline unsigned int MemElementBase::getSize() const
+	{
+		return size;
+	}
+	
+
+
+} //asl
+#endif //ASLMEMELEMNT
+
diff --git a/src/data/aslProbe.cxx b/src/data/aslProbe.cxx
new file mode 100644
index 0000000..59a9209
--- /dev/null
+++ b/src/data/aslProbe.cxx
@@ -0,0 +1,191 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslProbe.h"
+#include "aslDataWrapper.h"
+#include <acl/acl.h>
+#include <acl/aclGenerators.h>
+#include <acl/DataTypes/aclArray.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <math/aslTemplateVE.h>
+#include <aslGenerators.h>
+
+
+namespace asl
+{
+
+	Probe::Probe(SPAbstractData d):
+		data(d),
+		values(getNComponents())
+	{		
+	}
+
+	void Probe::addPoint(AVec<int> p)
+	{
+		if (p.getSize() != nD(data->getBlock()))
+			errorMessage("Probe::addPoint() - attempt to add point that has wrong dimensions");
+
+		if (!in(data->getBlock(), p))
+			errorMessage("Probe::addPoint() - attempt to add point that is out of block range");
+		
+		indices.push_back(data->getBlock().c2i(p));
+	}
+
+
+	const unsigned int Probe::getNComponents() const
+	{
+		return data->getEContainer().size();		
+	}
+
+
+	const unsigned int Probe::getNDimensions() const
+	{
+		return nD(data->getBlock());
+	}
+
+		
+	void Probe::loadIndicesToACL()
+	{
+		indicesACL = acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,
+		                                                                       indices.size(),
+		                                                                       int(0)));
+		acl::copy(indices, (*indicesACL)[0]);
+	}
+
+
+	void Probe::loadValuesFromACL()
+	{
+		unsigned int nC(getNComponents());
+		for (unsigned int i(0); i < nC; ++i)
+			acl::copy((*valuesACL)[i], values[i]);
+	}
+	
+
+	void Probe::init()
+	{
+		loadIndicesToACL();
+		valuesACL = acl::SPVectorOfElementsData(new acl::VectorOfElementsData(getNComponents(),
+		                                                                      indices.size(),
+		                                                                      double(0)));	
+		k << (*valuesACL = excerpt(data->getEContainer(), *indicesACL));
+		k.setup();
+	}
+
+
+	void Probe::update()
+	{
+		k.compute();
+		loadValuesFromACL();
+	}
+
+
+	ProbeLI::ProbeLI(SPAbstractData d):
+		data(d),
+		values(getNComponents())
+	{		
+	}
+		
+	void ProbeLI::addPoint(AVec<> p)
+	{
+		if (p.getSize() != nD(data->getBlock()))
+			errorMessage("Probe::addPoint() - attempt to add point that has wrong dimensions");
+
+		if (!in(data->getBlock(), p))
+			errorMessage("Probe::addPoint() - attempt to add point that is out of block range");
+		
+		points.push_back(p);
+	}
+
+
+	const unsigned int ProbeLI::getNComponents() const
+	{
+		return data->getEContainer().size();		
+	}
+
+
+	const unsigned int ProbeLI::getNDimensions() const
+	{
+		return nD(data->getBlock());
+	}
+		
+	void ProbeLI::loadPointsToACL()
+	{
+		unsigned int nd(getNDimensions());
+		unsigned int length(points.size());
+		pointsACL = acl::SPVectorOfElementsData(new acl::VectorOfElementsData(nd, length, double(0)));
+		vector<vector<double>> pointsCompon(nd);
+		for(unsigned int i(0); i<nd; ++i)
+			pointsCompon[i].resize(points.size());
+
+		for(unsigned int j(0); j<length; ++j)
+			for(unsigned int i(0); i<nd; ++i)
+				pointsCompon[i][j]=points[j][i];
+
+		for(unsigned int i(0); i<nd; ++i)
+			acl::copy(pointsCompon[i], (*pointsACL)[i]);
+	}
+
+
+	void ProbeLI::loadValuesFromACL()
+	{
+		unsigned int nC(getNComponents());
+		for (unsigned int i(0); i < nC; ++i)
+			acl::copy((*valuesACL)[i], values[i]);
+	}
+	
+
+	void ProbeLI::init()
+	{
+		loadPointsToACL();
+		auto & bl(data->getBlock());
+		unsigned int nd(pointsACL->size()); 
+		valuesACL = acl::SPVectorOfElementsData(new acl::VectorOfElementsData(getNComponents(),
+		                                                                      points.size(),
+		                                                                      double(0)));
+		auto ind(acl::generateVEPrivateVariable<int>(1));
+		auto e(acl::generateVEPrivateVariable<double>(nd));
+
+		k << (e = (*pointsACL - bl.position)/bl.dx);
+		k << (ind = floor(e) * bl.c2iTransformVector);
+		k << (e = e - acl::floor(e));
+
+		TemplateVE dTVE;
+		auto d(generateDataContainer_SP(data->getBlock(), data->getEContainer(),0));
+		for(unsigned int i(0); i < valuesACL->size(); ++i)
+		{
+			dTVE.init(*d, *elementaryCellVT(nd), i);
+			k << excerpt(dTVE.initValues,ind);
+			k << (subVE(*valuesACL,i) = interpolate(dTVE, e));
+		}
+		k.setup();
+	}
+
+
+	void ProbeLI::update()
+	{
+		k.compute();
+		loadValuesFromACL();
+	}
+
+		
+}// namespace asl
diff --git a/src/data/aslProbe.h b/src/data/aslProbe.h
new file mode 100644
index 0000000..49f039c
--- /dev/null
+++ b/src/data/aslProbe.h
@@ -0,0 +1,151 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLPROBE_H
+#define ASLPROBE_H
+
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslVectors.h>
+#include <iostream>
+#include <fstream>
+
+
+
+using  namespace std;
+
+namespace acl
+{
+	class VectorOfElementsData; 
+	typedef std::shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
+
+}
+namespace asl
+{
+	
+	class AbstractData;
+	typedef std::shared_ptr<AbstractData> SPAbstractData;
+	
+	/// Collects point values from the input data 
+	/**
+		/// \ingroup DataAnalysis
+		 The class takes in
+	*/
+	class Probe
+	{
+		protected:
+			SPAbstractData data;
+			acl::Kernel k;
+
+			std::vector<int> indices;
+			acl::SPVectorOfElementsData indicesACL;
+
+			vector<vector<double>> values;
+			acl::SPVectorOfElementsData valuesACL;
+
+			void loadIndicesToACL();
+			void loadValuesFromACL();
+
+		public:	
+			Probe(SPAbstractData d);			
+			void addPoint(AVec<int> p);
+			/// initialization of internal kernels and data
+			void init();
+			/// Updates data in output
+			void update();
+			const unsigned int getNComponents() const;
+			const unsigned int getNDimensions() const;
+			inline vector<double> & getComponent(unsigned int i);
+			inline AVec<double> getValue(unsigned int pointNumber);
+	};	
+
+	/// Collects point values from the input data with linear interpolation  
+	/**
+		/// \ingroup DataAnalysis
+	*/
+	class ProbeLI
+	{
+		protected:
+			SPAbstractData data;
+			acl::Kernel k;
+
+			std::vector<AVec<>> points;
+			acl::SPVectorOfElementsData pointsACL;
+
+			vector<vector<double>> values;
+			acl::SPVectorOfElementsData valuesACL;
+
+			void loadPointsToACL();
+			void loadValuesFromACL();
+
+		public:	
+			ProbeLI(SPAbstractData d);			
+			void addPoint(AVec<> p);
+			/// initialization of internal kernels and data
+			void init();
+			/// Updates data in output
+			void update();
+			const unsigned int getNComponents() const;
+			const unsigned int getNDimensions() const;
+			inline vector<double> & getComponent(unsigned int i);
+			inline AVec<double> getValue(unsigned int pointNumber);
+	};	
+
+
+	// -------------------------- Implementation ------------------------------
+
+	inline vector<double> & Probe::getComponent(unsigned int i)
+	{
+		return values[i];
+	}
+
+
+	inline AVec<double> Probe::getValue(unsigned int pointNumber)
+	{
+		unsigned int nC(getNComponents());
+		AVec<double> value(nC);
+		for (unsigned int i(0); i < nC; ++i)
+			value[i] = values[i][pointNumber];
+
+		return value;
+	}
+
+	inline vector<double> & ProbeLI::getComponent(unsigned int i)
+	{
+		return values[i];
+	}
+
+
+	inline AVec<double> ProbeLI::getValue(unsigned int pointNumber)
+	{
+		unsigned int nC(getNComponents());
+		AVec<double> value(nC);
+		for (unsigned int i(0); i < nC; ++i)
+			value[i] = values[i][pointNumber];
+
+		return value;
+	}
+	
+}
+
+#endif
+
diff --git a/src/doxygenDefinitions.h b/src/doxygenDefinitions.h
new file mode 100644
index 0000000..c67e605
--- /dev/null
+++ b/src/doxygenDefinitions.h
@@ -0,0 +1,214 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\mainpage
+	\dotfile mainDiagram.dot 
+*/
+
+
+// This file contains Doxygen definitions
+
+
+/// \defgroup ACL Advanced Computational Language
+
+
+/// \defgroup Operators Operators
+/// \ingroup ACL
+
+
+/// \defgroup Functions Functions
+/// \ingroup ACL
+
+
+/// \defgroup MathOperators Mathematical Operators
+/// \ingroup Operators
+
+
+/**
+ \defgroup AssignmentOperators Assignment Operators
+ \ingroup Operators
+*/
+
+/**
+ \defgroup BooleanOperators Boolean Operators
+ \ingroup Operators
+*/
+
+/**
+ \defgroup MathFunctions Mathematical Functions
+ \ingroup Functions
+*/
+
+/**
+ \defgroup SpecialPurposeFunctions Special Purpose Functions
+ \ingroup Functions
+*/
+
+/**
+ \defgroup SynchronizationFunctions Synchronization Functions
+ \ingroup Functions
+*/
+
+
+/// \defgroup HostInterectionFunctions Host Interaction Functions
+/// \ingroup Functions
+
+
+/**
+ \defgroup ControlStructures Control Structures
+ \ingroup ACL
+*/
+
+/**
+ \defgroup KernelGen OpenCL Kernel Generation
+ \ingroup ACL
+*/
+
+/**
+ \defgroup ComplexDataTypes Complex Data Types
+ \ingroup ACL
+*/
+
+
+/// \defgroup HardwareInformation Hardware Information
+/// \ingroup ACL
+
+/// \defgroup AtomicFunctions Atomic Functions
+/// \ingroup ACL
+
+
+/**
+\defgroup generateVE VectorOfElements generators
+ \related VectorOfElements
+ \ingroup ComplexDataTypes
+*/
+
+/**
+\defgroup generateME MatrixOfElements generators
+ \related MatrixOfElements
+ \ingroup ComplexDataTypes
+*/
+
+
+/**
+ \defgroup Numerics Numerics
+ */
+
+/**
+ \defgroup NumMethods NumericalMethods
+ \ingroup Numerics
+ */
+
+/**
+ \defgroup BoundaryConditions Boundary Conditions
+ \ingroup Numerics
+*/
+
+
+/**
+ \defgroup Physics Physics
+*/
+
+
+/**
+ \defgroup TransportProcesses Transport processes
+ \ingroup Physics
+*/
+
+/**
+ \defgroup ChemicalReactions Chemical Reactions
+ \ingroup Physics
+*/
+
+/**
+ \defgroup GenericBC Generic boundary conditions
+ \ingroup BoundaryConditions
+*/
+
+
+/**
+ \defgroup TransportProcessesBC Transport processes boundary conditions
+ \ingroup TransportProcesses
+ \ingroup BoundaryConditions
+ */
+
+/**
+ \defgroup ElasticityBC Elasticity Boundary Conditions
+ \ingroup Elasticity
+ \ingroup BoundaryConditions
+ */
+
+
+/// \defgroup Interfacing Interfacing with other software
+
+
+/**
+ \defgroup IO Input/Output
+ \ingroup Interfacing
+ */
+
+
+/// \defgroup DataAnalysis Data analysis tools
+/// \ingroup Numerics
+
+
+/// \defgroup DataUtilities Data utilities
+/// \ingroup Numerics
+
+/// \defgroup LevelSet Advanced Level Set Method
+/// \ingroup Numerics
+
+/// \defgroup PF Position Function
+/// \ingroup Numerics
+
+
+/// \defgroup Geom Geometric Objects and manipulations
+
+
+/// \defgroup LDI Library Design Issues
+
+
+/// \defgroup Utilities Utilities
+
+
+/// \defgroup ErrorMessaging Error Messaging
+/// \ingroup Utilities
+
+
+namespace boost
+{ 
+	template<class T> class shared_ptr {}; 
+	template<class T> class shared_array {}; 
+	template<class T> class scoped_ptr {}; 
+	template<class T> class scoped_array {}; 
+}
+
+namespace std
+{ 
+	template<class T> class vector {}; 
+	template<class T> class shared_ptr {}; 
+	template<class T> class shared_array {}; 
+	template<class T> class unique_ptr {}; 
+	template<class T> class unique_array {}; 
+} 
diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt
new file mode 100644
index 0000000..25859e4
--- /dev/null
+++ b/src/math/CMakeLists.txt
@@ -0,0 +1,41 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslmath
+
+set(aslmath_PUBLIC_HEADERS
+	aslVectors.h
+	aslVectorsDynamicLength.h
+	aslVectorsDynamicLengthOperations.h
+	aslMatrices.h
+	aslBarycentric.h
+	aslInterpolation.h
+	aslTemplates.h
+	aslTemplatesExtras.h
+	aslProbeTemplates.h
+	aslTemplateVE.h
+	aslTemplateVEExtras.h
+	aslIndex2Position.h
+	aslDistanceFunction.h
+	aslDistanceFunctionAlg.h
+	aslPositionFunction.h
+)
+
+set(aslmath_SOURCES
+	${aslmath_PUBLIC_HEADERS}
+	aslMatrices.cxx
+	aslBarycentric.cxx
+	aslTemplates.cxx
+	aslTemplatesExtras.cxx
+	aslProbeTemplates.cxx
+	aslTemplateVE.cxx
+	aslTemplateVEExtras.cxx
+	aslIndex2Position.cxx
+	aslDistanceFunction.cxx
+	aslDistanceFunctionAlg.cxx
+	aslPositionFunction.cxx
+)
+
+add_library(aslmath ${aslmath_SOURCES})
+INSTALL_SUBLIB(aslmath aslmath_PUBLIC_HEADERS)
diff --git a/src/math/aslBarycentric.cxx b/src/math/aslBarycentric.cxx
new file mode 100644
index 0000000..c66058f
--- /dev/null
+++ b/src/math/aslBarycentric.cxx
@@ -0,0 +1,100 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslBarycentric.h"
+#include "aslMatrices.h"
+#include "../aslUtilities.h"
+
+using namespace std;
+using asl::errorMessage;
+
+namespace asl
+{
+	Barycentric::Barycentric(vector<AVec<>> & p)
+	{
+		init(p);
+	}
+	
+	Barycentric::Barycentric():
+		corners(0)
+	{
+	}
+
+	
+	void Barycentric::init(vector<AVec<>> & p)
+	{
+
+		if(p.size()-1 != p[0].getSize())
+			errorMessage("asl::Barycentric::init: number of points does not corresponds to the dimentionality");
+			
+		corners=p;
+
+		unsigned int n(p.size()-1);
+		t.resize(n, n);
+		tInv.resize(n, n);
+
+		for(unsigned int i(1); i < p.size(); ++i)
+		{
+			t.setRow(i - 1, corners[i]-corners[0]);
+		}
+		
+		tInv = inverseMatrix(t);
+	}
+
+	AVec<> Barycentric::getCordinates(const AVec<> & p)
+	{
+		if(t.getNRow() != p.getSize())
+			errorMessage("asl::Barycentric::interpolate: point dimensionality does not corresponds to the triangle dimentionality");
+		return tInv * (p - corners[0]);
+	}
+
+	double Barycentric::interpolate(const AVec<> & p, 
+	                                          const AVec<> & f)
+	{
+		if(p.getSize()+1 != f.getSize())
+			errorMessage("Barycentric::interpolate: number of funciton values does not corresponds to the dimentionality");
+
+		AVec<> fm(subAVec(f, 1, p.getSize()) - AVec<>(p.getSize(), f[0]));
+		return f[0] + fm * getCordinates(p); 
+	}
+		
+	bool  Barycentric::in(const AVec<> & p)
+	{
+		auto x(getCordinates(p));
+		auto res(0 <= x[0]);
+		for(unsigned int i(1); i < x.getSize(); ++i)
+			res = res && ( 0 <= x[i] );
+		res = res && (sumOfElements(x) <= 1);
+		return res;
+	}
+
+	AVec<> Barycentric::gradient(const AVec<> & f)
+	{
+		if(t.getNRow()+1 != f.getSize())
+			errorMessage("Barycentric::gradient: number of funciton values does not corresponds to the dimentionality");
+		unsigned int nd(f.getSize()-1);
+		AVec<> fm(subAVec(f, 1, nd) - AVec<>(nd,f[0]));
+		return fm*tInv; 
+	}
+		
+} // namespace asl
diff --git a/src/math/aslBarycentric.h b/src/math/aslBarycentric.h
new file mode 100644
index 0000000..a58f690
--- /dev/null
+++ b/src/math/aslBarycentric.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLBARYCENTRIC_H
+#define ASLBARYCENTRIC_H
+
+#include "aslMatrices.h"
+
+namespace asl
+{
+	/// realize Barycentric algoritms for trianles generated within Kernel 
+	/**
+		 \ingroup ComplexDataTypes
+
+		 The cordinates does not contain the fist coordinate
+	 */
+	class Barycentric
+	{	
+		public:
+			std::vector<AVec<>> corners;
+			AMatr<> t;
+			AMatr<> tInv;
+			Barycentric(std::vector<AVec<>> & p);
+			Barycentric();
+			void init(std::vector<AVec<>> & p);
+
+			AVec<> getCordinates(const AVec<> & p);
+			double interpolate(const AVec<> & p, 
+			                   const AVec<> & f);
+			bool in(const AVec<> & p);
+			AVec<> gradient(const AVec<> & f);			
+	};
+}  //namespace asl
+
+#endif // ASLBARYCENTRIC_H
diff --git a/src/math/aslDistanceFunction.cxx b/src/math/aslDistanceFunction.cxx
new file mode 100644
index 0000000..cc64629
--- /dev/null
+++ b/src/math/aslDistanceFunction.cxx
@@ -0,0 +1,195 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDistanceFunction.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include <acl/aclGenerators.h>
+#include <acl/aclHardware.h>
+#include <acl/acl.h>
+#include <data/aslBlocks.h>
+#include <aslGenerators.h>
+#include <math/aslIndex2Position.h>
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+#include <acl/Kernels/aclKernel.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <math/aslTemplateVE.h>
+
+
+namespace asl
+{
+	DistanceFunction::DistanceFunction()
+	{}	
+
+	DistanceFunction::~DistanceFunction()
+	{}	
+
+	DistFBinaryOperation::
+		DistFBinaryOperation(SPDistanceFunction a, SPDistanceFunction b):
+			e1(a), e2(b)
+	{
+	}
+
+	DistFUnaryOperation::
+		DistFUnaryOperation(SPDistanceFunction a):
+			e1(a)
+	{
+	}
+	
+	DistFOperationAnd::
+		DistFOperationAnd(SPDistanceFunction a, SPDistanceFunction b):
+			DistFBinaryOperation(a,b)
+	{
+	}
+	
+	acl::VectorOfElements DistFOperationAnd::getDistance(const acl::VectorOfElements & pos)
+	{
+		return max(e1->getDistance(pos), e2->getDistance(pos));
+	}
+
+	DistFOperationOr::
+		DistFOperationOr(SPDistanceFunction a, SPDistanceFunction b):
+			DistFBinaryOperation(a,b)
+	{
+	}
+	
+	acl::VectorOfElements DistFOperationOr::getDistance(const acl::VectorOfElements & pos)
+	{
+		return min(e1->getDistance(pos), e2->getDistance(pos));
+	}
+
+	DistFOperationInversion::
+		DistFOperationInversion(SPDistanceFunction a):
+			DistFUnaryOperation(a)
+	{
+	}
+
+	acl::VectorOfElements DistFOperationInversion::getDistance(const acl::VectorOfElements & pos)
+	{
+		return -(e1->getDistance(pos));
+	}
+		
+		
+	DistFSphere::
+		DistFSphere(double r, const AVec<double> & c):
+			radius(acl::generateVEConstant(r)), center(acl::generateVEConstant(c))
+	{
+	}
+
+	acl::VectorOfElements DistFSphere::getDistance(const acl::VectorOfElements & pos)
+	{
+		return sqrt(l2(pos-center))-radius;
+	}
+		
+	DistFCylinder::
+		DistFCylinder(double r, const AVec<double> & l, const AVec<double> & c):
+			radius(acl::generateVEConstant(r)),
+			orientation(acl::generateVEConstant(normalize(l))), 
+			center(acl::generateVEConstant(c))
+	{
+	}
+
+	acl::VectorOfElements DistFCylinder::getDistance(const acl::VectorOfElements & pos)
+	{
+		return sqrt(l2((pos-center) - ((pos-center)*orientation)*orientation))-radius;
+	}
+
+	DistFCone::
+		DistFCone(double th, const AVec<double> & l, const AVec<double> & a):
+			tanTheta(acl::generateVEConstant(tan(th))),
+			orientation(acl::generateVEConstant(normalize(l))), 
+			apex(acl::generateVEConstant(a))
+	{
+	}
+
+	acl::VectorOfElements DistFCone::getDistance(const acl::VectorOfElements & pos)
+	{
+		return sqrt(l2((pos-apex) - ((pos-apex)*orientation)*orientation)) - 
+			tanTheta*((pos-apex)*orientation);
+	}
+		
+	acl::VectorOfElements DistFPlane::getDistance(const acl::VectorOfElements & pos)
+	{
+		return pos*normal-b;
+	}
+		
+	DistFPlane::
+		DistFPlane(AVec<double> n, AVec<double> p0):
+			normal(acl::generateVEConstant(normalize(n))), 
+		    b(acl::generateVEConstant(p0*n/sqrt(l2(n))))
+	{
+	}
+		
+	const double DistFNormalization::scaleFactor(1.8);
+		
+	DistFNormalization::
+		DistFNormalization(SPDistanceFunction a, double dx):
+			DistFUnaryOperation(a),
+			factor(acl::generateVEConstant(1./dx/scaleFactor))
+	{
+	}
+	
+	acl::VectorOfElements DistFNormalization::getDistance(const acl::VectorOfElements & pos)
+	{
+		auto type(getElementType(pos));
+		acl::VectorOfElements dist(1); 
+		copy(factor*e1->getDistance(pos),dist);
+		
+		acl::VectorOfElements topCut(1);
+		copy(acl::select(dist, acl::generateVEConstant(1.), dist>1., type),
+		     topCut);
+		acl::VectorOfElements bottomCut(1);
+		copy(acl::select(topCut, acl::generateVEConstant(-1.), dist<-1., type),
+		     bottomCut);
+		return bottomCut;
+	}
+
+	acl::VectorOfElements DataInterpolation::getDistance(const acl::VectorOfElements & pos)
+	{
+		acl::TypeID type(getElementType(data->getEContainer()));
+		auto & bl(data->getBlock());
+		auto e((pos - bl.position)/bl.dx);
+		auto ind(convert(acl::TYPE_SELECT[type],floor(e) * bl.c2iTransformVector,false));
+		copy(e - acl::floor(e),e);
+
+		TemplateVE dTVE;
+		auto d(generateDataContainer_SP(data->getBlock(), data->getEContainer(),0));
+		unsigned int nC(data->getEContainer().size());
+		unsigned int nd(nD(data->getBlock()));
+		acl::VectorOfElements res(nC);
+		for(unsigned int i(0); i < nC; ++i)
+		{
+			dTVE.init(*d, *elementaryCellVT(nd), i, false);
+			copy(excerpt(dTVE.values,ind),dTVE.values);
+			res[i] = (interpolate(dTVE, e))[0];
+		}
+		return res;
+	}
+		
+	DataInterpolation::
+		DataInterpolation(SPAbstractDataWithGhostNodes d):
+			data(d)
+	{
+	}
+
+		
+} // asl
diff --git a/src/math/aslDistanceFunction.h b/src/math/aslDistanceFunction.h
new file mode 100644
index 0000000..08c4e96
--- /dev/null
+++ b/src/math/aslDistanceFunction.h
@@ -0,0 +1,193 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDISTANCEFUNCTION_H
+#define ASLDISTANCEFUNCTION_H
+
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+#include <aslUtilities.h>
+ 
+namespace acl
+{
+	class KernelConfiguration;
+}
+
+namespace asl {
+
+	template <typename T> class AVec;
+	class Block;
+
+	class AbstractDataWithGhostNodes; 
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Abstract class allows to add in kernel distance function from a boundary of a geometrical object
+	///\ingroup LevelSet
+	/**
+		 The class ...
+	*/
+	class DistanceFunction
+	{
+		protected:
+			DistanceFunction();
+		public:
+			virtual ~DistanceFunction();
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos)=0;
+	};
+
+	///\ingroup LevelSet
+	typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;	
+	
+	///\ingroup LevelSet
+	class DistFBinaryOperation: public DistanceFunction
+	{
+		protected:
+			SPDistanceFunction e1;
+			SPDistanceFunction e2;
+		public:
+			DistFBinaryOperation(SPDistanceFunction a, SPDistanceFunction b);
+	};
+
+	///\ingroup LevelSet
+	class DistFUnaryOperation: public DistanceFunction
+	{
+		protected:
+			SPDistanceFunction e1;
+		public:
+			DistFUnaryOperation(SPDistanceFunction a);
+	};
+	
+	///\ingroup LevelSet
+	class DistFOperationAnd: public DistFBinaryOperation
+	{
+		public:
+			DistFOperationAnd(SPDistanceFunction a, SPDistanceFunction b);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+
+	///\ingroup LevelSet
+	class DistFOperationOr: public DistFBinaryOperation
+	{
+		public:
+			DistFOperationOr(SPDistanceFunction a, SPDistanceFunction b);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+
+	///\ingroup LevelSet
+	class DistFOperationInversion: public DistFUnaryOperation
+	{
+		public:
+			DistFOperationInversion(SPDistanceFunction a);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+	
+	
+	///\ingroup LevelSet
+	class DistFSphere: public DistanceFunction
+	{
+		private:
+			acl::VectorOfElements radius;
+			acl::VectorOfElements center;
+		public:
+			DistFSphere(double r, const AVec<double> & c);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+
+	///\ingroup LevelSet
+	/**
+	*/
+	class DistFCylinder: public DistanceFunction
+	{
+		private:
+			acl::VectorOfElements radius;
+			acl::VectorOfElements orientation;
+			acl::VectorOfElements center;
+		public:
+			/**
+			 \param r radius
+			 \param l orientation vector no normalization needed
+			 \param c center
+			 */
+			DistFCylinder(double r, const AVec<double> & l, const AVec<double> & c);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+
+	///\ingroup LevelSet
+	/**
+	*/
+	class DistFCone: public DistanceFunction
+	{
+		private:
+			acl::VectorOfElements tanTheta;
+			acl::VectorOfElements orientation;
+			acl::VectorOfElements apex;
+		public:
+			/**
+			 \param th theta, opening angle, 0.5*aperture
+			 \param l orientation vector no normalization needed
+			 \param a apex position
+			 */
+			DistFCone(double th, const AVec<double> & l, const AVec<double> & a);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+	
+	///\ingroup LevelSet
+	/**
+	*/
+	class DistFPlane: public DistanceFunction
+	{
+		private:
+			acl::VectorOfElements normal;
+			acl::VectorOfElements b;
+		public:
+			DistFPlane(AVec<double> n, AVec<double> p0);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+	
+
+	/// normalize so that the values are in range [1:-1]
+	///\ingroup LevelSet	
+	class DistFNormalization: public DistFUnaryOperation
+	{
+		protected:
+			acl::VectorOfElements factor;
+		public:
+			static const double scaleFactor;
+			DistFNormalization(SPDistanceFunction a, double dx);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+
+	/// transforms discrete data object into continious one, DistanceFunction
+	///\ingroup LevelSet	
+	class DataInterpolation: public DistanceFunction
+	{
+		protected:
+			SPAbstractDataWithGhostNodes data;
+			
+		public:
+			DataInterpolation(SPAbstractDataWithGhostNodes d);
+			virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
+	};
+	
+} // asl
+
+#endif // ASLDISTANCEFUNCTION
diff --git a/src/math/aslDistanceFunctionAlg.cxx b/src/math/aslDistanceFunctionAlg.cxx
new file mode 100644
index 0000000..7190f0d
--- /dev/null
+++ b/src/math/aslDistanceFunctionAlg.cxx
@@ -0,0 +1,307 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDistanceFunction.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <data/aslBlocks.h>
+#include <aslGenerators.h>
+#include <math/aslIndex2Position.h>
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslTemplatesExtras.h>
+#include <math/aslTemplateVE.h>
+
+
+
+namespace asl
+{
+
+	acl::VectorOfElements isGhostNode(TemplateVE & distanceTVE, unsigned int i)
+	{
+		return (distanceTVE.getValue(i) <= 0.);
+	}
+
+	acl::VectorOfElements isComputationNode(TemplateVE & distanceTVE, unsigned int i)
+	{
+		return (distanceTVE.getValue(i) > 0.);
+	}
+
+
+	acl::VectorOfElements nGhostNodesInCell(TemplateVE & distanceTVE, unsigned int iEl)
+	{
+		auto cell(distanceTVE.vto->elementaryCells[iEl]);
+		acl::VectorOfElements nGhost(1);
+		acl::TypeID type(getElementType(distanceTVE.values));
+		copy(select(acl::generateVEConstant(1), 
+		            isGhostNode(distanceTVE,cell[0]),
+		            type),
+		     nGhost);
+			
+		for(unsigned int i(1); i< cell.getSize(); ++i)
+		{
+			copy(nGhost + select(acl::generateVEConstant(1), 
+			                     isGhostNode(distanceTVE,cell[i]),
+			                     type),
+			     nGhost);
+		}
+		return nGhost;
+	}
+
+	acl::VectorOfElements isBoundaryBetween(TemplateVE & distanceTVE, 
+	                                        unsigned int iE, 
+	                                        unsigned int i, 
+	                                        unsigned int j)
+	{
+		auto vto(distanceTVE.vto);
+		auto cell(vto->elementaryCells[iE]);
+		return (isGhostNode(distanceTVE, cell[i]) && 
+		        isComputationNode(distanceTVE, cell[j])) || 
+			   (isGhostNode(distanceTVE, cell[j]) && 
+			    isComputationNode(distanceTVE, cell[i])); 		
+	}
+	
+	acl::VectorOfElements exBoundaryX(TemplateVE & distanceTVE, unsigned int i)
+	{
+		return distanceTVE.getValue(0)/(distanceTVE.getValue(0)-distanceTVE.getValue(i));
+	}
+	
+	acl::VectorOfElements exBoundaryCenter(TemplateVE & distanceTVE, unsigned int iEl)
+	{
+		auto vto(distanceTVE.vto);
+		auto cell(vto->elementaryCells[iEl]);
+		auto &dVal(distanceTVE.values);
+		acl::TypeID type(getElementType(dVal));
+		unsigned int n(cell.getSize());
+		vector<AVec<>> cellPoints;
+		vto->getCellPoints(iEl, cellPoints);
+		unsigned int nd(nD(cellPoints[0]));
+		
+		acl::VectorOfElements v(acl::generateVEConstantN(nd,0));
+		acl::VectorOfElements nP(acl::generateVEConstant(0));
+		for(unsigned int i(0); i < n-1; ++i)
+			for(unsigned int j(i+1); j < n; ++j)
+			{
+				auto di(subVE(dVal, cell[i]));
+				auto dj(subVE(dVal, cell[j]));
+
+				auto isB(isBoundaryBetween(distanceTVE,iEl,i,j));
+				auto x(di / (di - dj));
+				auto pi(acl::generateVEConstant(cellPoints[i]));
+				auto pj(acl::generateVEConstant(cellPoints[j]));
+
+				auto p(select(pi + (pj - pi) * x, isB, type));
+				copy(v + p, v);
+				copy(nP +select(acl::generateVEConstant(1), isB, type),nP);
+				
+			}
+		return v/nP;
+	}
+
+	vector<acl::Element> gcBoundaryArea(TemplateVE & distanceTVE,
+	                                    unsigned int iEl, 
+	                                    acl::VectorOfElements & center,
+	                                    acl::VectorOfElements & area)
+	{
+		auto vto(distanceTVE.vto);
+
+		auto cell(vto->elementaryCells[iEl]);
+		auto &dVal(distanceTVE.values);
+		acl::TypeID type(getElementType(area));
+		unsigned int n(cell.getSize());
+		vector<AVec<>> cellPoints;
+		vto->getCellPoints(iEl, cellPoints);
+//		unsigned int nd(nD(cellPoints[0]));
+
+		vector<acl::Element> code(0);
+		code<<(area = acl::generateVEConstant(0.));
+		auto aij(acl::generateVEPrivateVariable(1u, type));
+		auto aik(acl::generateVEPrivateVariable(1u, type));
+		auto ajk(acl::generateVEPrivateVariable(1u, type));
+		
+		acl::VectorOfElements nP(acl::generateVEConstant(0));
+		for(unsigned int i(0); i < n-2; ++i)
+			for(unsigned int j(i+1); j < n-1; ++j)
+				for(unsigned int k(j+1); k < n; ++k)
+				{
+					auto di(subVE(dVal, cell[i]));
+					auto dj(subVE(dVal, cell[j]));
+					auto dk(subVE(dVal, cell[k]));
+
+					auto isBij(isBoundaryBetween(distanceTVE,iEl, i, j));
+					auto isBik(isBoundaryBetween(distanceTVE,iEl, i, k));
+					auto isBjk(isBoundaryBetween(distanceTVE,iEl, j, k));
+					auto xij(di / (di - dj));
+					auto xik(di / (di - dk));
+					auto xjk(dj / (dj - dk));
+					auto pi(acl::generateVEConstant(cellPoints[i]));
+					auto pj(acl::generateVEConstant(cellPoints[j]));
+					auto pk(acl::generateVEConstant(cellPoints[k]));
+
+					auto pij(pi + (pj - pi) * xij);
+					auto pik(pi + (pk - pi) * xik);
+					auto pjk(pj + (pk - pj) * xjk);
+					auto nij(crossProduct(pik-center,pjk-center));
+					auto nik(crossProduct(pij-center,pjk-center));
+					auto njk(crossProduct(pij-center,pik-center));
+
+					auto codeij(gcLength2(nij,aij));
+					auto codeik(gcLength2(nik,aik));
+					auto codejk(gcLength2(njk,ajk));
+					code<<codeij;
+					code<<codeik;
+					code<<codejk;
+
+					auto res(select(sqrt(select(select(ajk, aik, !isBik), aij, !isBij)),
+					                isBij || isBik || isBjk, type)*.5);
+					code<<(area+=res);
+				}
+		return code;
+	}
+
+	vector<acl::Element> gcBoundaryArea(TemplateVE & distanceTVE,
+	                                    acl::VectorOfElements & area)
+	{
+		unsigned int nCells(distanceTVE.vto->elementaryCells.size());
+		acl::TypeID type(getElementType(area));
+		
+		vector<acl::Element> code;
+		auto areaCell(acl::generateVEPrivateVariable(1u, type));
+		auto centerCell(acl::generateVEPrivateVariable(3u, type));
+
+		code<<(area = acl::generateVEConstant(0.));
+		
+		for(unsigned int i(0); i<nCells; ++i)
+		{
+			code<<(centerCell = exBoundaryCenter(distanceTVE, i));
+			code<<gcBoundaryArea(distanceTVE,i,centerCell,areaCell);
+			code<<(area+=areaCell);
+		}
+		
+
+		return code;
+	}
+
+	acl::VectorOfElements zeroNodeWeight(TemplateVE & distanceTVE, unsigned int iEl)
+	{
+		auto cell(distanceTVE.vto->elementaryCells[iEl]);
+		acl::VectorOfElements w0(1);
+		acl::VectorOfElements wC(1);
+		acl::TypeID type(getElementType(distanceTVE.values));
+		copy(select(acl::generateVEConstant(distanceTVE.vectorTemplate->laplasCoefs[cell[1]]), 
+		            isComputationNode(distanceTVE,cell[1]),
+		            type),
+		     w0);
+			
+		for(unsigned int i(2); i< cell.getSize(); ++i)
+		{
+			copy(w0+select(acl::generateVEConstant(distanceTVE.vectorTemplate->laplasCoefs[cell[i]]), 
+				        isComputationNode(distanceTVE,cell[i]),
+				        type),
+				 w0);
+		}
+		return w0;
+	}
+
+	acl::VectorOfElements surfaceCellWeight(TemplateVE & distanceTVE, unsigned int iEl)
+	{
+		auto cell(distanceTVE.vto->elementaryCells[iEl]);
+		acl::VectorOfElements w0(1);
+		acl::VectorOfElements wC(1);
+		acl::TypeID type(getElementType(distanceTVE.values));
+		copy(select(acl::generateVEConstant(distanceTVE.vectorTemplate->laplasCoefs[cell[1]]), 
+		            isComputationNode(distanceTVE,cell[1]),
+		            type),
+		     w0);
+			
+		for(unsigned int i(2); i< cell.getSize(); ++i)
+		{
+			copy(w0+select(acl::generateVEConstant(distanceTVE.vectorTemplate->laplasCoefs[cell[i]]), 
+				        isComputationNode(distanceTVE,cell[i]),
+				        type),
+				 w0);
+		}
+		copy(w0,wC);
+		for(unsigned int i(1); i<cell.getSize()-1; ++i)
+			for(unsigned int j(i+1); j< cell.getSize(); ++j)
+		{
+			copy(wC+select(acl::generateVEConstant(edgeWeight(*distanceTVE.vto,iEl,i,j)), 
+				        isBoundaryBetween(distanceTVE,iEl,i,j),
+				        type),
+				 wC);
+		}
+		
+		return wC;
+	}	
+	vector<acl::Element> gcBoundaryAreaPerGhostPoint(TemplateVE & distanceTVE,
+	                                                 unsigned int iEl, 
+	                                                 acl::VectorOfElements & center, 
+	                                                 acl::VectorOfElements & area)
+	{
+		auto code(gcBoundaryArea(distanceTVE,iEl,center,area));
+		acl::TypeID type(getElementType(area));
+//		auto wc(acl::generateVEPrivateVariable(1u, type));
+		auto nGhost(acl::generateVEPrivateVariable(1u, type));
+		code << (nGhost = nGhostNodesInCell(distanceTVE, iEl));
+		
+//		code << (wc = surfaceCellWeight(distanceTVE, iEl));
+//		code << (area *=select(acl::generateVEConstant(1.), 
+//		                       zeroNodeWeight(distanceTVE,iEl)/wc,
+//		                       wc>.01,
+//		                       type));
+/*		code << (area *=select(acl::generateVEConstant(1.), 
+		                       zeroNodeWeight(distanceTVE,iEl),
+		                       wc>.01,
+		                       type));
+*/
+		code << (area /=select(acl::generateVEConstant(1.), 
+		                       nGhost,
+		                       nGhost>.1,
+		                       type));
+
+		return code;
+	}
+
+	vector<acl::Element> gcBoundaryAreaPerGhostPoint(TemplateVE & distanceTVE,
+	                                                 acl::VectorOfElements & area)
+	{
+		unsigned int nCells(distanceTVE.vto->elementaryCells.size());
+		acl::TypeID type(getElementType(area));
+		
+		vector<acl::Element> code;
+		auto areaCell(acl::generateVEPrivateVariable(1u, type));
+		auto centerCell(acl::generateVEPrivateVariable(3u, type));
+
+		code<<(area = acl::generateVEConstant(0.));
+		
+		for(unsigned int i(0); i<nCells; ++i)
+		{
+			code<<(centerCell = exBoundaryCenter(distanceTVE, i));
+			code<<gcBoundaryAreaPerGhostPoint(distanceTVE,i,centerCell,areaCell);
+			code<<(area+=areaCell);
+		}
+
+		return code;
+	}
+	
+} // asl
diff --git a/src/math/aslDistanceFunctionAlg.h b/src/math/aslDistanceFunctionAlg.h
new file mode 100644
index 0000000..59cd708
--- /dev/null
+++ b/src/math/aslDistanceFunctionAlg.h
@@ -0,0 +1,102 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDISTANCEFUNCTIONALG_H
+#define ASLDISTANCEFUNCTIONALG_H
+
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+#include <aslUtilities.h>
+ 
+namespace asl {
+
+//	template <typename T> class AVec;
+//	class Block;
+
+//	class AbstractDataWithGhostNodes; 
+//	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+	/// returns expression corresponding to check if the node in i^th direction is ghost one
+	acl::VectorOfElements isGhostNode(TemplateVE & distanceTVE, unsigned int i);
+
+	/// returns expression corresponding to check if the node in i^th direction is computation one
+	acl::VectorOfElements isComputationNode(TemplateVE & distanceTVE, unsigned int i);
+	/// returns expression corresponding to number of ghost nodes in a cell \p i
+	acl::VectorOfElements nGhostNodesInCell(TemplateVE & distanceTVE, unsigned int i);
+	/// returns expression corresponding to check if there is a boundary between nodes i^th and j^th  within cell \p iE
+	acl::VectorOfElements isBoundaryBetween(TemplateVE & distanceTVE, 
+	                                        unsigned int iE, 
+	                                        unsigned int i, 
+	                                        unsigned int j);
+
+	/// returns expression corresponding to the relative boundary position in direction \p i
+	/**
+		\f[ x= v_0/(v_0-v_i) \f]
+	*/
+	acl::VectorOfElements exBoundaryX(TemplateVE & distanceTVE, unsigned int i);
+	
+	
+	/// generates expresion for center of a boundary element
+	/**
+		 \param iEl the element number
+		 computes avarage point of corners of the boundary poligon within the element 
+	*/
+	acl::VectorOfElements exBoundaryCenter(TemplateVE & distanceTVE, unsigned int iEl);
+
+	/// generates expresion for area of a boundary element
+	/**
+		 \param iEl the element number
+		 computes area of the corresponding boundary within bulk element \p iEl
+	*/
+	vector<acl::Element> gcBoundaryArea(TemplateVE & distanceTVE,
+	                                    unsigned int iEl, 
+	                                    acl::VectorOfElements & center, 
+	                                    acl::VectorOfElements & area);
+
+	/// generates expresion for area of a boundary element
+	/**
+		 \param iEl the element number
+		 computes area of the corresponding boundary within cell iEl and divide on number of 
+		 ghost points within the cell
+	*/
+	vector<acl::Element> gcBoundaryAreaPerGhostPoint(TemplateVE & distanceTVE,
+	                                                 unsigned int iEl, 
+	                                                 acl::VectorOfElements & center, 
+	                                                 acl::VectorOfElements & area);
+	
+	/// generates expresion for area of a boundary element
+	/**
+		 computes area of the corresponding boundary within all cells
+	*/
+	vector<acl::Element> gcBoundaryArea(TemplateVE & distanceTVE,
+	                                    acl::VectorOfElements & area);			
+
+	/// generates expresion for area of a boundary element
+	/**
+		 computes area of the corresponding boundary per ghost point within all cells
+	*/
+	vector<acl::Element> gcBoundaryAreaPerGhostPoint(TemplateVE & distanceTVE,
+	                                                 acl::VectorOfElements & area);			
+	
+} // asl
+
+#endif // ASLDISTANCEFUNCTION
diff --git a/src/math/aslIndex2Position.cxx b/src/math/aslIndex2Position.cxx
new file mode 100644
index 0000000..862cab2
--- /dev/null
+++ b/src/math/aslIndex2Position.cxx
@@ -0,0 +1,111 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslIndex2Position.h"
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <acl/DataTypes/aclIndexExt.h>
+#include <acl/DataTypes/aclConstant.h>
+
+namespace asl
+{	
+	Index2PositionDiscreteACL::Index2PositionDiscreteACL(const Block & b, bool putSize):
+		initPosition(b.getSize().getSize()),
+		position(acl::generateVEPrivateVariable<int>(b.getSize().getSize())),
+		positionWithInit(b.getSize().getSize())		
+	{
+		unsigned int nD(b.getSize().getSize());
+		unsigned int size(putSize ? productOfElements (b.getSize()) : 0);
+		if (nD==2){
+			using namespace acl::elementOperators;
+			using acl::elementOperators::operator/;
+			positionWithInit[0] =acl::Element(new acl::IndexExt(size))/
+								acl::Element(new acl::Constant<int>(b.getSize()[1]));
+			positionWithInit[1] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(b.getSize()[1]));
+			copy(position=positionWithInit,initPosition);
+		}
+		if (nD==3){
+			using namespace acl::elementOperators;
+			int s12(b.getSize()[1]*b.getSize()[2]);
+			using acl::elementOperators::operator/;
+			positionWithInit[0] =acl::Element(new acl::IndexExt(size))/
+								acl::Element(new acl::Constant<int>(s12));
+			positionWithInit[1] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(s12))/
+								acl::Element(new acl::Constant<int>(b.getSize()[2]));
+			positionWithInit[2] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(s12))%
+								acl::Element(new acl::Constant<int>(b.getSize()[2]));
+			copy(position=positionWithInit,initPosition);
+		}
+	}
+
+	Index2PositionACL::Index2PositionACL(const Block & b, 
+	                                     acl::TypeID type, 
+	                                     bool putSize):
+		initPosition(b.getSize().getSize()),
+		position(acl::generateVEPrivateVariable(b.getSize().getSize(),type)),
+		positionWithInit(b.getSize().getSize())		
+	{
+		unsigned int nD(b.getSize().getSize());
+		unsigned int size(putSize ? productOfElements (b.getSize()) : 0);
+		if (nD==2){
+			using namespace acl::elementOperators;
+			using acl::elementOperators::operator/;
+			positionWithInit[0] =acl::Element(new acl::IndexExt(size))/
+								acl::Element(new acl::Constant<int>(b.getSize()[1]));
+			positionWithInit[1] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(b.getSize()[1]));
+			copy(acl::convert(type, 
+			                  acl::generateVEConstant(b.position) + 
+			                  acl::generateVEConstant(b.dx) * 
+			                  acl::convert(type,positionWithInit),
+			                  false), 
+			     positionWithInit);
+			copy(position=positionWithInit, initPosition);
+		}
+		if (nD==3){
+			using namespace acl::elementOperators;
+			int s12(b.getSize()[1]*b.getSize()[2]);
+			using acl::elementOperators::operator/;
+			positionWithInit[0] =acl::Element(new acl::IndexExt(size))/
+								acl::Element(new acl::Constant<int>(s12));
+			positionWithInit[1] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(s12))/
+								acl::Element(new acl::Constant<int>(b.getSize()[2]));
+			positionWithInit[2] =acl::Element(new acl::IndexExt(size))%
+								acl::Element(new acl::Constant<int>(s12))%
+								acl::Element(new acl::Constant<int>(b.getSize()[2]));
+			copy(acl::convert(type, 
+   			                  acl::generateVEConstant(b.position) + 
+			                  acl::generateVEConstant(b.dx) * 
+			                  acl::convert(type,positionWithInit), 
+			                  false),
+			     positionWithInit);			
+			copy(position=positionWithInit, initPosition);
+		}
+	}
+
+		
+}// asl
diff --git a/src/math/aslIndex2Position.h b/src/math/aslIndex2Position.h
new file mode 100644
index 0000000..f7bbc97
--- /dev/null
+++ b/src/math/aslIndex2Position.h
@@ -0,0 +1,58 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef INDEX2POSITION_H_INCLUDED
+#define INDEX2POSITION_H_INCLUDED
+
+#include <data/aslBlocks.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+
+namespace asl
+{
+
+	class Index2PositionACL
+	{
+		public:
+			Index2PositionACL(const Block &b, 
+			                  acl::TypeID type=acl::TYPE_DOUBLE, 
+			                  bool putSize=true);
+			acl::VectorOfElements initPosition;
+			acl::VectorOfElements position;
+			acl::VectorOfElements positionWithInit;
+	};
+
+	class Index2PositionDiscreteACL
+	{
+		public:
+			/// \p putSize is a flag defining the size of the generated elements in case of false value the size is 0 
+			Index2PositionDiscreteACL(const Block &b, bool putSize=true);
+			acl::VectorOfElements initPosition;
+			acl::VectorOfElements position;		
+			acl::VectorOfElements positionWithInit;
+	};
+
+
+}// asl
+
+#endif // INDEX2POSITION_H_INCLUDED
diff --git a/src/math/aslInterpolation.h b/src/math/aslInterpolation.h
new file mode 100644
index 0000000..e183003
--- /dev/null
+++ b/src/math/aslInterpolation.h
@@ -0,0 +1,136 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslVectors.h definition of class АVec<T>
+
+#ifndef ASLINTERPOLATION
+#define ASLINTERPOLATION
+
+
+#include "../aslUtilities.h"
+#include <math.h>
+
+
+namespace asl
+{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+
+	/**
+	 \defgroup Splines
+	 */
+	
+	template <class Func> class UniversalFunction
+	{
+		public:
+			inline double operator()(double x);
+			inline double operator()(Element x);
+	};	
+	
+	///Linear spline function
+	/**	
+	 \ingroup Splines
+
+	this class defines a spline function \f$ (1-|x/r_0|),~~~ |x|<r_0 \f$	 
+	 \image html linearS.png ""
+	*/
+	class LinearSpline
+	{
+		public:
+			template <typename T> inline T operator(T x,T r0)
+			{
+				return fabs(x)<r0 ? 1.- fabs(x)/r0 : 0;
+			}
+	};
+
+	///Quadratic spline function
+	/**	
+	 \ingroup Splines
+
+	this class defines a spline function \f$ (1-|x|/r_0)^2,~~~ |x|<r_0 \f$	 
+	 \image html quadraticS.png ""
+	*/
+	class QuadraticSpline
+	{
+		public:
+			template <typename T> inline T operator(T x,T r0)
+			{
+				T a(fabs(x));
+				T b((1.- a/r0));
+				return a<r0 ? b*b : 0;
+			}
+	};
+
+	///Qubic spline function
+	/**	
+	 \ingroup Splines
+
+	this class defines a spline function \f$ (1-|x|/r_0)^3,~~~ |x|<r_0 \f$	 
+	 \image html qubicS.png ""
+	*/
+	class QubicSpline
+	{
+		public:
+			template <typename T> inline T operator(T x,T r0)
+			{
+				T a(fabs(x));
+				T b((1.- a/r0));
+				return a<r0 ? b*b*b : 0;
+			}
+	};
+
+	///Qubic spline function
+	/**	
+	 \ingroup Splines
+
+	this class defines a spline function \f$ (1-|x|/r_0)^3,~~~ |x|<r_0 \f$	 
+	 \image html qubicS1.png ""
+	*/
+	class QubicSpline1
+	{
+		public:
+			template <typename T> inline T operator(T x,T r0)
+			{
+				T a(fabs(x));
+				T b(a/r0);
+				T b2(b*b);
+				return b < 1 ? 2. * b2*b - 3. * b2 + 1 : 0;
+			}
+	};
+	
+// --------------------------- Implementation ---------------------
+
+	template <class Func> inline double UniversalFunction<Func>::operator()(double x)
+	{
+		return Func(x);
+	}
+
+	template <class Func>  inline Element UniversalFunction<Func>::operator()(Element x)
+	{
+		return Func(x);
+	}
+		
+} // asl
+
+#endif
+
diff --git a/src/math/aslMatrices.cxx b/src/math/aslMatrices.cxx
new file mode 100644
index 0000000..8ae05ce
--- /dev/null
+++ b/src/math/aslMatrices.cxx
@@ -0,0 +1,442 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include"aslMatrices.h"
+
+using namespace std;
+
+namespace asl
+{
+
+	template <typename T> const AMatr<T> & AMatr<T>::operator=(const AMatr<T> & a)
+	{
+		if(nCol != a.nCol || nRow != a.nRow )
+			resize(a.nRow, a.nCol);
+		for(unsigned int i(0); i < nRow; ++i)
+			for(unsigned int j(0); j < nCol; ++j)
+				(*this)(i,j) = a(i,j);
+		return *this;
+	}
+	
+	template const AMatr<double> & AMatr<double>::operator=(const AMatr<double> & a);
+	template const AMatr<float> & AMatr<float>::operator=(const AMatr<float> & a);
+	
+	template <typename T> void AMatr<T>::setRow(unsigned int r, const AVec<T> & b)
+	{
+		if(nCol != b.getSize())
+			errorMessage("Error: AMatr<T>::setRow: size of b does not match number of columns");
+		if(nRow < r)
+			errorMessage("Error: AMatr<T>::setRow: r larger than number of rows");
+		for(unsigned int i(0); i < b.getSize(); ++i)
+			(*this)(r,i) = b[i];
+	}
+
+	template void AMatr<double>::setRow(unsigned int r, const AVec<double> & b);
+	template void AMatr<float>::setRow(unsigned int r, const AVec<float> & b);
+	
+	template <typename T> void AMatr<T>::setColumn(unsigned int c, const AVec<T> & b)
+	{
+		if(nRow != b.getSize())
+			errorMessage("Error: AMatr<T>::setColumn: size of b does not match number of rows");
+		if(nCol < c)
+			errorMessage("Error: AMatr<T>::setColumn: c larger than number of columns");
+		for(unsigned int i(0); i < b.getSize(); ++i)
+			(*this)(i,c) = b[i];
+	}
+
+	template void AMatr<double>::setColumn(unsigned int c, const AVec<double> & b);
+	template void AMatr<float>::setColumn(unsigned int c, const AVec<float> & b);
+	
+	template <typename T> ostream& operator<<(ostream &f, const AMatr<T> & a) 
+	{
+		for (unsigned int i(0); i < a.getNRow(); ++i){
+			for (unsigned int j(0); j < a.getNCol() - 1; ++j)
+				f << a(i, j) << ' ';
+			f << a(i, a.getNCol()-1) << endl;
+		};
+		return f;
+	}
+
+	template ostream& operator<<(ostream &f,const AMatr<float> & a);
+	template ostream& operator<<(ostream &f,const AMatr<double> & a);
+	
+	template <typename T> const AMatr<T> operator* (const AMatr<T> &a, const AMatr<T> & b) 
+	{
+		AMatr<T> c(a.getNRow(), b.getNCol()); 
+		T s(0);
+		for (unsigned int i(0); i < a.getNRow(); ++i)
+			for (unsigned int j(0); j < b.getNCol(); ++j)
+			{
+				for (unsigned int k(0); k<a.getNCol(); ++k) 
+					s+=a(i, k) * b(k, j);
+				c(i, j)=s; 
+				s=0; 
+			}
+		return c;
+	}
+
+	template const AMatr<double> operator* (const AMatr<double> &a, const AMatr<double> & b); 
+	template const AMatr<float> operator* (const AMatr<float> &a, const AMatr<float> & b);
+
+	template <typename T> const AVec<T> operator* (const AMatr<T> &a, const AVec<T> & b) 
+	{
+		AVec<T> c(a.getNRow()); 
+		T s(0);
+		for (unsigned int i(0); i < a.getNRow(); ++i){
+			for (unsigned int k(0); k<a.getNCol(); ++k) 
+				s+=a(i, k) * b[k];
+			c[i]=s; 
+			s=0; 
+		}
+		return c;
+	}
+
+	template const AVec<double> operator* (const AMatr<double> &a, const AVec<double> & b); 
+	template const AVec<float> operator* (const AMatr<float> &a, const AVec<float> & b);
+
+	template <typename T> const AVec<T> operator* (const AVec<T> &a, const AMatr<T> & b) 
+	{
+		AVec<T> c(b.getNCol()); 
+		T s(0);
+		for (unsigned int j(0); j < b.getNCol(); ++j)
+		{
+			for (unsigned int k(0); k<a.getSize(); ++k) 
+				s+=a[k] * b(k, j);
+			c[j]=s; 
+			s=0; 
+		}
+		return c;
+	}
+
+	template const AVec<double> operator* (const AVec<double> &a, const AMatr<double> & b); 
+	template const AVec<float> operator* (const AVec<float> &a, const AMatr<float> & b);
+	
+	template <typename T> const AMatr<T> operator* (const AMatr<T> &a, const T & b) 
+	{
+		AMatr<T> c(a.getNRow(), a.getNCol()); 
+		c.getInternalVec() = a.getInternalVec() * b;
+		return c;
+	}
+
+	template const AMatr<double> operator* (const AMatr<double> &a, const double & b); 
+	template const AMatr<float> operator* (const AMatr<float> &a, const float & b);
+
+	template <typename T> const AMatr<T> operator* (const T &a, const AMatr<T> & b) 
+	{
+		AMatr<T> c(b.getNRow(), b.getNCol()); 
+		c.getInternalVec() = b.getInternalVec() * a;
+		return c;
+	}
+
+	template const AMatr<double> operator* (const double &a, const AMatr<double> & b); 
+	template const AMatr<float> operator* (const float &a, const AMatr<float> & b);
+	
+	template <typename T> AMatr<T> elementProduct(const AVec<T> & a, const AVec<T> & b)
+	{
+		AMatr<T> m(a.getSize(),b.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			for (unsigned int j(0);j<b.getSize();++j)
+				m(i,j)= a[i]*b[j];
+		return m;
+	}
+
+	template AMatr<double> elementProduct(const AVec<double> & a, const AVec<double> & b);
+	template AMatr<float> elementProduct(const AVec<float> & a, const AVec<float> & b);
+	
+	template <typename T> const T trace(const AMatr<T> &a) 
+	{
+    	T c(0); 
+		for (unsigned int i(0); i < a.getNRow(); ++i) 
+			c += a(i, i); 
+		return c;
+	}
+	
+	template const double trace(const AMatr<double> &a); 
+	template const float trace(const AMatr<float> &a); 
+
+ 	template <typename T> 
+		const T trace(const AMatr<T> & a, const AMatr<T> & b) 
+	{
+    	T c(0);
+		for (unsigned int i(0); i < a.getNRow(); ++i)
+			for (unsigned int j(0); j < a.getNCol(); ++j)
+				c += a(i,j) * b(j,i);
+		return c;
+	}
+
+ 	template const double trace(const AMatr<double> & a, const AMatr<double> & b); 
+ 	template const float trace(const AMatr<float> & a, const AMatr<float> & b); 
+
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a)
+	{
+		return {1,a.getSize(),a};
+	}
+
+	template AMatr<double> makeAMatr(const AVec<double> & a);
+	template AMatr<float> makeAMatr(const AVec<float> & a);
+		                       
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a, const AVec<T> & b)
+	{
+		if(a.getSize() != b.getSize())
+			errorMessage("makeMatr: vectors have different sizes" );
+		AMatr<T> m(2, a.getSize());
+		m.setRow(0,a);
+		m.setRow(1,b);		
+		return m;
+	}
+
+	template AMatr<double> makeAMatr<double>(const AVec<double> & a, const AVec<double> & b);
+	template AMatr<float> makeAMatr<float>(const AVec<float> & a, const AVec<float> & b);
+
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a, 
+	                                         const AVec<T> & b, 
+	                                         const AVec<T> & c)
+	{
+		if((a.getSize() != b.getSize()) || (a.getSize() != c.getSize()))
+			errorMessage("makeMatr: vectors have different sizes" );
+		AMatr<T> m(3, a.getSize());
+		m.setRow(0,a);
+		m.setRow(1,b);		
+		m.setRow(2,c);		
+		return m;
+	}
+
+	template AMatr<double> makeAMatr(const AVec<double> & a, const AVec<double> & b, const AVec<double> & c);
+	template AMatr<float> makeAMatr(const AVec<float> & a, const AVec<float> & b, const AVec<float> & c);
+			
+	template <typename T> AMatr<T> makeAMatr(AVec<T> *a, unsigned int n)
+	{
+		for(unsigned int i(1); i<n; ++i)
+			if((a[0].getSize() != a[i].getSize()))
+				errorMessage("makeMatr: some vectors have different sizes");
+
+		AMatr<T> m(n, a[0].getSize());
+		for(unsigned int i(0); i<n; ++i)
+				m.setRow(i,a[i]);
+		return m;
+	}
+
+	template AMatr<double> makeAMatr(AVec<double> *a, unsigned int n);
+	template AMatr<float> makeAMatr(AVec<float> *a, unsigned int n);
+
+	template <typename T> AMatr<T> makeAMatrUnit(unsigned int n)
+	{
+		AMatr<T> m(n,n);
+		
+		for(unsigned int i(0); i<n; ++i)
+			for(unsigned int j(0); j<n; ++j)
+				m(i,j)=0;
+		for(unsigned int i(0); i<n; ++i)
+			m(i,i) = 1;
+		return m;
+	}
+
+	template  AMatr<double> makeAMatrUnit<double>(unsigned int n);
+	template  AMatr<float> makeAMatrUnit<float>(unsigned int n);
+	
+	template <typename T> AVec<T> getDiagonal(const AMatr<T> & a)
+	{
+		if(a.getNCol()!=a.getNRow())
+			errorMessage("Error: getDiagonal: the matrix is not square one");
+
+		unsigned int n(a.getNCol());
+		AVec<T> v(n);
+
+		for(unsigned int i(0); i<n; ++i)
+			v[i]=a(i,i);
+
+		return v;
+	}
+
+	template AVec<double> getDiagonal(const AMatr<double> & a);
+	template AVec<float> getDiagonal(const AMatr<float> & a);
+	
+	template <typename T> AVec<T> getOffDiagonalUp(const AMatr<T> & a)
+	{
+		if(a.getNCol()!=a.getNRow())
+			errorMessage("Error: getOffDiagonalUp: the matrix is not square one");
+
+		unsigned int n(a.getNCol());
+		AVec<T> v((n*n-n)/2);
+
+		unsigned int k(0);
+		for(unsigned int i(1); i<n; ++i)
+			for(unsigned int j(1); i<=i; ++j)
+			{
+				v[k]=a.getElement(i,j);
+				++k;
+			}
+		return v;
+	}
+
+	template <typename T> T det(const AMatr<T> & m)
+	{
+		if(m.getNCol()!=m.getNRow())
+			errorMessage("Error: det: the matrix is not square one");
+		if(m.getNCol()>3)
+			errorMessage("Error: det: the matrix size is larger than 3");
+
+		T v(0);
+		if(m.getNCol()==1)
+			v=m(0,0);
+		if(m.getNCol()==2)
+			v=m(0,0) * m(1,1) - m(0,1) * m(1,0);
+		if(m.getNCol()==3)
+			v=m(0,0) * m(1,1) * m(2,2) +
+			  m(1,0) * m(2,1) * m(0,2) +
+			  m(0,1) * m(1,2) * m(2,0) -
+			  m(0,2) * m(1,1) * m(2,0) -
+			  m(1,0) * m(0,1) * m(2,2) -
+			  m(2,1) * m(1,2) * m(0,0);
+		return v;
+	}
+
+	template double det(const AMatr<double> & m);
+	template float det(const AMatr<float> & m);
+
+	template <typename T> 
+		AVec<T> solveSystem(const AMatr<T> & a, const AVec<T> & b)
+	{
+		if(a.getNCol()!=a.getNRow())
+			errorMessage("Error: solveSystem: the matrix is not square one");
+		if(a.getNCol()>3)
+			errorMessage("Error: solveSystem: the matrix size is larger than 3");
+		if(a.getNCol()!=b.getSize())
+			errorMessage("Error: solveSystem: size of b does not match the size of matrix");
+
+		AVec<T> v(b.getSize());
+
+		T d(det(a));
+		AVec<T> db(b.getSize());
+		for(unsigned int i(0); i < b.getSize(); ++i)
+			db[i] = det(replaceColumn(a,b,i));
+			
+		return db/d;		
+	}
+
+	template AVec<double> solveSystem(const AMatr<double> & a, const AVec<double> & b);
+	template AVec<float> solveSystem(const AMatr<float> & a, const AVec<float> & b);
+	
+	
+	template <typename T> AMatr<T> replaceRow(const AMatr<T> & a,
+	                            const AVec<T> & b, 
+	                            unsigned int r)
+	{
+		AMatr<T> m(a);
+		m.setRow(r,b);
+		return m;
+	}
+
+	template <typename T> AMatr<T> replaceColumn(const AMatr<T> & a, 
+	                               const AVec<T> & b, 
+	                               unsigned int c)
+	{
+		AMatr<T> m(a);
+		m.setColumn(c,b);
+		return m;
+	}
+
+		
+	template <typename T> 
+		T matrixCofactor(const AMatr<T> & a, unsigned int r, unsigned int c)
+	{
+		AMatr<T> m(a.getNRow()-1, a.getNCol()-1);
+		for(unsigned int i(0), im(0); im < m.getNRow(); ++i, ++im)
+		{
+			i += (i == r) ? 1 : 0;
+			for(unsigned int j(0), jm(0); jm < m.getNCol(); ++j, ++jm)
+			{
+				j += (j == c) ? 1 : 0;
+				m(im, jm) = a(i,j);
+			}
+		}
+		return det(m);			
+	}
+
+	
+	template <typename T> AMatr<T> generateMatrixCofactors(const AMatr<T> & a)
+	{
+		if(a.getNRow() != a.getNCol())
+			errorMessage("Error: generateMatrixCofactors: the matrix is not rectangular one");
+		if(a.getNRow() > 3)
+			errorMessage("Error: generateMatrixCofactors: the matrix size is more than 3");
+		AMatr<T> m(a.getNRow(), a.getNCol());
+		int rfactor(-1);
+		for(unsigned int i(0); i < a.getNRow(); ++i){
+			rfactor*=-1;
+			int factor(-rfactor);
+			for(unsigned int j(0); j < a.getNCol(); ++j)
+			{	
+				factor*=-1;
+				m(i,j) = (factor * matrixCofactor(a,i,j));
+			}
+		}
+		return m;
+	}
+
+	template <typename T> AMatr<T> inverseMatrix(const AMatr<T> & a)
+	{
+		AMatr<T> mc(generateMatrixCofactors(a));
+		T d(det(a));
+		return mc/d;
+	}
+	
+	template AMatr<double> inverseMatrix(const AMatr<double> & a);
+	template AMatr<float> inverseMatrix(const AMatr<float> & a);
+
+	
+	
+	double detSymMat(double a,double b, double c)
+	{
+		return a*b-c*c;
+	}
+
+	void getEValEVecMatSym2x2(double a,double b, double c, double & l1, double & l2, double & v1x, double & v1y, double & v2x, double & v2y)
+	{
+		double tr2((a+b)*.5);
+		double det(detSymMat(a,b,c));
+		l1=	tr2 + sqrt(tr2*tr2-det);
+		l2=	tr2 - sqrt(tr2*tr2-det);
+		v1x=l1-b;
+		v1y=c;
+		v2x=l2-b;
+		v2y=c;
+	}
+
+	double detSymMat(double a, double b, double c, double d, double e, double f)
+	{
+		return a*b*c+2.*d*e*f-b*e*e-a*f*f-c*d*d;
+	}
+
+	void getEValEVecMatSym3x3(double a, double b, double c, double d, double e, double f, 
+		                      double & l1, double & l2, double & l3, 
+		                      double & v1x, double & v1y, double & v1z, 
+		                      double & v2x, double & v2y, double & v2z,
+		                      double & v3x, double & v3y, double & v3z)
+	{
+//	double tr(a+b+c);	
+//	double det(detSymMat(a,b,c,d,e,f))
+		
+	}
+
+}
diff --git a/src/math/aslMatrices.h b/src/math/aslMatrices.h
new file mode 100644
index 0000000..e91dbbb
--- /dev/null
+++ b/src/math/aslMatrices.h
@@ -0,0 +1,354 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslMatrices.h Matrices
+
+#ifndef ASLMATRICES
+#define ASLMATRICES
+
+
+#include "../aslUtilities.h"
+#include "aslVectors.h"
+
+
+namespace asl
+{
+	/// class algebraic matrix. 
+	/// The class is an implementation of a dynamic matrix with defined algebraic operations
+	template <typename T = double> class AMatr
+	{
+		private: 
+			unsigned int nRow;
+			unsigned int nCol;			
+			AVec<T> internalVec;
+		public:
+			inline AMatr();
+			inline AMatr(unsigned int nR, unsigned int nC);
+      		inline AMatr(const AMatr<T> &a);
+			inline AMatr(unsigned int nR, unsigned int nC, AVec<T> v);
+			template <typename T1> AMatr(const AMatr<T1> &a);
+			const AMatr<T> & operator=(const AMatr & a);
+			///doesn't chek boundaries
+			inline T& operator()(int i, int j) {return internalVec[i*nCol+j];}
+      		///doesn't chek boundaries
+			inline const T& operator()(int i, int j)const {return internalVec[i*nCol+j];}
+			///doesn't chek boundaries
+			inline T& operator[](int i) {return internalVec[i];}
+			///doesn't chek boundaries
+			inline const T& operator[](int i)const {return internalVec[i];}
+			inline unsigned int getNRow() const;
+			inline unsigned int getNCol() const;
+			inline void resize(unsigned int nR, unsigned int nCol);
+			inline const AVec<T> & getInternalVec() const;
+			inline AVec<T> & getInternalVec();
+			void setRow(unsigned int r, const AVec<T> & a);
+			void setColumn(unsigned int c, const AVec<T> & a);
+	};
+
+	
+	/// \relates AMatr	
+	template <typename T> std::ostream& operator<<(std::ostream &f,const AMatr<T> & a); 
+	/// \relates AMatr	
+	template <typename T> 
+		inline const AMatr<T> & operator+=(AMatr<T> & a, const AMatr<T> & b);
+	/// \relates AMatr	
+	template <typename T> 
+		inline const AMatr<T> operator+ (const AMatr<T> & a, const AMatr<T> & b); 
+	/// \relates AMatr	
+	template <typename T> 
+		inline const AMatr<T> operator- (const AMatr<T> & a, const AMatr<T> & b);
+	/// \relates AMatr	
+	template <typename T> 
+		const AMatr<T> operator* (const AMatr<T> &a, const AMatr<T> & b); 
+
+	/// \relates AMatr	
+	template <typename T> 
+		const AVec<T> operator* (const AMatr<T> &a, const AVec<T> & b); 
+
+	/// \relates AMatr	
+	template <typename T> 
+		const AVec<T> operator* (const AVec<T> &a, const AMatr<T> & b); 
+
+	/// \relates AMatr	
+	template <typename T> 
+		const AMatr<T> operator* (const AMatr<T> &a, const T & b); 
+
+	/// \relates AMatr	
+	template <typename T> 
+		const AMatr<T> operator* (const T &a, const AMatr<T> & b); 
+	
+	///Trace of a matrix \f$Tr(A)\equiv A_{ii}\f$ \relates AMatr	
+	template <typename T> const T trace(const AMatr<T> &a); 
+
+	///Trace of a matrix product \f$Tr(A B)\equiv A_{ij}B_{ji}\f$ \relates AMatr	
+ 	template <typename T> const T trace(const AMatr<T> & a, const AMatr<T> & b);
+	/// \relates AMatr	
+	template <typename T> 
+		inline const AMatr<T> operator/ (const AMatr<T> & b, const T & a); 
+
+	///element product of two vectors
+	/**
+		 \relates AMatr
+		 \f$ elementProduct\left(
+		                         \left[\begin{array}{c}
+		                               a_1\\ \vdots \\ a_n
+		                               \end{array}\right],
+		                         \left[\begin{array}{c}
+		                               b_1\\ \vdots \\ b_n
+		                               \end{array}\right] =
+		                         \left[\begin{array}{ccc}
+		                               a_1b_1 & \cdots & a_1b_n\\
+		                               \vdots & \ddots & \vdots\\
+		                               a_nb_1 & \cdots & a_nb_n\\
+		                               \end{array}\right]
+		                         \right)
+		 \f$
+	 */			
+	template <typename T>	
+		AMatr<T> elementProduct(const AVec<T> & a, const AVec<T> & b);
+
+
+	///	 generates a matrix with a row \relates AMatr
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a);
+	
+	///	 generates a matrix with two rows 	 \relates AMatr
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a, const AVec<T> & b);
+	
+	///	 generates a matrix with three rows  \relates AMatr
+	template <typename T> AMatr<T> makeAMatr(const AVec<T> & a, 
+	                                         const AVec<T> & b,
+	                                         const AVec<T> & c);
+
+	///	 generates a matrix with \p n rows  \relates AMatr
+	template <typename T> AMatr<T> makeAMatr(AVec<T> *a, unsigned int n);
+
+	/// \relates AMatr	
+	template <typename T=int>AMatr<T> makeAMatrUnit(unsigned int n);
+
+	
+	/// returns AVec containing the diagonal elements
+	/**
+		\relates AMatr 
+		the finction is valid only for square matrices
+	*/
+	template <typename T> AVec<T> getDiagonal(const AMatr<T> & a);
+	
+	/// returns AVec<T> containing the uper off diagonal elements
+	/**
+		\relates AMatr
+		the function is valid only for square matrices
+		\todo implement
+	*/
+	template <typename T> AVec<T> getOffDiagonalUp(const AMatr<T> & a);
+
+	/// computes determinant expression fo cases 2x2 and 3x3 only
+	/**
+		 \relates AMatr		 
+	*/
+	template <typename T> T det(const AMatr<T> & m);
+
+	/// returns solution of a system of linear equations
+	/**
+		\ingroup ComplexDataTypes		 
+	*/
+	template <typename T> AVec<T> solveSystem(const AMatr<T> & a, 
+	                                          const AVec<T> & b);
+
+	/// generate matrix with content of the matrix \p a but with replaced row \p r by vector \p b \relates AMatr<T>		 
+	template <typename T> 
+		AMatr<T> replaceRow(const AMatr<T> & a, const AVec<T> & b, unsigned int r);
+
+	/// generate matrix with content of the matrix \p a but with replaced column \p c by vector \p b \relates AMatr<T>		 
+	template <typename T> 
+		AMatr<T> replaceColumn(const AMatr<T> & a, const AVec<T> & b, unsigned int c);
+
+	/// returns inverse matrix for cases 2x2 and 3x3 \relates AMatr<T> 
+	template <typename T> 
+		AMatr<T> inverseMatrix(const AMatr<T> & a);
+
+	
+// ------------------------------ Implementation -----------------
+	template <typename T> inline AMatr<T>::AMatr():
+		nRow(0),
+		nCol(0)
+	{
+	}
+
+	template <typename T> inline AMatr<T>::AMatr(unsigned int nR, unsigned int nC):
+		nRow(nR),
+		nCol(nC),
+		internalVec(nR*nC)
+	{
+	}
+    template <typename T> inline AMatr<T>::AMatr(const AMatr<T> &a):
+		nRow(a.nRow),
+		nCol(a.nCol),
+		internalVec(a.internalVec)
+	{
+	}
+	template <typename T> inline AMatr<T>::AMatr(unsigned int nR, unsigned int nC, AVec<T> v):
+		nRow(nR),
+		nCol(nC),
+		internalVec(v)
+	{
+	}
+
+	template <typename T> inline AVec<T> & AMatr<T>::getInternalVec()
+	{
+		return internalVec;
+	}
+
+	template <typename T> inline const AVec<T> & AMatr<T>::getInternalVec() const
+	{
+		return internalVec;
+	}
+		
+	template <typename T> inline unsigned int AMatr<T>::getNRow() const
+	{
+		return nRow;
+	}
+	
+	template <typename T> inline unsigned int AMatr<T>::getNCol() const
+	{
+		return nCol;
+	}
+	
+	template <typename T> 
+		inline void AMatr<T>::resize(unsigned int nr, unsigned int nc)
+	{
+		nRow=nr; 
+		nCol=nc;
+		internalVec.resize(nr*nc);
+	}
+
+	template <typename T> 
+		inline const AMatr<T> & operator+=(AMatr<T> & a, const AMatr<T> & b)
+	{
+		a.getInternalVec += b.getInternalVec;
+		return a;
+	}
+
+	template <typename T> 
+		inline const AMatr<T> operator+ (const AMatr<T> & a, const AMatr<T> & b) 
+	{
+		return {a.getNRow(),a.getNCol(),a.getInternalVec() + b.getInternalVec()};
+	}
+
+	template <typename T> 
+		inline const AMatr<T> operator- (const AMatr<T> & a,const AMatr<T> & b) 
+	{  
+		return {a.getNRow(),a.getNCol(),a.getInternalVec() - b.getInternalVec()};
+	}
+
+	template <typename T> 
+		inline const AMatr<T> operator/ (const AMatr<T> & b, const T & a) 
+	{
+		return {b.getNRow(), b.getNCol(), b.getInternalVec() / a};
+	}
+	
+	/// Eigenvalues and eigenvectors calcutaion for symetric matrix 2x2
+	/**
+		\param a matrix element
+		\param b matrix element
+		\param c matrix element
+		\param l1 first eigenvalue
+		\param l2 second eigenvalue
+		\param v1x x component of first eigenvector
+		\param v1y y component of first eigenvector
+		\param v2x x component of second eigenvector
+		\param v2y y component of second eigenvector
+		
+		\f[
+		     A= 
+		     \left| \begin{array}{cc}
+			a & c \\
+			c & b 
+		     \end{array}\right| 
+		\f]
+			
+	*/
+	void getEValEVecMatSym2x2(double a, double b, double c, double & l1, double & l2, double & v1x, double & v1y, double & v2x, double & v2y);
+	/// Eigenvalues and eigenvectors calcutaion for symetric matrix 2x2
+	/**
+		\param a matrix element
+		\param b matrix element
+		\param c matrix element
+		\param l1 first eigenvalue
+		\param l2 second eigenvalue
+		\param v1x x component of first eigenvector
+		\param v1y y component of first eigenvector
+		\param v2x x component of second eigenvector
+		\param v2y y component of second eigenvector
+		
+		\f[
+		     A= 
+		     \left| \begin{array}{cc}
+			a & c \\
+			c & b 
+		     \end{array}\right| 
+		\f]
+			
+	*/
+	void getEValEVecMatSym2x2(double a, double b, double c, double & l1, double & l2, double & v1x, double & v1y, double & v2x, double & v2y);
+
+	/// Eigenvalues and eigenvectors calcutaion for symetric matrix 2x2
+	/**
+		\param a matrix element
+		\param b matrix element
+		\param c matrix element
+		\param d matrix element
+		\param e matrix element
+		\param f matrix element
+		\param l1 first eigenvalue
+		\param l2 second eigenvalue
+		\param l3 second eigenvalue
+		\param v1x x component of first eigenvector
+		\param v1y y component of first eigenvector
+		\param v1z z component of first eigenvector
+		\param v2x x component of second eigenvector
+		\param v2y y component of second eigenvector
+		\param v2z z component of second eigenvector
+		\param v3x x component of second eigenvector
+		\param v3y y component of second eigenvector
+		\param v3z z component of second eigenvector
+		
+		\f[
+		     A= 
+		     \left| \begin{array}{ccc}
+			a & d & e\\
+			d & b & f \\
+		    e & f & c \\
+		     \end{array}\right| 
+		\f]
+			
+	*/
+	void getEValEVecMatSym3x3(double a, double b, double c, double e, double f, double g, 
+	                          double & l1, double & l2, double & l3, 
+	                          double & v1x, double & v1y, double & v1z, 
+	                          double & v2x, double & v2y, double & v2z,
+	                          double & v3x, double & v3y, double & v3z);
+		 
+} // asl
+
+#endif //ASLMATRICES
+
diff --git a/src/math/aslPositionFunction.cxx b/src/math/aslPositionFunction.cxx
new file mode 100644
index 0000000..bb61780
--- /dev/null
+++ b/src/math/aslPositionFunction.cxx
@@ -0,0 +1,205 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslPositionFunction.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <data/aslBlocks.h>
+#include <aslGenerators.h>
+#include <math/aslIndex2Position.h>
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+#include <acl/Kernels/aclKernel.h>
+#include <data/aslDataWithGhostNodes.h>
+
+namespace asl
+{
+	PositionFunction::PositionFunction()
+	{}	
+
+	PositionFunction::~PositionFunction()
+	{}	
+
+	PFBinaryOperation::
+		PFBinaryOperation(SPPositionFunction a, SPPositionFunction b):
+			e1(a), e2(b)
+	{
+	}
+
+	PFUnaryOperation::
+		PFUnaryOperation(SPPositionFunction a):
+			e1(a)
+	{
+	}
+	
+	PFOperationPlus::
+		PFOperationPlus(SPPositionFunction a, SPPositionFunction b):
+			PFBinaryOperation(a,b)
+	{
+	}
+	
+	acl::VectorOfElements PFOperationPlus::value(acl::VectorOfElements & pos)
+	{
+		return e1->value(pos) + e2->value(pos);
+	}
+
+	PFOperationMinus::
+		PFOperationMinus(SPPositionFunction a, SPPositionFunction b):
+			PFBinaryOperation(a,b)
+	{
+	}
+	
+	acl::VectorOfElements PFOperationMinus::value(acl::VectorOfElements & pos)
+	{
+		return e1->value(pos) - e2->value(pos);
+	}
+
+	PFOperationInversion::
+		PFOperationInversion(SPPositionFunction a):
+			PFUnaryOperation(a)
+	{
+	}
+
+	acl::VectorOfElements PFOperationInversion::value(acl::VectorOfElements & pos)
+	{
+		return -(e1->value(pos));
+	}
+						
+	PFOperationProduct::
+		PFOperationProduct(SPPositionFunction a, SPPositionFunction b):
+			PFBinaryOperation(a,b)
+	{
+	}
+	
+	acl::VectorOfElements PFOperationProduct::value(acl::VectorOfElements & pos)
+	{
+		return e1->value(pos) * e2->value(pos);
+	}
+
+	acl::VectorOfElements PFLinear::value(acl::VectorOfElements & pos)
+	{
+		return pos * gradient + b;
+	}
+		
+	PFLinear::
+		PFLinear(acl::VectorOfElements g, acl::VectorOfElements a):
+			gradient(g), 
+		    b(a)
+	{
+	}			
+	acl::VectorOfElements PFConstant::value(acl::VectorOfElements & pos)
+	{
+		return val;
+	}
+		
+	PFConstant::
+		PFConstant(acl::VectorOfElements v):
+			val(v)
+	{
+	}
+
+	PFSign::
+		PFSign(SPPositionFunction a):
+			PFUnaryOperation(a)
+	{
+	}
+
+	acl::VectorOfElements PFSign::value(acl::VectorOfElements & pos)
+	{
+		return sign(e1->value(pos));
+	}
+		
+	SPPositionFunction generatePFLinear(const AVec<double> & g, double  p0)
+	{
+		return SPPositionFunction(new PFLinear(acl::generateVEConstant(g), acl::generateVEConstant(p0)));
+	}
+
+	template <typename T> 		
+		SPPositionFunction generatePFLinear(const AVec<double> & g, UValue<T>  p0)
+	{
+		return SPPositionFunction(new PFLinear(acl::generateVEConstant(g), 
+		                                       acl::generateVEVariableSP(p0.p)));
+	}
+	template SPPositionFunction generatePFLinear(const AVec<double> & g, UValue<double>  p0);
+	template SPPositionFunction generatePFLinear(const AVec<double> & g, UValue<float>  p0);
+
+		
+	SPPositionFunction generatePFConstant(double v)
+	{
+		return SPPositionFunction(new PFConstant(acl::generateVEConstant(v)));
+	}
+		
+	SPPositionFunction generatePFConstant(const AVec<double> & v)
+	{
+		return SPPositionFunction(new PFConstant(acl::generateVEConstant(v)));
+	}
+				
+	SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b, 
+	                                                      SPPositionFunction df, 
+	                                             		  unsigned int gN,
+	                                                      acl::TypeID t)
+	{
+		asl::Index2PositionACL i2p(offset(b, gN), t);
+
+		return generateDataContainer_SP(b, df->value(i2p.positionWithInit), gN);
+	}
+
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPPositionFunction f)
+	{		
+		initData(d, f, acl::KERNEL_SIMD);
+    }
+		
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPPositionFunction f, 
+	              const acl::KernelConfiguration & kernelConfig)
+	{
+		auto type(getElementType(d->getEContainer()));
+		asl::Index2PositionACL i2p(d->getBlock(),type);
+
+		acl::Kernel k(kernelConfig);
+		k << i2p.initPosition;
+		k << acl::assignmentSafe(d->getEContainer(), f->value(i2p.position));
+		k.setup();
+		k.compute();
+	}
+		
+	PFRotationField::PFRotationField(acl::VectorOfElements rotationAxis,
+	                                 acl::VectorOfElements center):
+		axis(rotationAxis),
+		c(center)
+	{
+	}
+
+	acl::VectorOfElements PFRotationField::value(acl::VectorOfElements & pos)
+	{
+		return crossProduct(axis, pos-c);
+	}
+		
+	SPPositionFunction generatePFRotationField(const AVec<> & a, const AVec<> & c)
+	{
+		return SPPositionFunction(new PFRotationField(acl::generateVEConstant(a), 
+		                                              acl::generateVEConstant(c)));
+	}
+		
+}// asl
diff --git a/src/math/aslPositionFunction.h b/src/math/aslPositionFunction.h
new file mode 100644
index 0000000..6c1a121
--- /dev/null
+++ b/src/math/aslPositionFunction.h
@@ -0,0 +1,227 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLPOSITIONFUNCTION_H
+#define ASLPOSITIONFUNCTION_H
+
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+#include "utilities/aslUValue.h"
+
+namespace acl
+{
+	class KernelConfiguration;
+}
+
+namespace asl {
+
+	template <typename T> class AVec;
+	class Block;
+
+	class AbstractDataWithGhostNodes; 
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Abstract class allows to add in kernel distance function from a boundary of a geometrical object
+	///\ingroup PF
+	/**
+		 The class ...
+	*/
+	class PositionFunction
+	{
+		protected:
+			PositionFunction();
+		public:
+			virtual ~PositionFunction();
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos)=0;
+	};
+
+	///\ingroup PF
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+
+	///\ingroup PF
+	class PFBinaryOperation: public PositionFunction
+	{
+		protected:
+			SPPositionFunction e1;
+			SPPositionFunction e2;
+		public:
+			PFBinaryOperation(SPPositionFunction a, SPPositionFunction b);
+	};
+
+	///\ingroup PF
+	class PFUnaryOperation: public PositionFunction
+	{
+		protected:
+			SPPositionFunction e1;
+		public:
+			PFUnaryOperation(SPPositionFunction a);
+	};
+	
+	///\ingroup PF
+	class PFOperationPlus: public PFBinaryOperation
+	{
+		public:
+			PFOperationPlus(SPPositionFunction a, SPPositionFunction b);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+
+	///\ingroup PF
+	class PFOperationMinus: public PFBinaryOperation
+	{
+		public:
+			PFOperationMinus(SPPositionFunction a, SPPositionFunction b);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+
+	///\ingroup PF
+	class PFOperationProduct: public PFBinaryOperation
+	{
+		public:
+			PFOperationProduct(SPPositionFunction a, SPPositionFunction b);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+	
+	///\ingroup PF
+	class PFOperationInversion: public PFUnaryOperation
+	{
+		public:
+			PFOperationInversion(SPPositionFunction a);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+	
+	///\ingroup PF
+	class PFConstant: public PositionFunction
+	{
+		private:
+			acl::VectorOfElements val;
+		public:
+			PFConstant(acl::VectorOfElements v);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+
+	///\ingroup PF
+	class PFLinear: public PositionFunction
+	{
+		private:
+			acl::VectorOfElements gradient;
+			acl::VectorOfElements b;
+		public:
+			PFLinear(acl::VectorOfElements g, acl::VectorOfElements p0);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+	
+	/// creates function corresponding to a velocity field \ingroup PF 
+	class PFRotationField: public PositionFunction
+	{
+		private:
+			acl::VectorOfElements axis;
+			acl::VectorOfElements c;
+		public:
+			/**
+			 \param rotationAxis length of the vector corresponds to an angular velocity value
+			 */ 			
+			PFRotationField(acl::VectorOfElements rotationAxis, 
+			                acl::VectorOfElements center);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+
+	///\ingroup PF
+	class PFSign: public PFUnaryOperation
+	{
+		public:
+			PFSign(SPPositionFunction a);
+			virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
+	};
+
+	///\ingroup PF
+	SPPositionFunction generatePFLinear(const AVec<double> & g, double p0);
+	///\ingroup PF
+	template <typename T> 		
+		SPPositionFunction generatePFLinear(const AVec<double> & g, UValue<T> p0);
+
+	///\ingroup PF
+	SPPositionFunction generatePFConstant(const AVec<double> & a);
+	///\ingroup PF
+	SPPositionFunction generatePFConstant(double a);
+	///\ingroup PF
+	SPPositionFunction generatePFRotationField(const AVec<double> & axis, 
+	                                           const AVec<double> & c);
+
+
+	///\ingroup PF
+	inline SPPositionFunction operator+(SPPositionFunction a, SPPositionFunction b);
+	///\ingroup PF
+	inline SPPositionFunction operator-(SPPositionFunction a, SPPositionFunction b);
+	///\ingroup PF
+	inline SPPositionFunction operator-(SPPositionFunction a);
+	///\ingroup PF
+	inline SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b);
+	///\ingroup PF
+	inline SPPositionFunction sign(SPPositionFunction a);
+
+	///\ingroup PF
+	SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b, 
+	                                                      SPPositionFunction df, 
+	                                                      unsigned int gN,
+	                                                      acl::TypeID t);
+
+
+	/// Initialize \p d by \p f \ingroup PF
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPPositionFunction f);
+	/// Initialize \p d by \p f \ingroup PF
+	void initData(SPAbstractDataWithGhostNodes d, 
+	              SPPositionFunction f, 
+	              const acl::KernelConfiguration & k);
+
+
+//---------------------------- Implementation --------------------------------
+
+
+	inline SPPositionFunction operator+(SPPositionFunction a, SPPositionFunction b)
+	{
+		return SPPositionFunction(new PFOperationPlus(a,b));
+	}
+	
+	inline SPPositionFunction operator-(SPPositionFunction a, SPPositionFunction b)
+	{
+		return SPPositionFunction(new PFOperationMinus(a,b));
+	}
+
+	inline SPPositionFunction operator-(SPPositionFunction a)
+	{
+		return SPPositionFunction(new PFOperationInversion(a));
+	}
+
+	inline SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b)
+	{
+		return SPPositionFunction(new PFOperationProduct(a,b));
+	}
+
+	inline SPPositionFunction sign(SPPositionFunction a)
+	{
+		return SPPositionFunction(new PFSign(a));
+	}
+	
+}// asl
+
+#endif // ASLPositionFunction
diff --git a/src/math/aslProbeTemplates.cxx b/src/math/aslProbeTemplates.cxx
new file mode 100644
index 0000000..5178c5f
--- /dev/null
+++ b/src/math/aslProbeTemplates.cxx
@@ -0,0 +1,53 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslProbeTemplates.h"
+
+
+namespace asl
+{
+
+	ProbeTemplate::ProbeTemplate (int n, AVec<double>* vec)
+	{
+		vectors.resize(n);
+		for (int i(0); i < n; ++i)
+			vectors[i] = vec[i];
+	}
+		
+	AVec<double> probeD1q2Data[2] = {makeAVec(.5),makeAVec(-.5)};
+	ProbeTemplate probeD1q2(2, probeD1q2Data);
+
+	AVec<double> probeD2q3Data[3] = {makeAVec(0.,   1./sqrt(3.)),
+					 makeAVec(-.5,-1./sqrt(3.)/2.),
+					 makeAVec(.5, -1./sqrt(3.)/2.)};
+	ProbeTemplate probeD2q3(3, probeD2q3Data);
+
+	AVec<double> probeD3q4Data[4] = {makeAVec(0.,   0., sqrt(3.)/sqrt(8)),
+					 makeAVec( 1./sqrt(3.),     0., -1./sqrt(24.)),
+					 makeAVec(-1./sqrt(3.)/2.,-.5, -1./sqrt(24)),
+					 makeAVec(-1./sqrt(3.)/2., .5, -1./sqrt(24))};
+	ProbeTemplate probeD3q4(4, probeD3q4Data);
+
+
+		
+} // asl
diff --git a/src/math/aslProbeTemplates.h b/src/math/aslProbeTemplates.h
new file mode 100644
index 0000000..cbdef41
--- /dev/null
+++ b/src/math/aslProbeTemplates.h
@@ -0,0 +1,88 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLPROBETEMPLATES_H
+#define ASLPROBETEMPLATES_H
+
+#include "aslVectors.h"
+
+namespace asl {
+
+
+	class ProbeTemplate
+	{
+		public:
+			std::vector<AVec<double> > vectors;
+			ProbeTemplate(int n, AVec<double>* vec);		
+
+			inline unsigned int numberOfDimentions() const;
+	};
+
+	
+	/// A triangular probe 1D space
+	/**	
+	 \ingroup Templates
+		 
+	 \image html probeD1Q2.png "1D triangular probe"
+	*/
+	extern ProbeTemplate probeD1q2;
+
+	
+	/// A triangular probe 2D space
+	/**	
+	 \ingroup Templates
+		 
+	 \image html probeD2Q3.png "2D triangular probe"
+	*/
+	extern ProbeTemplate probeD2q3;
+
+	/// A triangular probe 3D space
+	/**	
+	 \ingroup Templates
+		 
+	 \image html probeD3Q4.png "3D triangular probe"
+	*/
+	extern ProbeTemplate probeD3q4;
+
+
+	/// returns template corresponding to minimal probes \ingroup Templates
+	/** asl::probeD1q2, asl::probeD2q3, asl::probeD3q4
+	*/
+	inline const ProbeTemplate* allMinimalProbeTemplate(unsigned int dimNumber);
+	
+// ----------------------------- Implementation -------------------------
+
+	unsigned int ProbeTemplate::numberOfDimentions() const
+	{
+		return vectors[0].getSize();
+	}
+
+	inline const ProbeTemplate* minimalProbeTemplate(unsigned int dimNumber)
+	{
+		static ProbeTemplate* vt[3]={&probeD1q2,&probeD2q3,&probeD3q4};
+		return vt[dimNumber-1];
+	}
+	
+}// asl
+
+#endif // TEMPL_H_INCLUDED
diff --git a/src/math/aslTemplateVE.cxx b/src/math/aslTemplateVE.cxx
new file mode 100644
index 0000000..24562e7
--- /dev/null
+++ b/src/math/aslTemplateVE.cxx
@@ -0,0 +1,314 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTemplateVE.h"
+#include "acl/acl.h"
+#include "acl/aclGenerators.h"
+#include <aslUtilities.h>
+
+namespace asl
+{
+	TemplateVE::TemplateVE()
+	{
+	}
+
+
+	void TemplateVE::init(AbstractDataWithGhostNodes & data,
+	                      const VectorTemplate & vectorT,
+	                      unsigned int k,
+	                      bool bIni)
+	{
+		vectorTemplate=&vectorT;
+		vto=vtObject(vectorTemplate);
+		unsigned int nV(vectorTemplate->vectors.size());
+		
+		if (data.getEContainer().size()<1) 
+			errorMessage ("TemplateVE: The input data has wrong number of components: " + 
+			              numToStr(data.getEContainer().size()));
+		if (data.getEContainer().size()<=k) 
+			errorMessage ("TemplateVE: The input data has less components than asked: " + 
+			              numToStr(data.getEContainer().size())+", k="+ numToStr(k));
+		acl::TypeID t(acl::getElementType(data.getEContainer()));
+
+		if (bIni)
+		{
+			if((values.size()!=nV) || initValues.size()==0)
+				copy(acl::generateVEPrivateVariable(nV, t), values);
+			initValues.resize(nV);
+
+			using namespace	acl::elementOperators;
+			acl::Element e(acl::generateSubElement(data.getEContainer()[k],
+			                                       data.getSubContainerSize(),
+			                                       data.getSubContainerOffset()));
+			for (unsigned int i(0); i < values.size(); ++i)
+			{
+				int offset(data.getBlock().c2i(vectorTemplate->vectors[i]));
+				initValues[i] =generateShiftedElement(e,offset);
+			}
+			copy(values=initValues,initValues);
+		}
+		else
+		{
+			initValues.resize(0);
+			values.resize(nV);
+
+			using namespace	acl::elementOperators;
+			acl::Element e(acl::generateSubElement(data.getEContainer()[k],
+			                                       data.getSubContainerSize(),
+			                                       data.getSubContainerOffset()));
+			for (unsigned int i(0); i < values.size(); ++i)
+			{
+				int offset(data.getBlock().c2i(vectorTemplate->vectors[i]));
+				values[i] =generateShiftedElement(e,offset);
+			}
+		}
+	}
+
+	void TemplateVE::init(DistanceFunction & data,
+	                      acl::VectorOfElements & position,
+	                      const VectorTemplate & vectorT,
+	                      unsigned int k)
+	{
+		vectorTemplate=&vectorT;
+		vto=vtObject(vectorTemplate);
+		unsigned int nV(vectorTemplate->vectors.size());
+		initValues.resize(nV);
+		acl::TypeID t(acl::getElementType(position));
+
+		if(values.size()!=nV)
+			copy(acl::generateVEPrivateVariable(nV, t), values);
+
+		using namespace	acl::elementOperators;
+		for (unsigned int i(0); i < values.size(); ++i)
+			initValues[i] =data.getDistance(position + vectorTemplate->vectors[i])[0];
+		copy(values=initValues,initValues);
+	}
+	
+	TemplateVE::TemplateVE(AbstractDataWithGhostNodes & data, 
+	                       const VectorTemplate & vectorT, 
+	                       unsigned int k,
+	                       bool bIni)
+	{
+		init(data,vectorT,k,bIni);
+	}
+
+	TemplateVE::TemplateVE(DistanceFunction & data,
+	                       acl::VectorOfElements & position, 
+	                       const VectorTemplate & vectorT, 
+	                       unsigned int k)
+	{
+		init(data, position,vectorT,k);
+	}
+	
+	TemplateVE::TemplateVE(const acl::VectorOfElements & val, 
+	                       const VectorTemplate & vectorT):
+		vectorTemplate(&vectorT),
+		vto(vtObject(&vectorT)),
+		values(val),
+		initValues(acl::generateVEConstantN (vectorTemplate->vectors.size(),0.))
+	{
+	}
+
+		
+	acl::VectorOfElements TemplateVE::getValue(unsigned int i)
+	{
+		return subVE(values,i);
+	}
+
+	TemplateVE operator+ (const TemplateVE &a, const TemplateVE &b)
+	{
+		if (a.vectorTemplate != b.vectorTemplate)
+			errorMessage ("Two TemplateVE corespond to different templates");
+		return TemplateVE (a.values+b.values,*a.vectorTemplate);
+	}
+	TemplateVE operator- (const TemplateVE &a, const TemplateVE &b)	
+	{
+		if (a.vectorTemplate != b.vectorTemplate)
+			errorMessage ("Two TemplateVE corespond to different templates");
+		return TemplateVE (a.values-b.values,*a.vectorTemplate);
+	}
+	TemplateVE operator* (const TemplateVE &a, const TemplateVE &b)	
+	{
+		if (a.vectorTemplate != b.vectorTemplate)
+			errorMessage ("Two TemplateVE corespond to different templates");		
+		return TemplateVE (productOfElements (a.values,b.values),*a.vectorTemplate);
+	}
+
+	TemplateVE operator/ (const TemplateVE &a, const TemplateVE &b)
+	{
+		if (a.vectorTemplate != b.vectorTemplate)
+			errorMessage ("Two TemplateVE corespond to different templates");		
+		return TemplateVE (divisionOfElements (a.values,b.values),*a.vectorTemplate);
+	}
+		           
+	acl::VectorOfElements laplas(const TemplateVE & a)
+	{
+		using namespace acl;
+		return a.values*generateVEConstant (a.vectorTemplate->laplasCoefs);
+	}
+
+	acl::VectorOfElements dx(const TemplateVE & a)
+	{
+		using namespace acl;
+		unsigned int nD(a.vectorTemplate->numberOfDimentions());
+		if (nD<1)
+			errorMessage ("(dx) The dimensionality lees than 1");		
+
+		return a.values*generateVEConstant(a.vectorTemplate->dxCoefs[0]);
+	}
+
+	acl::VectorOfElements dy(const TemplateVE & a)
+	{
+		using namespace acl;
+		unsigned int nD(a.vectorTemplate->numberOfDimentions());
+		if (nD<2)
+			errorMessage ("(dy) The dimensionality lees than 2");		
+
+		return a.values*generateVEConstant(a.vectorTemplate->dxCoefs[1]);
+	}
+
+	acl::VectorOfElements dz(const TemplateVE & a)
+	{
+		using namespace acl;
+		unsigned int nD(a.vectorTemplate->numberOfDimentions());
+		if (nD<3)
+			errorMessage ("(dz) The dimensionality lees than 3");		
+
+		return a.values*generateVEConstant(a.vectorTemplate->dxCoefs[2]);
+	}
+		
+	acl::VectorOfElements dxi(const TemplateVE & a, unsigned int i)
+	{
+		using namespace acl;
+		unsigned int nD(a.vectorTemplate->numberOfDimentions());
+		if (nD<i)
+			errorMessage ("(dxi) The dimensionality lees than "+ numToStr(i));		
+
+		return a.values*generateVEConstant(a.vectorTemplate->dxCoefs[i]);
+	}
+		
+	acl::VectorOfElements gradient(const TemplateVE & a)
+	{
+		using namespace acl;
+		VectorOfElements r(a.values * 
+		                   generateVEConstant (a.vectorTemplate->dxCoefs[0]));
+		unsigned int nD(a.vectorTemplate->numberOfDimentions());
+		for (unsigned int i(1); i < nD; ++i)
+			copy(cat(r,
+			         a.values * 
+			         generateVEConstant(a.vectorTemplate->dxCoefs[i])),
+			     r);
+		return r;
+	}
+
+	acl::VectorOfElements div(const TemplateVE & ax, 
+	                          const TemplateVE & ay)
+	{
+		return dx(ax)+dy(ay);
+	}
+
+	acl::VectorOfElements div(const TemplateVE & ax, 
+	                          const TemplateVE & ay, 
+	                          const TemplateVE & az)
+	{
+		return dx(ax)+dy(ay)+dz(az);
+	}
+
+	acl::VectorOfElements div(const vector<TemplateVE> & a)
+	{
+		using namespace acl;
+		unsigned int nD(a[0].vectorTemplate->numberOfDimentions());
+		if (nD!=a.size())
+			errorMessage ("(div) The dimensionality of the underline template does not equal to the number of components");		
+
+		auto res(dxi(a[0], 0));
+		for(unsigned int i(1); i<nD; ++i)         
+			copy(res + dxi(a[i], i), res);
+		return res;
+	}
+		
+	acl::VectorOfElements divProduct(const vector<TemplateVE> & a, const TemplateVE & c)
+	{
+		unsigned int nD(a[0].vectorTemplate->numberOfDimentions());
+		unsigned int nv(a[0].values.size());
+		
+//		return a.values*generateVEConstant(a.vectorTemplate->dxCoefs[i]);
+		vector<acl::VectorOfElements> a0(nD);
+		for(unsigned int i(0); i<nD; ++i)
+			copy(catN(subVE(a[i].values,0),nv), a0[i]);
+		acl::VectorOfElements c0(catN(subVE(c.values,0),nv));
+		auto res(0.5 * productOfElements((a[0].values + a0[0]), (c.values + c0)) * 
+		         acl::generateVEConstant(a[0].vectorTemplate->dxCoefs[0]));
+		for(unsigned int i(1); i<nD; ++i)         
+			copy(res + 
+			     0.5 * productOfElements((a[i].values + a0[i]), (c.values + c0)) * 
+		         acl::generateVEConstant(a[0].vectorTemplate->dxCoefs[i]), res);
+		return res;
+	}
+		
+	acl::VectorOfElements divAgradB(const TemplateVE & a, const TemplateVE & b)
+	{
+		if (a.vectorTemplate != b.vectorTemplate) 
+			errorMessage ("divAgradB: \"a\" and \"b\" have different templates");
+
+		unsigned int nv(a.values.size());
+		acl::VectorOfElements a0(catN(subVE(a.values,0),nv));
+		acl::VectorOfElements b0(catN(subVE(b.values,0),nv));
+		acl::VectorOfElements coefs(acl::generateVEConstant (a.vectorTemplate->gradientCoefs));
+		
+		return productOfElements(coefs,a.values+a0)*(b.values-b0);
+	}
+
+	acl::VectorOfElements dIdJ(unsigned int i, unsigned int j, const TemplateVE & a)
+	{
+		using namespace acl;
+		acl::VectorOfElements a0(catN(subVE(a.values,0),a.values.size()));
+		acl::VectorOfElements coefs(acl::generateVEConstant (a.vectorTemplate->dIdJCoefs[i][j]));
+		acl::VectorOfElements coefLap(acl::generateVEConstant (a.vectorTemplate->dIdJLapCoef));
+		if (i==j)
+			return coefs*(a.values-a0)-coefLap*laplas(a);
+		return coefs*(a.values-a0);
+	}
+		
+	acl::VectorOfElements interpolate(const TemplateVE & a, acl::VectorOfElements e)
+	{
+		auto & vt(*a.vectorTemplate); 
+		unsigned int nd(nD(vt));
+		AVec<> one(nd,1.);
+		acl::VectorOfElements res(1);
+		copy(productOfElements((one - AVec<>(vt.vectors[0])) + 
+		                        acl::productOfElements(acl::generateVEConstant(2.* AVec<>(vt.vectors[0]) -one), e)) * 
+		     subVE(a.values,0),
+		     res); 
+		for(unsigned int i(1); i < a.values.size(); ++i)
+			copy(productOfElements((one - AVec<>(vt.vectors[i])) + 
+			                        acl::productOfElements(acl::generateVEConstant(2.* AVec<>(vt.vectors[i]) -one), e)) * 
+				 subVE(a.values,i) + 
+			     res,
+			 	 res); 
+			
+		return res;
+	}
+
+		
+}// asl
diff --git a/src/math/aslTemplateVE.h b/src/math/aslTemplateVE.h
new file mode 100644
index 0000000..6fcc010
--- /dev/null
+++ b/src/math/aslTemplateVE.h
@@ -0,0 +1,155 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef TEMPLATEVE_H_INCLUDED
+#define TEMPLATEVE_H_INCLUDED
+
+#include <acl/aclMath/aclVectorOfElements.h>
+#include "data/aslDataWithGhostNodes.h"
+#include "aslTemplatesExtras.h"
+#include "aslDistanceFunction.h"
+
+/**
+ \defgroup DifferentialOpperators Differential Operrators
+ */
+
+
+namespace asl
+{
+	/// This class contains VectorOfElements which corresponds to values of a field in littice nodes
+	/**
+		 This class contains VectorOfElements (VE) with PrivateVariables. 
+		 This list should be added to the kernel before use as follows:
+			
+		 \code 
+			 Kernel kernel;
+			 TemplateVE a;
+
+			 kernel<<a.initValues;
+		 \endcode
+	*/
+	class TemplateVE
+	{
+		public:
+			const VectorTemplate* vectorTemplate;
+			const VTObjects* vto;
+			acl::VectorOfElements values;
+			acl::VectorOfElements initValues;
+			/**
+			 \param data is a data field
+			 \param vectorT is a tempate vector
+			 \param i is the number of component (for a case with multicomponent data)
+			 \param bIni incase of true it generates private variable for storage otherwise it uses direct acces  
+			 */
+			TemplateVE(AbstractDataWithGhostNodes & data, 
+			           const VectorTemplate & vectorT, 
+			           unsigned int i=0,
+			           bool bIni=true);
+			/**
+			 \param data is a data field
+			 \param position contains current position (not index)
+			 \param vectorT is a tempate vector
+			 \param i is the number of component (for a case with multicomponent data)
+			 */
+			TemplateVE(DistanceFunction & data,
+			           acl::VectorOfElements & position,
+			           const VectorTemplate & vectorT, 
+			           unsigned int i=0);
+			///this is used for matematical operations with TemplateVE
+			TemplateVE(const acl::VectorOfElements & val, 
+			           const VectorTemplate & vectorT);
+			
+			TemplateVE();
+			acl::VectorOfElements getValue(unsigned int i);
+			/** 
+			 Note: the init function does not make initialization of values in case
+			 whete its length remains the same. this is usefull for reuse of private variables
+
+			 \param data is a data field
+			 \param vectorT is a tempate vector
+			 \param i is the number of component (for a case with multicomponent data)
+			 \param bIni incase of true it generates private variable for storage otherwise it uses direct acces  
+			 */
+			void init(AbstractDataWithGhostNodes & data, 
+			          const VectorTemplate & vectorT, 
+			          unsigned int i=0,
+			          bool bIni=true);
+
+			/** 
+			 Note: the init function does not make initialization of values in case
+			 whete its length remains the same. this is usefull for reuse of private variables
+			 \todo Fnish!!! not distance functino but Position function
+			 */
+			void init(DistanceFunction & data,
+			          acl::VectorOfElements & position,
+			          const VectorTemplate & vectorT, 
+			          unsigned int i=0);
+	}; // class TemplateVE
+
+	TemplateVE operator+ (const TemplateVE &a, const TemplateVE &b);
+	TemplateVE operator- (const TemplateVE &a, const TemplateVE &b);	
+	TemplateVE operator* (const TemplateVE &a, const TemplateVE &b);	
+	TemplateVE operator/ (const TemplateVE &a, const TemplateVE &b);		
+	
+	/// differential operator \f$ \Delta a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements laplas(const TemplateVE & a);
+
+	/// differential operator \f$ \vec\nabla a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements gradient(const TemplateVE & a);	
+	/// differential operator \f$ \partial_x a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements dx(const TemplateVE & a);
+	/// differential operator \f$ \partial_y a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements dy(const TemplateVE & a);
+	/// differential operator \f$ \partial_z a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements dz(const TemplateVE & a);	
+	/// differential operator \f$ \partial_{i} a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements dxi(const TemplateVE & a, unsigned int i);
+	
+	/// differential operator \f$ \nabla(a \nabla b) \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements divAgradB(const TemplateVE & a, const TemplateVE & b);	
+
+	/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements div(const vector<TemplateVE> & a);	
+	/// differential operator \f$ \nabla \cdot (\vec a c) \f$ \ingroup DifferentialOpperators
+	/**
+		 This is a discret approximation discribef by the following expression:
+		 \f[ \nabla_\alpha (v_\alpha c) = \frac{1}{2}\sum_i w_i a_{i\alpha} (v_{0\alpha}+v_{i\alpha})(c_0+c_i) ) \f]
+		where \f$ w_i \f$ are coefficients corresponding to a gradient ones
+	*/
+	acl::VectorOfElements divProduct(const vector<TemplateVE> & a, const TemplateVE & c);	
+	/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements div(const TemplateVE & ax, const TemplateVE & ay);	
+	/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements div(const TemplateVE & ax, const TemplateVE & ay, const TemplateVE & az);	
+
+	
+	/// differential operator \f$ \nabla_i \nabla_j a \f$ \ingroup DifferentialOpperators
+	acl::VectorOfElements dIdJ(unsigned int i, unsigned int j, const TemplateVE & a);
+
+	///  generates expresion for bilinear interpolation the template should be an elementary cell 
+	acl::VectorOfElements interpolate(const TemplateVE & a, acl::VectorOfElements e);
+
+	
+}// asl
+
+#endif // TEMPLATEVE_H_INCLUDED
diff --git a/src/math/aslTemplateVEExtras.cxx b/src/math/aslTemplateVEExtras.cxx
new file mode 100644
index 0000000..5f9b7a0
--- /dev/null
+++ b/src/math/aslTemplateVEExtras.cxx
@@ -0,0 +1,76 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTemplateVE.h"
+#include "acl/acl.h"
+#include "acl/aclGenerators.h"
+#include <aslUtilities.h>
+
+using acl::VectorOfElements;
+using acl::Element;
+
+namespace asl
+{
+
+	acl::VectorOfElements cellValues(const TemplateVE & a, unsigned int iEl)
+	{
+		if(iEl >= a.vto->elementaryCells.size())
+			errorMessage("cellValues: iEl larger than the number of cells");
+		auto cell(a.vto->elementaryCells[iEl]);
+		unsigned int nv(cell.getSize());
+		
+		acl::VectorOfElements valI(nv);
+		for(unsigned int ii(0); ii < nv; ++ii)
+			valI[ii] = subVE(a.values,cell[ii])[0];
+
+		return valI;
+	}
+
+	
+	VectorOfElements gradient(const TemplateVE & a, unsigned int iEl)
+	{
+		return a.vto->cellGradient(a.values, iEl);
+	}
+	
+	vector<Element> gcGradientAllCells(const TemplateVE & a, 
+	                                   vector<VectorOfElements> & values)
+	{
+		unsigned int nCells(a.vto->elementaryCells.size());
+		unsigned int nDim(nD(*a.vectorTemplate));
+		auto type(getElementType(a.values));
+
+		values.resize(nCells);
+		for(unsigned int i(0); i < nCells; ++i)
+			copy(acl::generateVEPrivateVariable(nDim, type),values[i]);
+
+		acl::VectorOfElements code;
+		copy(values[0] =  gradient(a, 0), code);
+		for(unsigned int i(1); i < nCells; ++i)
+			copy(cat(code, values[i] =  gradient(a, i)), 
+			     code);			
+
+		return code;
+	}
+		
+		
+}// asl
diff --git a/src/math/aslTemplateVEExtras.h b/src/math/aslTemplateVEExtras.h
new file mode 100644
index 0000000..b5a8798
--- /dev/null
+++ b/src/math/aslTemplateVEExtras.h
@@ -0,0 +1,55 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef TEMPLATEVEEXTRAS_H_INCLUDED
+#define TEMPLATEVEEXTRAS_H_INCLUDED
+
+#include <acl/aclMath/aclVectorOfElements.h>
+#include "data/aslDataWithGhostNodes.h"
+#include "aslTemplates.h"
+
+/**
+ \defgroup DifferentialOpperators Differential Operrators
+ */
+
+namespace asl
+{
+	/// returns VectorOfElements containing values in cell corners \ingroup DifferentialOpperators 
+	acl::VectorOfElements cellValues(const TemplateVE & a, unsigned int iEl);
+
+	/// differential operator \f$ \vec\nabla a \f$ within a cell \ingroup DifferentialOpperators
+	acl::VectorOfElements gradient(const TemplateVE & a, unsigned int iEl);
+
+	/// differential operator \f$ \vec\nabla a \f$ within all cells \ingroup DifferentialOpperators
+	/**
+		The function generates code that computes the gradient values in each cell. The
+		 gradient values are written in \p values which are private variables. The corresponding 
+		 amount of variables are automaticaly generated.
+	*/
+	vector<acl::Element> gcGradientAllCells(const TemplateVE & a, 
+	                                        vector<acl::VectorOfElements> & values);
+	
+		
+}// asl
+
+#endif // TEMPLATEVEEXTRAS_H_INCLUDED
diff --git a/src/math/aslTemplates.cxx b/src/math/aslTemplates.cxx
new file mode 100644
index 0000000..e5f3eb1
--- /dev/null
+++ b/src/math/aslTemplates.cxx
@@ -0,0 +1,277 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTemplates.h"
+
+
+namespace asl
+{
+	
+	VectorTemplate::VectorTemplate (int n, AVec<int>* vec)
+	{
+		vectors.resize(n);
+		for (int i(0); i < n; ++i)
+			vectors[i] = vec[i];
+		buildInvertVectorList();
+	}
+
+	VectorTemplate::VectorTemplate (int n, AVec<int>* vec, double* lc, double* gc):
+		dIdJLapCoef(0.5)
+	{
+		vectors.resize(n);
+		laplasCoefs.resize(n);
+		gradientCoefs.resize(n);
+		quasiparticlesCoefs.resize(n);
+		unsigned int nD(vec[0].getSize());
+		dxCoefs.resize(nD);
+		for (unsigned int i(0); i < nD; ++i)
+			dxCoefs[i].resize(n);
+		dIdJCoefs.resize(nD);
+		for (unsigned int i(0); i < nD; ++i){
+			dIdJCoefs[i].resize(nD);
+			for (unsigned int j(0); j<nD; ++j)
+				dIdJCoefs[i][j].resize(n);
+		}
+		for (int i(0); i < n; ++i)
+		{
+			vectors[i] = vec[i];
+			laplasCoefs[i] = lc[i];
+			gradientCoefs[i] = gc[i];
+			quasiparticlesCoefs[i] = lc[i]/6.;
+			for (unsigned int k(0); k < nD; ++k)
+			{
+				dxCoefs[k][i] = gradientCoefs[i] * vectors[i][k];
+				for (unsigned int m(0); m < nD; ++m)
+					dIdJCoefs[k][m][i] = gradientCoefs[i] * vectors[i][k] * vectors[i][m] * 3.;
+			}
+		}
+		quasiparticlesCoefs[0] += 1.;
+		buildInvertVectorList();
+	}
+
+	void VectorTemplate::buildInvertVectorList()
+	{
+		unsigned int n(vectors.size());
+		invertVectors.resize(n);
+		for(unsigned int i(0); i < n; ++i)
+			for(unsigned int j(i+1); j < n; ++j)
+				if(vectors[i] == -vectors[j])
+				{
+					invertVectors[i] = j;
+					invertVectors[j] = i;
+				}
+	}
+		
+	const VectorTemplate & d1q2ec()
+	{	
+		static AVec<int> d1q2ecData[2] = {makeAVec(0),makeAVec(1)};
+		static VectorTemplate vt(2, d1q2ecData);
+		return  vt;
+	}
+
+	const VectorTemplate & d2q4ec()
+	{
+		static AVec<int> d2q4ecData[4] = {makeAVec(0,0),makeAVec(1,0),makeAVec(0,1),makeAVec(1,1)};
+		static VectorTemplate vt(4, d2q4ecData);
+		return vt;
+	}	
+
+	const VectorTemplate & d3q8ec()
+	{
+		static AVec<int> d3q8ecData[8] ={makeAVec(0,0,0),makeAVec(1,0,0),makeAVec(0,1,0),makeAVec(1,1,0),
+							 makeAVec(0,0,1),makeAVec(1,0,1),makeAVec(0,1,1),makeAVec(1,1,1)};
+		static VectorTemplate vt(8, d3q8ecData);
+		return vt;
+	}	
+
+	const VectorTemplate & d1q3()
+	{
+		static AVec<int> d1q3DataV[3] ={makeAVec(0),makeAVec(1),makeAVec(-1)};
+		static double d1q3DataLC[3] = {-2,1,1};	
+		static double d1q3DataGC[3] = {0,.5,.5};	
+		static VectorTemplate vt(3, d1q3DataV,d1q3DataLC,d1q3DataGC);
+		return vt;
+	}	
+
+		
+	const VectorTemplate & d2q5()
+	{
+		static AVec<int> d2q5DataV[5] ={makeAVec(0,0),makeAVec(1,0),makeAVec(0,1),makeAVec(-1,0), makeAVec(0,-1)};
+		static double d2q5DataLC[5] = {-4,1,1,1,1};	
+		static double d2q5DataGC[5] = {0,.5,.5,.5,.5};	
+		static VectorTemplate vt(5, d2q5DataV,d2q5DataLC,d2q5DataGC);
+		return vt;
+	}	
+
+	const VectorTemplate & d2q9()
+	{
+		static AVec<int> d2q9DataV[9] = {makeAVec(0,0),makeAVec(1,0),makeAVec( 0,1),makeAVec(-1, 0), makeAVec(0,-1),
+			                                           makeAVec(1,1),makeAVec(-1,1),makeAVec(-1,-1), makeAVec(1,-1)};
+		static double d2q9DataLC[9] = {-10./3.,2./3.,2./3.,2./3.,2./3.,1./6.,1./6.,1./6.,1./6.};	
+		static double d2q9DataGC[9] = {0,1./3.,1./3.,1./3.,1./3.,1./12.,1./12.,1./12.,1./12.};	
+		static VectorTemplate vt(9, d2q9DataV,d2q9DataLC,d2q9DataGC);
+		return vt;
+	}	
+		
+	const VectorTemplate & d3q7()
+	{
+		static AVec<int> d3q7DataV[7] = {makeAVec(0,0,0),makeAVec(1,0,0), makeAVec(0,1,0), makeAVec(0,0,1),
+												  makeAVec(-1,0,0),makeAVec(0,-1,0),makeAVec(0,0,-1)};
+		static double d3q7DataLC[7] = {-6,1,1,1,1,1,1};	
+		static double d3q7DataGC[7] = {0,.5,.5,.5,.5,.5,.5};	
+		static VectorTemplate vt(7, d3q7DataV,d3q7DataLC,d3q7DataGC);
+		return vt;
+	}	
+
+	const VectorTemplate & d3q15()
+	{
+		static AVec<int> d3q15DataV[15] = {makeAVec(0,0,0),makeAVec(1,0,0),  makeAVec(0,1,0), makeAVec(0,0,1),
+											  makeAVec(-1,0,0), makeAVec(0,-1,0),makeAVec(0,0,-1),
+											  makeAVec(1,1,1),  makeAVec(1,1,-1),makeAVec(1,-1,1),
+											  makeAVec(1,-1,-1),makeAVec(-1,1,1),makeAVec(-1,1,-1),
+											  makeAVec(-1,-1,1),makeAVec(-1,-1,-1)};
+		static double d3q15DataLC[15] = {-14./3.,2./3.,2./3.,2./3.,
+										2./3.,2./3.,2./3.,
+										1./12.,1./12.,1./12.,
+										1./12.,1./12.,1./12.,
+										1./12.,1./12.};	
+		static double d3q15DataGC[15] = {0,	1./3.,1./3.,1./3.,
+										1./3.,1./3.,1./3.,
+										1./24.,1./24.,1./24.,
+										1./24.,1./24.,1./24.,
+										1./24.,1./24.};	
+		static VectorTemplate vt(15, d3q15DataV,d3q15DataLC,d3q15DataGC);
+		return vt;
+	}	
+	
+
+	const VectorTemplate & d3q19()
+	{
+		static AVec<int> d3q19DataV[19] = {makeAVec(0,0,0),makeAVec(1,0,0),  makeAVec(0,1,0),  makeAVec(0,0,1),
+											  makeAVec(-1,0,0), makeAVec(0,-1,0), makeAVec(0,0,-1),
+											  makeAVec(1,1,0),  makeAVec(1,-1,0), makeAVec(-1,-1,0),
+											  makeAVec(-1,1,0), makeAVec(0,1,1),  makeAVec(0,1,-1),
+											  makeAVec(0,-1,-1),makeAVec(0,-1,1), makeAVec(1,0,1),
+											  makeAVec(1,0,-1), makeAVec(-1,0,-1),makeAVec(-1,0,1)};
+
+		static double d3q19DataLC[19] = {-4.,1./3.,1./3.,1./3.,1./3.,1./3.,1./3.,
+									1./6.,1./6.,1./6.,1./6.,1./6.,1./6.,
+									1./6.,1./6.,1./6.,1./6.,1./6.,1./6.};	
+		static double d3q19DataGC[19] = {0,	1./6.,1./6.,1./6.,1./6.,1./6.,1./6.,
+									1./12.,1./12.,1./12.,1./12.,1./12.,1./12.,
+									1./12.,1./12.,1./12.,1./12.,1./12.,1./12.};	
+		static VectorTemplate vt(19, d3q19DataV,d3q19DataLC,d3q19DataGC);
+		return vt;
+	}	
+
+	const VectorTemplate & d3q27()
+	{
+		static AVec<int> d3q27DataV[27] = {makeAVec(0,0,0),makeAVec(1,0,0),  makeAVec(0,1,0),  makeAVec(0,0,1),
+												  makeAVec(-1,0,0), makeAVec(0,-1,0), makeAVec(0,0,-1),
+												  makeAVec(1,1,0),  makeAVec(1,-1,0), makeAVec(-1,-1,0),
+												  makeAVec(-1,1,0), makeAVec(0,1,1),  makeAVec(0,1,-1),
+												  makeAVec(0,-1,-1),makeAVec(0,-1,1), makeAVec(1,0,1),
+												  makeAVec(1,0,-1), makeAVec(-1,0,-1),makeAVec(-1,0,1),
+												  makeAVec(1,1,1),  makeAVec(1,1,-1),makeAVec(1,-1,1),
+												  makeAVec(1,-1,-1),makeAVec(-1,1,1),makeAVec(-1,1,-1),
+												  makeAVec(-1,-1,1),makeAVec(-1,-1,-1)};
+		static VectorTemplate vt(27, d3q27DataV);
+		return vt;
+	}	
+		
+	const VectorTemplate & d1q1uv()
+	{
+		static AVec<int> d1q1uvData[1] = {makeAVec(1)};
+		static VectorTemplate vt(1, d1q1uvData);
+		return vt;
+	}	
+
+	const VectorTemplate & d2q2uv()
+	{
+		static AVec<int> d2q2uvData[2] = {makeAVec(1,0),makeAVec(0,1)};
+		static VectorTemplate vt(2, d2q2uvData);
+		return vt;
+	}	
+
+	const VectorTemplate & d3q3uv()
+	{
+		static AVec<int> d3q3uvData[3] ={makeAVec(1,0,0),makeAVec(0,1,0),makeAVec(0,0,1)};
+		static VectorTemplate vt(3, d3q3uvData);
+		return vt;
+	}	
+
+	const VectorTemplate & d1q2()
+	{
+		static AVec<int> d1q2DataV[2] ={makeAVec(1),makeAVec(-1)};	
+		static VectorTemplate vt(2, d1q2DataV);
+		return vt;
+	}	
+
+	const VectorTemplate & d2q4()
+	{
+		static AVec<int> d2q4DataV[4] ={makeAVec(1,0),makeAVec(0,1),makeAVec(-1,0), makeAVec(0,-1)};
+		static VectorTemplate vt(4, d2q4DataV);
+		return vt;
+	}	
+		
+	const VectorTemplate & d3q6()
+	{
+		static AVec<int> d3q6DataV[6] = {makeAVec(1,0,0), makeAVec(0,1,0), makeAVec(0,0,1),
+								makeAVec(-1,0,0),makeAVec(0,-1,0),makeAVec(0,0,-1)};
+		static VectorTemplate vt(6, d3q6DataV);
+		return vt;
+	}	
+
+
+	const VectorTemplate & d2q8()
+	{
+		static AVec<int> d2q8DataV[8] ={makeAVec(1,0),makeAVec(0,1),makeAVec(-1,0), makeAVec(0,-1),
+							 makeAVec(1,1),makeAVec(-1,1),makeAVec(-1,-1),makeAVec(1,-1)};
+		static VectorTemplate vt(8, d2q8DataV);
+		return vt;
+	}	
+		
+	const VectorTemplate & d3q14()
+	{
+		static AVec<int> d3q14DataV[14] = {makeAVec(1,0,0),  makeAVec(0,1,0), makeAVec(0,0,1),
+								makeAVec(-1,0,0), makeAVec(0,-1,0),makeAVec(0,0,-1),
+								makeAVec(1,1,1),  makeAVec(1,1,-1),makeAVec(1,-1,1),
+								makeAVec(1,-1,-1),makeAVec(-1,1,1),makeAVec(-1,1,-1),
+								makeAVec(-1,-1,1),makeAVec(-1,-1,-1)};
+		static VectorTemplate vt(14, d3q14DataV);
+		return vt;
+	}	
+
+	const VectorTemplate & d3q18()
+	{
+		static AVec<int> d3q18DataV[18] = {makeAVec(1,0,0),  makeAVec(0,1,0),  makeAVec(0,0,1),
+							    makeAVec(-1,0,0), makeAVec(0,-1,0), makeAVec(0,0,-1),
+								makeAVec(1,1,0),  makeAVec(1,-1,0), makeAVec(-1,-1,0),
+								makeAVec(-1,1,0), makeAVec(0,1,1),  makeAVec(0,1,-1),
+								makeAVec(0,-1,-1),makeAVec(0,-1,1), makeAVec(1,0,1),
+								makeAVec(1,0,-1), makeAVec(-1,0,-1),makeAVec(-1,0,1)};
+		static VectorTemplate vt(18, d3q18DataV);
+		return vt;
+	}	
+		
+}// asl
diff --git a/src/math/aslTemplates.h b/src/math/aslTemplates.h
new file mode 100644
index 0000000..42e3373
--- /dev/null
+++ b/src/math/aslTemplates.h
@@ -0,0 +1,853 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLTEMPLATES_H
+#define ASLTEMPLATES_H
+
+#include "aslVectors.h"
+//#include "aslSVectors.h"
+
+namespace asl {
+
+/**
+ \defgroup Templates Vector Templates
+ */
+	
+/**
+ \defgroup TemplatesNN Vector Templates: Nearest Neighbours
+ \ingroup Templates
+ */
+
+/**
+ \defgroup TemplatesNNP Vector Templates: Nearest Neighbours Plus
+ \ingroup Templates
+ */
+	
+/**
+ \defgroup TemplatesEC Vector Templates: Elementary Cells
+ \ingroup Templates
+ */
+	
+/**
+ \defgroup TemplatesNN0 Vector Templates: Nearest Neighbours without center
+ \ingroup Templates
+ */
+
+/**
+ \defgroup TemplatesNNP0 Vector Templates: Nearest Neighbours Plus without center
+ \ingroup Templates
+ */
+
+/// list of implemented names of VectorTemplate
+	enum VTName 
+	{
+		VTN_D1Q2EC,
+		VTN_D2Q4EC,	
+		VTN_D3Q8EC,
+		VTN_D1Q3,	
+		VTN_D2Q5,	
+		VTN_D2Q9,	
+		VTN_D3Q7,	
+		VTN_D3Q15,	
+		VTN_D3Q19,
+		VTN_D3Q27,
+		VTN_D1Q1UV,
+		VTN_D2Q2UV,	
+		VTN_D3Q3UV,
+		VTN_D1Q2,
+		VTN_D2Q4,
+		VTN_D3Q6,
+		VTN_D2Q8,
+		VTN_D3Q14,
+		VTN_D3Q18			
+	};
+
+	
+	/// Defines set of vectros with several properties \ingroup Templates
+	class VectorTemplate
+	{
+		private:
+			void buildInvertVectorList();
+		public:
+			std::vector<AVec<int> > vectors;
+			std::vector<double> laplasCoefs;
+			std::vector<double> gradientCoefs;
+			std::vector<double> quasiparticlesCoefs;
+			std::vector<unsigned int> invertVectors;
+			double dIdJLapCoef;
+			std::vector<std::vector<double>> dxCoefs;
+			std::vector<std::vector<std::vector<double>>> dIdJCoefs;
+			VectorTemplate(int n, AVec<int>* vec);		
+			VectorTemplate(int n, AVec<int>* vec, double* lc, double* gc);		
+
+			inline unsigned int numberOfDimentions() const;
+			inline AVec<int> getInverVector(unsigned int i);
+	};
+
+	inline unsigned int nD(const VectorTemplate & vt);
+		
+	///An elementary cell in 1D space
+	/**	
+	 \ingroup TemplatesEC
+		 
+	 This template defines an elementary cell: vectors and interpolation law
+	 \image html t2ec.png "1D elementary cell"
+	*/
+	const VectorTemplate & d1q2ec();
+	///An elementary cell in 2D space
+	/**	
+	 \ingroup TemplatesEC
+		 
+	 This template defines an elementary cell: vectors and interpolation law
+	 \image html t4ec.png "2D elementary cell"
+	*/
+	const VectorTemplate & d2q4ec();	
+	
+	///An elementary cell in 3D space
+	/**	
+	 \ingroup TemplatesEC
+		 
+	 This template defines an elementary cell: vectors and interpolation law
+	 \image html t8ec.png "3D elementary cell"
+	*/
+	const VectorTemplate & d3q8ec();
+	
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t3.png
+	*/	
+	const VectorTemplate & d1q3();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t5.png
+	*/	
+	const VectorTemplate & d2q5();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP
+		 
+	 \image html t9.png
+	*/	
+	const VectorTemplate & d2q9();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t7.png
+	*/
+	const VectorTemplate & d3q7();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP
+		 
+	 \image html t15.png
+	*/
+	const VectorTemplate & d3q15();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP
+		 
+	 \image html t19.png
+	*/
+	const VectorTemplate & d3q19();
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP
+		 
+	 \image html t27.png
+	*/
+	const VectorTemplate & d3q27();
+	
+	///An unit vector in 1D space
+	/**	
+	 \ingroup TemplatesNNP
+		 
+	 This template defines a unit vector
+	*/
+	const VectorTemplate & d1q1uv();
+	///An elementary cell in 2D space
+	/**	
+	 \ingroup Templates
+		 
+	 This template defines unit vectors
+	*/
+	const  VectorTemplate & d2q2uv();	
+	
+	///An elementary cell in 3D space
+	/**	
+	 \ingroup Templates
+		 
+	 This template defines unit vectors
+	*/
+	const VectorTemplate & d3q3uv();
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN0
+		 
+	 \image html t2.png
+	*/	
+	const VectorTemplate & d1q2();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN0
+		 
+	 \image html t4.png
+	*/	
+	const VectorTemplate & d2q4();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN0
+		 
+	 \image html t6.png
+	*/	
+	const VectorTemplate & d3q6();
+	
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP0
+	*/	
+	const VectorTemplate & d2q8();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP0
+ 	*/	
+	const VectorTemplate & d3q14();	
+	
+	///Vector template
+	/**	
+	 \ingroup TemplatesNNP0		 
+	*/	
+	const VectorTemplate & d3q18();	
+
+	/// returns template corresponding to nearest neighbours \ingroup Templates
+	/** asl::d1q3, asl::d2q5, asl::d3q7
+	*/
+	inline const VectorTemplate* nearestNeigboursVT(unsigned int dimNumber);
+
+	/// returns template corresponding to nearest neighbours without central point
+	/** 
+		 \ingroup Templates
+		 asl::d1q2, asl::d2q4, asl::d3q6
+	*/
+	inline const VectorTemplate* nearestNeigboursVT0(unsigned int dimNumber);
+
+	/// returns template corresponding to nearest neighbours plus \ingroup Templates
+	/** asl::d1q3, asl::d2q9, asl::d3q15
+	*/
+	inline const VectorTemplate* nearestNeigboursPVT(unsigned int dimNumber);
+
+	
+	/// returns template corresponding to all neighbours  
+	/** 
+		 \ingroup Templates
+		 asl::d1q3, asl::d2q9, asl::d3q27
+	*/
+	inline const VectorTemplate* allNeigboursVT(unsigned int dimNumber);
+
+	/// returns template corresponding to an elementary cell   
+	/** 
+		 \ingroup Templates
+		 asl::d1q2ec, asl::d2q4ec, asl::d3q8ec
+	*/
+	inline const VectorTemplate* elementaryCellVT(unsigned int dimNumber);
+
+	
+// ----------------------------- Implementation -------------------------
+
+	inline unsigned int VectorTemplate::numberOfDimentions() const
+	{
+		return vectors[0].getSize();
+	}
+
+	inline unsigned int nD(const VectorTemplate & vt)
+	{
+		return vt.numberOfDimentions();
+	}
+
+	
+	inline const VectorTemplate* nearestNeigboursVT(unsigned int dimNumber)
+	{
+		static const VectorTemplate* vt[3]={&d1q3(),&d2q5(),&d3q7()};
+		return vt[dimNumber-1];
+	}
+
+	inline const VectorTemplate* nearestNeigboursPVT(unsigned int dimNumber)
+	{
+		static const VectorTemplate* vt[3]={&d1q3(),&d2q9(),&d3q15()};
+		return vt[dimNumber-1];
+	}
+	
+	inline const VectorTemplate* allNeigboursVT(unsigned int dimNumber)
+	{
+		static const VectorTemplate* vt[3]={&d1q3(),&d2q9(),&d3q27()};
+		return vt[dimNumber-1];
+	}
+
+	inline const VectorTemplate* elementaryCellVT(unsigned int dimNumber)
+	{
+		static const VectorTemplate* vt[3]={&d1q2ec(),&d2q4ec(),&d3q8ec()};
+		return vt[dimNumber-1];
+	}
+	
+	inline AVec<int> VectorTemplate::getInverVector(unsigned int i)
+	{
+		return vectors[invertVectors[i]];
+	}
+	
+/*	
+	///The templates for the numerical schemas
+	namespace templ {
+		/// An abstract class for description of point templates for differential operators etc.
+		class GrigTemplate{
+			public:
+				unsigned const int nDimentions;
+				unsigned const int nPoints;
+				virtual vector<int> & getVector(unsigned int i)=0;
+			protected:
+				GridTemplate(unsigned int nD, unsigned int nP);	
+		}
+*/
+		/**
+		This template defines an elementary cell: vectors and interpolation law
+		\image html t2ec.png "1D elementary cell"
+		\image latex t2ec.png "1D elementary cell" width=8cm
+		*/
+/*		class d1q2ec {
+			public:
+				static const int ND=1;
+				static const int NV=2;
+				typedef Vec<ND,int> DV;
+			public:
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {DV(0),DV(1)};
+					return lat[i];
+				}
+				///The interpolation procedure
+				template <typename T>
+				inline static const T interpol(const Vec<NV,T> &d, const Vec<ND,lFl> &e) {
+					return d.x()*(1.-e.x())+d.y()*e.x();
+				}
+		};
+*/
+		///An elementary cell in 2D space
+		/**
+		This template defines an elementary cell: vectors and interpolation law
+		\image html t4ec.png "2D elementary cell"
+		\image latex t4ec.png "2D elementary cell" width=8cm
+		*/
+/*		class d2q4ec {
+			public:
+				static const int ND=2;
+				static const int NV=4;
+				typedef Vec<ND,int> DV;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {DV(0,0),DV(1,0),DV(0,1),DV(1,1)};
+					return lat[i];
+				}
+				///The interpolation procedure
+				template <typename T>
+				inline static const T interpol(const Vec<NV,T> &d, const Vec<ND,lFl> &e) {
+					return d[0]*(1.-e.x())*(1.-e.y())+d[1]*e.x()*(1.-e.y())+
+					       d[2]*(1.-e.x())*e.y()     +d[3]*e.x()*e.y();
+				}
+
+		};
+*/
+		///An elementary cell in 2D space
+		/**
+		This template defines an elementary cell: vectors and interpolation law
+		\image html t8ec.png "3D elementary cell"
+		\image latex t8ec.png "3D elementary cell" width=8cm
+		*/
+/*		class d3q8ec {
+			public:
+				static const int ND=3;
+				static const int NV=8;
+				typedef Vec<ND,int> DV;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {
+							       DV(0,0,0),DV(1,0,0),DV(0,1,0),DV(1,1,0),
+							       DV(0,0,1),DV(1,0,1),DV(0,1,1),DV(1,1,1)
+							     };
+					return lat[i];
+				}
+
+				///The interpolation procedure
+				template <typename T>
+				inline static const T interpol(const Vec<NV,T> &d, const Vec<ND,lFl> &e) {
+					return d[0]*(1.-e.x())*(1.-e.y())*(1.-e.z())
+					 +d[1]*    e.x()* (1.-e.y())*(1.-e.z())
+					 +d[2]*(1.-e.x())*    e.y()* (1.-e.z())
+					 +d[3]*    e.x()*     e.y()* (1.-e.z())
+					 +d[4]*(1.-e.x())*(1.-e.y())*    e.z()
+					 +d[5]*    e.x()* (1.-e.y())*    e.z()
+					 +d[6]*(1.-e.x())*    e.y()*     e.z()
+					 +d[7]*    e.x()*     e.y()*     e.z();
+				}
+		};
+
+*/
+
+		///d2q9 vectorspace
+		/**
+		The operators are defined on the correspoNDing templates:
+		\image html t9.png "9-point templates"
+		\image latex t9.png "9-point templates" width=8cm
+		*/
+/*		class d2q9 {
+			public:
+				static const int ND=2;
+				static const int NV=9;
+				typedef Vec<ND,int> DV;
+				//      private:
+				static const lFl w1=4./9.,w2=1./9.,w3=1./36., as2i=3.;
+				static inline const DV & l(int i) {
+					static const DV lat[NV] = {
+							       DV(0,0),DV(1,0),DV(0,1), DV(-1,0),DV(0,-1),
+							       DV(1,1),DV(-1,1),DV(-1,-1),DV(1,-1)
+							     };
+					return lat[i];
+				}
+			///number of the vector wich has oposite derection
+				static inline int io(int i) {
+				  static const int inv[NV] = {0,3,4,1,2,7,8,5,6};
+				  return inv[i];
+				}
+				static inline lFl s(const Vec<NV> &p) {
+					return (w1*p[0]+w2*(p[1]+p[2]+p[3]+p[4])+w3*(p[5]+p[6]+p[7]+p[8]));
+				}
+				static inline lFl s(Vec<NV> &p, const lFl &val) {
+					return (p[0] =p[1] =p[2] =p[3] =p[4] =p[5] =p[6] =p[7] =p[8] =val);
+				}
+
+				static inline const Vec<ND> v(const Vec<NV> &p) {
+				  return Vec<2>(w2*(p[1]-p[3])+w3*(p[5]-p[6]-p[7]+p[8]),
+						w2*(p[2]-p[4])+w3*(p[5]+p[6]-p[7]-p[8]));
+				}
+				static inline const Vec<ND> v(Vec<NV> &p, const Vec<ND> &val) {
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)
+						p[i] =p0+val*Vec<ND>(l(i))*as2i;
+					return val;
+				}
+
+				///coefficient of the lapplace operator
+				static inline lFl lc(int i) {
+					static const lFl c[NV] = {-10./3.,2./3.,2./3.,2./3.,2./3.,1./6.,1./6.,1./6.,1./6.};
+					return c[i];
+				}
+
+		};
+*/
+
+		///d2q5 vectorspace
+		/**
+		The operators are defined on the correspoNDing templates:
+		\image html t5.png "5-point templates"
+		\image latex t5.png "5-point templates" width=8cm
+		*/
+/*		class d2q5 {
+			public:
+				static const int ND=2;
+				static const int NV=5;
+				typedef Vec<ND,int> DV;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {DV(0,0),DV(1,0),DV(0,1),DV(-1,0), DV(0,-1)};
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {0,3,4,1,2};
+					return inv[i];
+				}
+				///coefficient of the lapplace operator
+				static inline lFl lc(int i) {
+					static const lFl c[NV] = {-4.,1.,1.,1.,1.};
+					return c[i];
+				}
+		};
+*/
+
+		///d2q4 vectorspace
+		/**
+		The operators are defined on the corresponding templates:
+		\image html t4.png "4-point templates"
+		\image latex t4.png "4-point templates" width=8cm
+		*/
+/*		class d2q4 {
+			public:
+				static const int ND=2;
+				static const int NV=4;
+				typedef Vec<ND,int> DV;
+				static const lFl w1=1./NV, as2i=ND;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {DV(1,0),DV(0,1),DV(-1,0), DV(0,-1)};
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {2,3,0,1};
+					return inv[i];
+				}
+				static inline lFl s(const Vec<NV> &p) {return (w1*(p[0]+p[1]+p[2]+p[3]));}
+				static inline lFl s(Vec<NV> &p, const lFl &val) {return (p[0] =p[1] =p[2] =p[3] =val);}
+				static inline const Vec<ND> v(const Vec<NV> &p) {
+					return Vec<ND>(w1*(p[0]-p[2]),w1*(p[1]-p[3]));
+				}
+				static inline const Vec<ND> v(Vec<NV> &p, const Vec<ND> &val) {
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)p[i] =p0+val*Vec<ND>(l(i))*as2i;
+					return val;
+				}
+
+		};
+
+*/
+
+		///d3q7 vectorspace
+		/**
+		\image html t7.png "7-point templates"
+		\image latex t7.png "7-point templates" width=8cm
+		*/
+/*		class d3q7 {
+			public:
+				static const int ND=3;
+				static const int NV=7;
+				typedef Vec<ND,int> DV;
+				inline static const DV l(int i) {
+					static const DV lat[NV] = {DV(SV()[I2T<0>()]),DV(SV()[I2T<1>()]),DV(SV()[I2T<2>()]),
+						      DV(SV()[I2T<3>()]),DV(SV()[I2T<4>()]),DV(SV()[I2T<5>()]),
+						      DV(SV()[I2T<6>()])};
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {0,4,5,6,1,2,3};
+					return inv[i];
+				}
+				///coefficient of the lapplace operator
+				static inline lFl lc(int i) {
+					static const lFl c[NV] = {-6.,1.,1.,1.,1.,1.,1.};
+					return c[i];
+				}
+		};
+*/
+
+		///d3q6 vectorspace
+		/**
+		\image html t6.png "6-point templates"
+		\image latex t6.png "6-point templates" width=8cm
+		*/
+/*		class d3q6 {
+			public:
+				static const int ND=3;
+				static const int NV=6;
+				typedef Vec<ND,int> DV;
+				static const lFl w1=1./NV, as2i=ND;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {
+							       DV(1,0,0),   DV(0,1,0),DV(0,0,1),
+							       DV(-1,0,0),  DV(0,-1,0),DV(0,0,-1)
+							     };
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {3,4,5,0,1,2};
+					return inv[i];
+				}
+				static inline lFl s(const Vec<NV> &p) {return (w1*(p[0]+p[1]+p[2]+p[3]+p[4]+p[5]));}
+				static inline lFl s(Vec<NV> &p, const lFl &val) {
+					return (p[0] =p[1] =p[2] =p[3] =p[4] =p[5] =val);
+				}
+				static inline const Vec<ND> v(const Vec<NV> &p) {
+					return Vec<ND>(w1*(p[0]-p[3]),w1*(p[1]-p[4]),w1*(p[2]-p[5]));
+				}
+				static inline const Vec<ND> v(Vec<NV> &p, const Vec<ND> &val) {
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)p[i] =p0+val*Vec<ND>(l(i))*as2i;
+					return val;
+				}
+		};
+
+*/
+
+		///d3q19 vectorspace
+		/**
+		\image html t19.png "19-point templates"
+		\image latex t19.png "19-point templates" width=8cm
+		*/
+/*		class d3q19 {
+			public:
+				static const int ND=3;
+				static const int NV=19;
+				typedef Vec<ND,int> DV;
+				static const lFl w1=1./3.,w2=1./18.,w3=1./36., as2i=3.;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {
+							       DV(0,0,0),   DV(1,0,0),   DV(0,1,0),
+							       DV(0,0,1),   DV(-1,0,0),  DV(0,-1,0),
+							       DV(0,0,-1),  DV(1,1,0),   DV(1,-1,0),
+							       DV(-1,-1,0), DV(-1,1,0),  DV(0,1,1),
+							       DV(0,1,-1),  DV(0,-1,-1), DV(0,-1,1),
+							       DV(1,0,1),   DV(1,0,-1),  DV(-1,0,-1),
+							       DV(-1,0,1)
+							     };
+					return lat[i];
+				}
+				///numbers of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {0,4,5,6,1,2,3,9,10,7,8,13,14,11,12,17,18,15,16};
+					return inv[i];
+				}
+				static inline lFl s(const Vec<NV> &p) {
+					return (w1*p[0]+w2*(p[1]+p[2]+p[3]+p[4]+p[5]+p[6])
+					+w3*(p[7]+p[8]+p[9]+p[10]+p[11]+p[12]+p[13]+p[14]+p[15]+p[16]+p[17]+p[18]));
+				}
+				static inline lFl s(Vec<NV> &p, const lFl &val) {p=val; return val;}
+
+				static inline const Vec<ND> v(const Vec<NV> &p) {
+					return 
+					Vec<ND>(w2*(p[1]-p[4])+w3*( p[7] +p[8]- p[9]-p[10]+p[15]+p[16]-p[17]-p[18]),
+						w2*(p[2]-p[5])+w3*( p[7] -p[8]- p[9]+p[10]+p[11]+p[12]-p[13]-p[14]),
+						w2*(p[3]-p[6])+w3*(p[11]-p[12]-p[13]+p[14]+p[15]-p[16]-p[17]+p[18]));
+				}
+				static inline const Vec<ND> v(Vec<NV> &p, const Vec<ND> &val) {
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)p[i] =p0+val*Vec<ND>(l(i))*as2i;
+					return val;
+				}
+				///coefficient of the lapplace operator
+				static inline lFl lc(int i) {
+				  static const lFl c[NV] = {-4.,
+							   1./3.,1./3.,1./3.,1./3.,1./3.,1./3.,
+							   1./6.,1./6.,1./6.,1./6.,1./6.,1./6.,
+							   1./6.,1./6.,1./6.,1./6.,1./6.,1./6.};
+				  return c[i];
+				}
+		};
+*/
+
+		///d3q15 vectorspace
+		/**
+		\image html t15.png "15-point templates"
+		\image latex t15.png "15-point templates" width=8cm
+		*/
+/*		class d3q15 {
+			public:
+				static const int ND=3;
+				static const int NV=15;
+				typedef Vec<ND,int> DV;
+				static const lFl w1=2./9.,w2=1./9.,w3=1./72., as2i=3.;
+				static inline const DV & l(int i) {
+					static const DV lat[NV] = {
+						       DV(0,0,0),   DV(1,0,0),   DV(0,1,0),
+						       DV(0,0,1),   DV(-1,0,0),  DV(0,-1,0),
+						       DV(0,0,-1),  DV(1,1,1),   DV(1,1,-1),
+						       DV(1,-1,1),  DV(1,-1,-1), DV(-1,1,1),
+						       DV(-1,1,-1), DV(-1,-1,1), DV(-1,-1,-1)
+						     };
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				static inline int io(int i) {
+					static const int inv[NV] = {0,4,5,6,1,2,3,14,13,12,11,10,9,8,7};
+					return inv[i];
+				}
+				static inline lFl s(const Vec<NV> &p) {
+					return (w1*p[0]+w2*(p[1]+p[2]+p[3]+p[4]+p[5]+p[6])
+						+w3*(p[7]+p[8]+p[9]+p[10]+p[11]+p[12]+p[13]+p[14]));
+				}
+				static inline lFl s(Vec<NV> &p, const lFl &val) {p=val; return val;}
+
+				template <typename Td,typename SD> 
+				static inline const Vec<ND> v(const Vec<NV,Td,SD> &p) 
+				{
+					return 
+					Vec<ND>(w2*(p[1]-p[4])+w3*(p[7]+p[8]+p[9]+p[10]-p[11]-p[12]-p[13]-p[14]),
+						w2*(p[2]-p[5])+w3*(p[7]+p[8]-p[9]-p[10]+p[11]+p[12]-p[13]-p[14]),
+						w2*(p[3]-p[6])+w3*(p[7]-p[8]+p[9]-p[10]+p[11]-p[12]+p[13]-p[14]));
+				}
+				static inline void v(Vec<NV> &p, const Vec<ND> &val) {
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)p[i] =p0+val*Vec<ND>(l(i))*as2i;
+				}
+				template <typename Ty> 
+				static inline void v(Vec<NV,lFl,Ty> p, const Vec<ND> &val) 
+				{
+					const lFl p0(s(p));
+					for (int i(0); i < NV; ++i)p[i] =p0+val*Vec<ND>(l(i))*as2i;
+				}
+
+				///coefficient of the lapplace operator
+				static inline lFl lc(int i) {
+					static const lFl c[NV] = {-14./3.,
+								2./3.,2./3.,2./3.,2./3.,2./3.,2./3.,
+								1./12.,1./12.,1./12.,1./12.,
+								1./12.,1./12.,1./12.,1./12.};
+					return c[i];
+				}
+		};
+*/
+
+		///D3Q27 vectorspace
+		/**
+		\image html t27.png "27-point templates"
+		\image latex t27.png "27-point templates" width=8cm
+		*/
+/*		class d3q27 {
+			public:
+				static const int ND=3;
+				static const int NV=27;
+				typedef Vec<ND,int> DV;
+				inline static const DV & l(int i) {
+					static const DV lat[NV] = {
+							       DV(0,0,0),   DV(1,0,0),   DV(0,1,0),
+							       DV(0,0,1),   DV(-1,0,0),  DV(0,-1,0),
+							       DV(0,0,-1),  DV(1,1,0),   DV(1,-1,0),
+							       DV(-1,-1,0), DV(-1,1,0),  DV(0,1,1),
+							       DV(0,1,-1),  DV(0,-1,-1), DV(0,-1,1),
+							       DV(1,0,1),   DV(1,0,-1),  DV(-1,0,-1),
+							       DV(-1,0,1),  DV(1,1,1),   DV(1,1,-1),
+							       DV(1,-1,1),  DV(1,-1,-1), DV(-1,1,1),
+							       DV(-1,1,-1), DV(-1,-1,1), DV(-1,-1,-1)
+							     };
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {0,
+								4,5,6,1,2,3,
+								9,10,7,8,13,14,11,12,17,18,15,16,
+								26,25,24,23,22,21,20,19};
+					return inv[i];
+				}
+		};
+*/
+
+		///D1Q3 vectorspace
+		/**
+		\image html t3.png "3-point templates"
+		\image latex t3.png "3-point templates" width=8cm
+		*/
+/*		class d1q3 {
+			public:
+				static const int ND=1; ///<number of dimensions
+				static const int NV=3; ///<nuber of directions
+				typedef Vec<ND,int> DV;      ///< type of lattice vector
+				inline static const DV & l(int i) { /// Returns value of the lattice vector
+					static const DV lat[NV] = {DV(0),DV(1),DV(-1)};
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {0,2,1};
+					return inv[i];
+				}
+		};
+*/
+
+		///D1Q2 vectorspace
+		/**
+		\image html t2.png "2-point templates"
+		\image latex t2.png "2-point templates" width=8cm
+		*/
+/*		class d1q2 {
+			public:
+				static const int ND=1; ///<number of dimensions
+				static const int NV=2; ///<nuber of directions
+				typedef Vec<1,int> DV;      ///< type of lattice vector
+				inline static const DV & l(int i) { /// Returns value of the lattice vector
+					static const DV lat[NV] = {DV(1),DV(-1)};
+					return lat[i];
+				}
+				///number of the vector wich has oposite derection
+				inline static int io(int i) {
+					static const int inv[NV] = {1,0};
+					return inv[i];
+				}
+		};
+
+		///Reflected template vector \f$ lrf(f)_i=f_{\tilde i}, \f$ \f$ \vec a_{\tilde i}=-\vec a_i \f$
+		template <typename Tl> inline Vec<Tl::NV> lrv(const Vec<Tl::NV> &f_) {
+			Vec<Tl::NV> a;
+			for (int i(0); i < Tl::NV; ++i) {a[i] =f_[Tl::io(i)];}
+			return a;
+		}
+
+		template <typename Tl,int I> inline void _l1f_c(I2T<I>,Tl, const Vec<Tl::ND> &v_,Vec<Tl::NV> &a){
+			typedef typename Tl::SV SV;
+			a[I] =SV()[I2T<I>()]*v_; _l1f_c(I2T<I-1>(),Tl(),v_,a);
+		}
+		template <typename Tl> inline void _l1f_c(I2T<0>,Tl, const Vec<Tl::ND> &v_,Vec<Tl::NV> &a){
+			typedef typename Tl::SV SV; 
+			a[0] =SV()[I2T<0>()]*v_;
+		}
+
+		///Creates template vector as scalar product with lattice vectors \f$ \vec a_i \vec v \f$
+		template <typename Tl> inline Vec<Tl::NV> l1f(const Vec<Tl::ND> &v_) {
+			typedef Vec<Tl::ND> TV;
+			Vec<Tl::NV> a;
+			//      for (int i(0); i < Tl::NV; ++i) {a[i] =TV(Tl::l(i))*v_;}
+			_l1f_c(I2T<Tl::NV-1>(),Tl(),v_,a);
+			return a;
+		}
+
+		template <typename Tl,int I> 
+		inline void _l2f_c(I2T<I>,Tl, const Vec<Tl::ND> &v1_, const Vec<Tl::ND> &v2_,Vec<Tl::NV> &a){
+			class Tl::SV q; a[I] =(q[I2T<I>()]*v1_)*(q[I2T<I>()]*v2_); _l2f_c(I2T<I-1>(),Tl(),v1_,v2_,a);
+		}
+		template <typename Tl> 
+		inline void _l2f_c(I2T<0>,Tl, const Vec<Tl::ND> &v1_, const Vec<Tl::ND> &v2_,Vec<Tl::NV> &a){
+			class Tl::SV q; a[0] =(q[I2T<0>()]*v1_)*(q[I2T<0>()]*v2_);
+		}
+
+		///Creates template vector as 2 scalar products with lattice vectors \f$ (\vec a_i \vec v_1) (\vec a_i \vec v_2) \f$
+		template <typename Tl> inline Vec<Tl::NV> l2f(const Vec<Tl::ND> &v1_, const Vec<Tl::ND> &v2_) {
+			typedef Vec<Tl::ND> TV;
+			Vec<Tl::NV> a;
+			//      for (int i(0); i < Tl::NV; ++i) {a[i] =(TV(Tl::l(i))*v1_)*(TV(Tl::l(i))*v2_);}
+			_l2f_c(I2T<Tl::NV-1>(),Tl(),v1_,v2_,a);
+			return a;
+		}
+
+
+	} // templ
+*/
+}// asl
+
+#endif // TEMPL_H_INCLUDED
diff --git a/src/math/aslTemplatesExtras.cxx b/src/math/aslTemplatesExtras.cxx
new file mode 100644
index 0000000..7eaf08a
--- /dev/null
+++ b/src/math/aslTemplatesExtras.cxx
@@ -0,0 +1,182 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTemplatesExtras.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclGenerators.h"
+#include "aslBarycentric.h"
+
+namespace asl
+{
+	
+	VTObjects::VTObjects (const VectorTemplate* vt, 
+	                      const std::vector<unsigned int> & ep1, 
+	                      const std::vector<unsigned int> & ep2,
+	                      const std::vector<AVec<int>> & elCells):
+		vt(vt),
+		edgePoint1(ep1),
+		edgePoint2(ep2),
+		elementaryCells(elCells)
+	{
+		initCellMatrices();
+	}
+
+	void VTObjects::getCellPoints(unsigned int ic, vector<AVec<>> & points) const
+	{
+		points.resize(elementaryCells[ic].getSize());
+		for(unsigned int i(0); i < points.size(); ++i)
+		{
+			points[i] = vt->vectors[elementaryCells[ic][i]];
+		}
+	}
+		
+	void VTObjects::initCellMatrices()
+	{
+		unsigned int n(elementaryCells.size());
+		cellMatrices.resize(n);		
+		for(unsigned int i(0); i < n; ++i)
+		{
+			vector<AVec<>> points;
+			getCellPoints(i, points);
+			asl::Barycentric b(points);
+			cellMatrices[i] = b.tInv;
+		}
+	}
+
+	acl::VectorOfElements VTObjects::cellGradient(const acl::VectorOfElements & val, 
+	                                              unsigned int i) const
+	{
+		if(i >= elementaryCells.size())
+			errorMessage("VTObjects::cellGradient: i larger than the number of cells");
+		auto cell(elementaryCells[i]);
+		unsigned int nv(cell.getSize());
+		
+		acl::VectorOfElements val0(subVE(val,cell[0]));
+		acl::VectorOfElements valI(nv-1);
+		for(unsigned int ii(1); ii < nv; ++ii)
+			valI[ii-1] = (subVE(val,cell[ii])-val0)[0];
+		
+		return valI * acl::generateMEConstant(cellMatrices[i]);
+	}
+
+	double edgeWeight(const VTObjects & vto, unsigned int iEl, unsigned int i, unsigned int j)
+	{
+		auto & cell(vto.elementaryCells[iEl]);
+		auto v(vto.vt->vectors[cell[i]]-vto.vt->vectors[cell[j]]);
+		unsigned int nDir(vto.vt->vectors.size());
+		unsigned int ii(0);
+		bool test(true);
+		for(; test && ii < nDir; ++ii)
+		{
+			test = (l2(v) != l2(vto.vt->vectors[ii]));
+		}
+		double res(0);
+		if (!test)
+			res=vto.vt->laplasCoefs[ii];
+		return res;
+	}
+		
+	const VTObjects & d2q5Objs()
+	{
+		static VTObjects vto(&d2q5(), 
+	                   {0,0,0,0,1,1,3,3},
+	                   {1,2,3,4,2,4,2,4},
+	                   {makeAVec(0,1,2), makeAVec(0,2,3), makeAVec(0,3,4), makeAVec(0,4,1)});
+		return vto;
+	}
+
+	const VTObjects & d2q9Objs()
+	{
+		static VTObjects vto(&d2q9(), 
+	                   {0,0,0,0,0,0,0,0,1,5,2,6,3,7,4,8},
+	                   {1,2,3,4,5,6,7,8,5,2,6,3,7,4,8,1},
+	                   {makeAVec(1,0,8), makeAVec(1,0,5), 
+						makeAVec(2,0,5), makeAVec(2,0,6),
+						makeAVec(3,0,6), makeAVec(3,0,7),
+						makeAVec(4,0,7), makeAVec(4,0,8)});
+		return vto;
+	}
+
+		
+	const VTObjects & d3q7Objs()
+	{
+		static VTObjects vto(&d3q7(), 
+	                {0,0,0,0,0,0,1,1,1,1,4,4,4,4},
+	                {1,2,3,4,5,6,2,3,5,6,2,3,5,6},
+	                {makeAVec(0,1,2,3), makeAVec(0,2,4,3), makeAVec(0,4,5,3),
+					 makeAVec(0,5,1,3), makeAVec(0,2,1,6), makeAVec(0,4,2,6),
+					 makeAVec(0,5,4,6), makeAVec(0,1,5,6)});
+		return vto;
+	}
+
+	const VTObjects & d3q15Objs()
+	{
+		static VTObjects vto(&d3q15(), 
+	                {0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0,1,1,1, 1,2,2, 2, 2,3,3, 3, 3, 4, 4, 4, 4,5, 5, 5, 5,6, 6, 6, 6},
+	                {1,2,3,4,5,6,7,8,9,10,11,12,13,14,7,8,9,10,7,8,11,12,7,9,11,13,11,12,13,14,9,10,13,14,8,10,12,14},
+	                {makeAVec(0,1, 7, 9), makeAVec(0,1, 9,10), makeAVec(0,1,10, 8), makeAVec(0,1, 8, 7),
+					 makeAVec(0,2, 7, 8), makeAVec(0,2, 8,12), makeAVec(0,2,12,11), makeAVec(0,2,11, 7),
+					 makeAVec(0,3, 7,11), makeAVec(0,3,11,13), makeAVec(0,3,13, 9), makeAVec(0,3, 9, 7),
+					 makeAVec(0,4,11,13), makeAVec(0,4,13,14), makeAVec(0,4,14,12), makeAVec(0,4,12,11),
+					 makeAVec(0,5, 9,10), makeAVec(0,5,10,14), makeAVec(0,5,14,13), makeAVec(0,5,13, 9),
+					 makeAVec(0,6, 8,12), makeAVec(0,6,12,14), makeAVec(0,6,14,10), makeAVec(0,6,10, 8)});
+		return vto;
+	}
+
+	const VTObjects & d3q19Objs()
+	{
+		static VTObjects vto(&d3q19(), 
+	                {0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1, 1,1, 1, 2, 2,2, 2, 3, 3, 3, 3,4, 4, 4, 4,5, 5,5, 5, 6, 6, 6, 6, 7,15, 8,16,10,11, 7,12,11,18,14,15,10,18, 9,17, 9,14, 8,13,12,17,13,16},
+	                {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,7,15,8,16,10,11,7,12,11,18,14,15,9,17,10,18,9,14,8,13,12,17,13,16,15, 8,16, 7,11, 7,12,10,18,14,15,11,18, 9,17,10,14, 8,13, 9,17,13,16,12},
+	                {makeAVec(0,1, 7,15), makeAVec(0,1,15, 8), makeAVec(0,1, 8,16), makeAVec(0,1,16, 7),
+					 makeAVec(0,2,10,11), makeAVec(0,2,11, 7), makeAVec(0,2, 7,12), makeAVec(0,2,12,10),
+					 makeAVec(0,3,11,18), makeAVec(0,3,18,14), makeAVec(0,3,14,15), makeAVec(0,3,15,11),
+					 makeAVec(0,4,10,18), makeAVec(0,4,18, 9), makeAVec(0,4, 9,17), makeAVec(0,4,17,10),
+					 makeAVec(0,5, 9,14), makeAVec(0,5,14, 8), makeAVec(0,5, 8,13), makeAVec(0,5,13, 9),
+					 makeAVec(0,6,12,17), makeAVec(0,6,17,13), makeAVec(0,6,13,16), makeAVec(0,6,16,12),
+					 makeAVec(0,7,16,12), makeAVec(0,7,11,15), makeAVec(0,8,16,13), makeAVec(0,8,15,14),
+					 makeAVec(0,9,14,18), makeAVec(0,9,13,17), makeAVec(0,10,18,11), makeAVec(0,10,17,12)});
+		return vto;
+	}
+		
+	const VTObjects* vtObject(const VectorTemplate *vt)
+	{
+		const VTObjects* vto(NULL);
+
+		if (vt == &d2q5()) 
+				vto=&d2q5Objs();
+		if (vt == &d2q9()) 
+				vto=&d2q9Objs();
+		if (vt == &d3q7())
+				vto=&d3q7Objs();
+		if (vt == &d3q15())
+				vto=&d3q15Objs();
+		if (vt == &d3q19())
+				vto=&d3q19Objs();
+
+//		if	(vto == NULL)
+//				errorMessage("vtObject:  VTObjects* is undefined for the given VectorTemplate");
+		return vto;
+	}
+		
+}// asl
diff --git a/src/math/aslTemplatesExtras.h b/src/math/aslTemplatesExtras.h
new file mode 100644
index 0000000..a154e31
--- /dev/null
+++ b/src/math/aslTemplatesExtras.h
@@ -0,0 +1,127 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLTEMPLATESEXTRAS_H
+#define ASLTEMPLATESEXTRAS_H
+
+#include "aslTemplates.h"
+#include "aslMatrices.h"
+
+namespace acl {
+	class VectorOfElements;
+}
+
+namespace asl {
+
+
+	/// Defines andditionl features related to a VectorTemplate
+	/**
+		\ingroup Templates
+		contains list of edges for a template. this can be used in level 
+		set and iso-surface extraction algorithms
+	*/
+	class VTObjects
+	{
+		private:
+			void initCellMatrices();
+		public:
+			const VectorTemplate * vt;
+			std::vector<unsigned int> edgePoint1;
+			std::vector<unsigned int> edgePoint2;
+			std::vector<AVec<int>> elementaryCells;
+			std::vector<AMatr<>> cellMatrices;
+			
+			VTObjects(const VectorTemplate * vt, 
+			          const std::vector<unsigned int> & ep1, 
+			          const std::vector<unsigned int> & ep2,
+			          const std::vector<AVec<int>> & elCells);
+
+			/// computes gradient within the elementary cell \p ic and  values in the corners \p val  
+			acl::VectorOfElements cellGradient(const acl::VectorOfElements & val, 
+			                                   unsigned int ic) const;
+			/// fill \p points by corner coordinates of the cell \p ic 
+			void getCellPoints(unsigned int ic, std::vector<AVec<>> & points) const;
+	};
+
+	inline unsigned int nD(const VTObjects vto);
+
+	/// Returns vtObjecs corresponding to the given VectorTemplate \ingroup Templates
+	const VTObjects* vtObject(const VectorTemplate *);
+
+	/// returns coefficient of the laplace operator corresponding to the direction of a cell edge
+	/**
+		 \related VTObjects
+	 */
+	double edgeWeight(const VTObjects & vto, unsigned int iEl, unsigned int i, unsigned int j);
+	
+	
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t5.png
+	*/	
+	const VTObjects & d2q5Objs();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t7.png
+	*/
+	const VTObjects & d3q7Objs();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t9.png
+	*/	
+	const VTObjects & d2q9Objs();	
+
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t15.png
+	*/	
+	const VTObjects & d3q15Objs();	
+	
+	///Vector template
+	/**	
+	 \ingroup TemplatesNN
+		 
+	 \image html t19.png
+	*/	
+	const VTObjects & d3q19Objs();	
+
+// ----------------------------- Implementation -------------------------
+
+	inline unsigned int nD(const VTObjects & vto)
+	{
+		return nD(*vto.vt);
+	}
+
+}// asl
+
+#endif // ASLTEMPLATESEXTRAS_H
diff --git a/src/math/aslVectors.h b/src/math/aslVectors.h
new file mode 100644
index 0000000..765f2bc
--- /dev/null
+++ b/src/math/aslVectors.h
@@ -0,0 +1,40 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslVectors.h definition of class АVec<T>
+
+#ifndef ASLVECTORS_H
+#define ASLVECTORS_H
+
+
+#include "aslVectorsDynamicLength.h"
+#include "aslVectorsDynamicLengthOperations.h"
+
+namespace asl
+{
+	
+		
+} // asl
+
+#endif // ASLVECTORS_H
+
diff --git a/src/math/aslVectorsDynamicLength.h b/src/math/aslVectorsDynamicLength.h
new file mode 100644
index 0000000..4558612
--- /dev/null
+++ b/src/math/aslVectorsDynamicLength.h
@@ -0,0 +1,235 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslVectors.h definition of class АVec<T>
+
+#ifndef ASLVECTORSDYNAMICLENGTH_H
+#define ASLVECTORSDYNAMICLENGTH_H
+
+
+#include "../aslUtilities.h"
+#include <math.h>
+
+
+namespace asl
+{
+	
+	/// class algebraic vector. 
+	/// The class is an implementation of a dynamic array with defined algebraic operations
+	template <typename T = double> class AVec
+	{
+		private:
+			T* x;	
+			unsigned int size;
+
+		public:
+			typedef T Type;
+			inline AVec();						
+			inline explicit AVec(unsigned int s);			
+			inline AVec(unsigned int s, T a);			
+			inline ~AVec();
+			template <typename Tv> 
+				inline explicit AVec(const AVec<Tv> & a);
+			inline AVec(const AVec<T> & a);
+			template <typename Tv> 
+				inline const AVec<T> & operator=(const AVec<Tv> &a);
+			template <typename Tv> 
+				inline const AVec<T> & operator=(const std::vector<Tv> &a);
+			inline const AVec<T> & operator=(const AVec<T> &a);
+			inline T& operator[](unsigned int i);
+			inline const T& operator[](unsigned int i) const;
+			inline const unsigned int & getSize() const;
+			inline void resize(unsigned int newSize);
+	};
+
+	/// \relates AVec
+	template <typename T> 
+		inline const unsigned int nD(const AVec<T> a);
+	
+	/// \relates AVec
+	template <typename T> inline AVec<T> makeAVec(T a1);
+	/// \relates AVec
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2);
+	/// \relates AVec
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2, T a3);
+	/// \relates AVec
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2, T a3, T a4);
+	
+	/// \relates AVec
+	template <typename T> 
+		inline std::ostream & operator<<(std::ostream & output, const AVec<T> & a);
+
+	
+//---------------- Implementation ----------------
+	template <typename T> inline AVec<T>::AVec():
+		x(new T[1]),
+		size(1)
+	{
+		x[0] =0;
+	}
+
+	template <typename T> inline AVec<T>::AVec(unsigned int s):
+		x(new T[s]),
+		size(s)
+	{
+		if (size<1) errorMessage("Vector size less than 1");
+		memset(x, 0, sizeof(T)*s);
+	}
+
+	template <typename T> inline AVec<T>::AVec(unsigned int s, T a):
+		x(new T[s]),
+		size(s)
+	{
+		if (size<1) errorMessage("Vector size less than 1");		
+		for (unsigned int i(0); i<size; ++i)
+			x[i] =a;
+	}
+		
+	template <typename T> inline AVec<T>::~AVec()
+	{	
+		delete[] x;
+	}
+
+	template <typename T> template<typename Tv> inline AVec<T>::AVec(const AVec<Tv> & a):
+		x(new T[a.getSize()]),
+		size(a.getSize())	
+	{
+		for (unsigned int i(0); i < size; ++i)
+			x[i] = a[i];		
+	}
+
+	template <typename T> inline AVec<T>::AVec(const AVec<T> & a):
+		x(new T[a.getSize()]),
+		size(a.getSize())	
+	{
+		for (unsigned int i(0); i < size; ++i)
+			x[i] = a[i];		
+	}
+
+		
+	template <typename T> template<typename Tv> 
+		inline const AVec<T> & AVec<T>::operator=(const AVec<Tv> & a)
+	{
+		resize(a.getSize());
+		for (unsigned int i(0); i<size; ++i)
+			x[i] =a[i];	
+		return *this;
+	}
+		
+	template <typename T>
+		inline const AVec<T> & AVec<T>::operator=(const AVec<T> & a)
+	{
+		resize(a.getSize());
+		for (unsigned int i(0); i<size; ++i)
+			x[i] =a[i];		
+		return *this;
+	}
+
+	template <typename T> template<typename Tv> 
+		inline const AVec<T> & AVec<T>::operator=(const std::vector<Tv> & a)
+	{
+		resize(a.size());
+		for (unsigned int i(0); i<size; ++i)
+			x[i] =a[i];	
+		return *this;
+	}
+
+		
+	template <typename T> 
+	inline T& AVec<T>::operator[](unsigned int i)
+	{
+		return x[i];
+	}
+
+	template <typename T> 
+	inline const T& AVec<T>::operator[](unsigned int i) const
+	{
+		return x[i];
+	}
+
+	template <typename T> 
+	inline const unsigned int & AVec<T>::getSize() const
+	{
+		return size;
+	}
+								
+	template <typename T> inline AVec<T> makeAVec(T a1)
+	{
+		return AVec<T>(1, a1);
+	}
+		
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2)
+	{
+		AVec<T> v(2); 
+		v[0] = a1;
+		v[1] = a2;
+		return v;
+	}
+
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2, T a3)
+	{
+		AVec<T> v(3); 
+		v[0] = a1;
+		v[1] = a2;
+		v[2] = a3;
+		return v;
+	}
+
+	template <typename T> inline AVec<T> makeAVec(T a1, T a2, T a3, T a4)
+	{
+		AVec<T> v(4); 
+		v[0] = a1;
+		v[1] = a2;
+		v[2] = a3;
+		v[3] = a4;
+		return v;
+	}
+		
+	template <typename T> inline std::ostream & operator<<(std::ostream & output, 
+	                                                       const AVec<T> & a)
+	{
+		for (unsigned int i(0); i<a.getSize(); ++i)
+			output << a[i]<< " ";
+		return output;
+	}
+
+	template <typename T> 
+		inline const unsigned int nD(const AVec<T> a)
+	{
+		return a.getSize();
+	}
+		
+	template <typename T>
+		inline void AVec<T>::resize(unsigned int newSize)
+	{
+		if (size != newSize){
+			delete[] x;
+			x=new T[newSize];
+			size=newSize;
+		}
+	}
+		
+} // asl
+
+#endif //ASLVECTORSDYNAMICLENGTH_H
+
diff --git a/src/math/aslVectorsDynamicLengthOperations.h b/src/math/aslVectorsDynamicLengthOperations.h
new file mode 100644
index 0000000..e417ff4
--- /dev/null
+++ b/src/math/aslVectorsDynamicLengthOperations.h
@@ -0,0 +1,410 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslVectors.h definition of class АVec<T>
+
+#ifndef ASLVECTORSDYNAMICLENGTHOPERATIONS_H
+#define ASLVECTORSDYNAMICLENGTHOPERATIONS_H
+
+
+#include "../aslUtilities.h"
+#include <math.h>
+
+
+namespace asl
+{
+	
+	/// The function checks whether the sizes are equal \relates AVec
+	template <typename T1, typename T2> 
+		inline bool compatibleSizes(AVec<T1> a, AVec<T2> b);
+
+	/// \relates AVec	
+	template <typename T> 
+		inline const T l2(const AVec<T> & a);
+
+	/// \relates AVec	
+	template <typename T> 
+		inline const AVec<> normalize(const AVec<T> & a);
+	
+	/// \relates AVec	
+	template <typename T> 
+		inline const AVec<T> operator+(const AVec<T> & a, const AVec<T> & b);
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> operator-(const AVec<T> & a, const AVec<T> & b);
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> operator-(const AVec<T> & a);
+	/// \relates AVec
+	template <typename T> 
+		inline const T operator*(const AVec<T> & a, const AVec<T> & b);	
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> operator*(const T & a, const AVec<T> & b);	
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> operator*(const AVec<T> & a, const T & b);		
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> operator/(const AVec<T> & a, const T & b);		
+
+	/// \relates AVec
+	template <typename T> inline const AVec<T> & operator+=(AVec<T> & a,
+	                                                        const AVec<T> & b);
+	/// \relates AVec
+	template <typename T> inline const AVec<T> & operator-=(AVec<T> & a,
+	                                                        const AVec<T> & b);
+	/// \relates AVec
+	template <typename T> inline const AVec<T> & operator*=(AVec<T> & a,
+	                                                        const T & b);		
+
+	/// \relates AVec
+	template <typename T> inline const bool operator==(const AVec<T> & a,
+	                                                   const AVec<T> & b);
+	
+
+	/// \relates AVec
+	template <typename T> inline const bool operator!=(const AVec<T> & a,
+	                                                   const AVec<T> & b);
+	
+
+	/// \relates AVec
+	template <typename T> 
+		inline const AVec<T> crossProduct(const AVec<T> & a, const AVec<T> & b);	
+
+	/// returns minimal component \relates AVec 
+	template <typename T> inline const T minComponent(const AVec<T> & a);		
+	/// returns maximal component  \relates AVec
+	template <typename T> inline const T maxComponent(const AVec<T> & a);		
+
+	/// returns summ of all components \relates AVec
+	template <typename T> inline T sumOfElements(const AVec<T> & a);
+	/// returns product of all components \relates AVec
+	template <typename T> inline T productOfElements(const AVec<T> & a);
+
+	/// returns vector which elements are product of corresponding elements of \p a and \p b \relates AVec
+	template <typename T> inline const AVec<T> productOfElements(const AVec<T> & a,
+	                                                             const AVec<T> & b);
+	/// returns vector which elements are division of corresponding elements of \p a and \p b \relates AVec
+	template <typename T> inline const AVec<T> divisionOfElements(const AVec<T> & a,
+	                                                              const AVec<T> & b);
+
+	/// returns \p true in case when all components of \p a more or  then 0 \relates AVec 
+	template <typename T> inline const bool positive(const AVec<T> & a);
+
+	/// returns \p true in case when all components of \p a more or equal 0 \relates AVec 
+	template <typename T> inline const bool nonNegative(const AVec<T> & a);
+	
+	/// returns \p true in case when all components of \p a more then 0 \relates AVec 
+	inline const AVec<int> floor(const AVec<> & a);
+
+	/// returns \p true in case when all components of \p a more then 0 \relates AVec 
+	inline const AVec<int> round(const AVec<> & a);
+	
+	/// computes polynom for \p x with \p coefs 
+	/**
+		 \relates AVec
+		 The polinom is \f$ x^{n-1}*coefs_0+x^{n-2}coefs_1+...+coefs_{n-1} \f$
+	*/
+	inline double computePolynom(double x, AVec<> &coefs);
+	
+	/// \relates AVec
+	template <typename T> 
+		inline std::ostream & operator<<(std::ostream & output, const AVec<T> & a);
+
+	/// returns \p true in case when all components of \p a more then 0 \relates AVec 
+	inline const AVec<> swapXZ(const AVec<> & a);
+	
+//---------------- Implementation ----------------
+
+	template <typename T1, typename T2> 
+	inline bool compatibleSizes(AVec<T1> a, AVec<T2> b)
+	{
+		return a.getSize() == b.getSize();
+	}
+
+
+	template <typename T> inline const T l2(const AVec<T> & a)
+	{
+		return a * a;
+	}
+
+	template <typename T> inline const AVec<> normalize(const AVec<T> & a)
+	{
+		return AVec<>(a) / sqrt(l2(a));
+	}
+	
+	template <typename T> inline const AVec<T> operator+(const AVec<T> & a,
+	                                                     const AVec<T> & b){
+		if (!compatibleSizes(a, b))
+			errorMessage("(AVec; operator+) Vector sizes are incompatible");
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c[i] = a[i] + b[i];
+		return c;
+	}
+
+	template <typename T> inline const AVec<T> operator-(const AVec<T> & a, const AVec<T> & b)
+	{
+		if (!compatibleSizes (a,b))
+			errorMessage("(AVec; operator-) Vector sizes are incompatible");
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c[i] =a[i]-b[i];
+		return c;
+	}
+
+	template <typename T> inline const AVec<T> operator-(const AVec<T> & a)
+	{
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c[i] =-a[i];
+		return c;
+	}
+	
+	template <typename T> inline const T operator*(const AVec<T> & a, const AVec<T> & b){
+		if (!compatibleSizes (a,b))
+			errorMessage("(AVec; operator*) Vector sizes are incompatible");
+		T s(0);
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			s+=a[i]*b[i];
+		return s;
+	}
+
+	template <typename T> inline const AVec<T> operator*(const AVec<T> & a, const T & b){
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c[i] =a[i]*b;
+		return c;
+	}
+
+	template <typename T> inline const AVec<T> operator*(const T & a, const AVec<T> & b){
+		return b*a;
+	}
+
+	template <typename T> inline const AVec<T> operator/(const AVec<T> & a, const T & b){
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c[i] =a[i]/b;
+		return c;
+	}
+		
+	template <typename T> inline const AVec<T> & operator+=(AVec<T> & a, const AVec<T> & b){
+		if (!compatibleSizes (a,b))
+			errorMessage("Vector sizes are incompatible");
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			a[i]+=b[i];
+		return a;
+	}
+
+	template <typename T> inline const AVec<T> & operator-=(AVec<T> & a, const AVec<T> & b){
+		if (!compatibleSizes (a,b))
+			errorMessage("Vector sizes are incompatible");
+		for (unsigned int i(0); i < a.size; ++i) 
+			a[i]-=b[i];
+		return a;
+	}
+
+	template <typename T> inline const AVec<T> & operator*=(AVec<T> & a, const T & b){
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			a[i] *= b;
+		return a;
+	}	
+
+	template <typename T> inline const bool operator==(const AVec<T> & a,
+	                                                   const AVec<T> & b)
+	{
+		if (!compatibleSizes (a, b))
+			return false;
+		bool c(true);
+		for (unsigned int i(0); i < a.getSize(); ++i) 
+			c = c && (a[i] == b[i]);
+		return c;
+	}
+
+
+	template <typename T> inline const bool operator!=(const AVec<T> & a,
+	                                                   const AVec<T> & b)
+	{
+		return !(a == b);
+	}
+
+	template <typename T> 
+		inline const AVec<T> crossProduct(const AVec<T> & a, const AVec<T> & b)
+	{
+		if (!compatibleSizes (a,b))
+			errorMessage("(AVec; crossProduct) Vector sizes are incompatible");
+		if (a.getSize()>3)
+			errorMessage("(AVec; crossProduct) number of components is more than 3");
+		if (a.getSize()<2)
+			errorMessage("(AVec; crossProduct) number of components is less than 2");
+
+		AVec<T> res(1);
+		if(a.getSize() == 2)
+		{
+			res[0] = a[0]*b[1]-a[1]*b[0];
+		}
+		if(a.getSize() == 3)
+		{
+			res.resize(3);
+			res[0] = a[1]*b[2]-a[2]*b[1];
+			res[1] = a[2]*b[0]-a[0]*b[2];
+			res[2] = a[0]*b[1]-a[1]*b[0];
+		}
+		return res;
+	}
+	
+	template <typename T> inline const T minComponent(const AVec<T> & a)
+	{
+		T ma(a[0]);
+		for (unsigned int i(1); i < a.getSize(); ++i) 
+			ma = std::min(ma, a[i]);
+		return ma;
+	}
+		
+	template <typename T> inline const T maxComponent(const AVec<T> & a)
+	{
+		if (a.getSize()<1) errorMessage("Vector size less than 1");
+		T ma(a[0]);
+		for (unsigned int i(1); i < a.getSize(); ++i) 
+			ma=std::max(ma,a[i]);
+		return ma;
+	}
+
+	template <typename T> inline AVec<T> subAVec(const AVec<T> & source,
+	                       unsigned int start, unsigned int end)
+	{
+		if (source.getSize() <= end )
+			errorMessage("subAVec: attempt to copy besides the vector range");
+		
+		AVec<T> destination(1 + end - start);
+		for (unsigned int i(start); i <= end; ++i)
+			destination[i - start] = source[i];
+		return destination;
+	}
+	
+	template <typename T> inline T sumOfElements(const AVec<T> & a)
+	{
+		T s(0);
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			s += a[i];
+		return s;
+	}
+		
+	template <typename T> inline T productOfElements(const AVec<T> & a)
+	{
+		T p(1);
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			p *= a[i];
+		return p;
+	}
+
+	template <typename T> inline const AVec<T> productOfElements(const AVec<T> & a,
+	                                                             const AVec<T> & b)
+	{
+		if (!compatibleSizes (a, b))
+			errorMessage("(AVec; productOfElements) Vector sizes are incompatible");
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			c[i] = a[i] * b[i];
+		return c;
+	}
+
+	template <typename T> inline const AVec<T> divisionOfElements(const AVec<T> & a, const AVec<T> & b)
+	{
+		if (!compatibleSizes (a, b))
+			errorMessage("(AVec; divisionOfElements) Vector sizes are incompatible");
+
+		AVec<T> c(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			c[i] = a[i] / b[i];
+
+		return c;
+	}
+
+	template <typename T> inline const bool positive(const AVec<T> & a)
+	{
+		if (!a.getSize())
+			errorMessage("(AVec; positive) Vector size is zero");
+		bool res(a[0]>0);
+		for (unsigned int i(1); i < a.getSize(); ++i)
+			res &= a[i]>0;
+		return res;	
+	}
+
+	template <typename T> inline const bool nonNegative(const AVec<T> & a)
+	{
+		if (!a.getSize())
+			errorMessage("(AVec; positive) Vector size is zero");
+		bool res(a[0]>=0);
+		for (unsigned int i(1); i < a.getSize(); ++i)
+			res &= a[i]>=0;
+		return res;	
+	}
+	
+	inline const AVec<int> floor(const AVec<> & a)
+	{
+		if (!a.getSize())
+			errorMessage("(AVec; floor) Vector size is zero");
+		AVec<int> res(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			res[i] = std::floor(a[i]);
+		return res;	
+	}
+
+	inline const AVec<int> round(const AVec<> & a)
+	{
+		if (!a.getSize())
+			errorMessage("(AVec; round) Vector size is zero");
+		AVec<int> res(a.getSize());
+		for (unsigned int i(0); i < a.getSize(); ++i)
+			res[i] = std::round(a[i]);
+		return res;	
+	}
+
+	
+	inline double computePolynom (double x, AVec<> &coefs)
+	{	
+		if (coefs.getSize() < 1)
+			errorMessage("Error: (asl::computePolynom) size of \"coefs\" less than 1");
+		double p;
+		p=coefs[0];
+		for (unsigned int i(1); i < coefs.getSize(); ++i)
+			p=p*x+coefs[i];
+		return p;	
+	}
+
+	/// returns \p true in case when all components of \p a more then 0 \relates AVec 
+	inline const AVec<> swapXZ(const AVec<> & a)
+	{
+		if (a.getSize()<3)
+			errorMessage("(AVec; swapXZ) Vector size less than 3");
+		AVec<> res(a);
+		std::swap(res[0],res[2]);
+		return res;		
+	}
+	
+} // asl
+
+#endif //ASLVECTORSDYNAMICLENGTH_H
+
diff --git a/src/math/aslVectorsUtilities.h b/src/math/aslVectorsUtilities.h
new file mode 100644
index 0000000..607f714
--- /dev/null
+++ b/src/math/aslVectorsUtilities.h
@@ -0,0 +1,116 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/// \file aslVectorsUtilities.h Vectors and lattices
+
+#ifndef _aslVectors
+#define _aslVectors
+
+
+#include "aslVectors.h"
+#include <math.h>
+
+
+namespace asl {
+
+
+/*
+  ///  The function makese possible an output to a stream
+  template <int I,typename T> inline std::ostream& operator<<(std::ostream &f,const Vec<I,T> &a) {
+    for (int i(0);i<I-1;++i)f<<a[i]<<' ';  return f<<a[I-1];
+  }
+
+  template <int I,typename T> inline const Vec<I,T> & operator+=(Vec<I,T> &a,const Vec<I,T> &b){
+    for (int i(0);i<I;++i) a[i]+=b[i];  return a;
+  }
+  template <int I,typename T> inline const Vec<I,T> & operator-=(Vec<I,T> &a,const Vec<I,T> &b){
+    for (int i(0);i<I;++i) a[i]-=b[i];  return a;
+  }
+  template <int I,typename T> inline const int operator== (const Vec<I,T> &a,const Vec<I,T> &b) {
+    int c(1);  for (int i(0);i<I;++i) c&=(a[i]==b[i]);  return c;
+  }
+//  template <int I,typename T> inline const Vec<I,T> operator/ (const Vec<I,T> &b,const T &a) {return (1./a)*b;}
+
+  ///Product of all Vector components, volume of ND dimentional box
+  template <int I,typename T> inline const T bvol (const Vec<I,T> &a) {T p(1);  for (int i(0);i<I;++i) p*=a[i];  return p;}
+  ///cheks whether the Vector components are nonegative
+  template <int I,typename T,class IT> inline bool nonneg(const Vec<I,T,IT> &a) {
+    int c(1);  for (int i(0);i<I;++i) c&=(a[i]>=0);  return c;
+  }
+
+
+  template <int I,typename T> inline const Vec<I,T> operator+ (const Vec<I,T> &a,const Vec<I,T> &b) {
+    Vec<I,T> c;  for (int i(0);i<I;++i) c[i]=a[i]+b[i];  return c;
+  };
+  template <int I,typename T> inline const Vec<I,T> operator- (const Vec<I,T> &a,const Vec<I,T> &b) {
+    Vec<I,T> c;  for (int i(0);i<I;++i) c[i]=a[i]-b[i];  return c;
+  };
+  template <int I,typename T> inline const Vec<I,T> operator* (const T &a,const Vec<I,T> &b) {
+    Vec<I,T> c;  for (int i(0);i<I;++i) c[i]=a*b[i];  return c;
+  };
+  template <int I,typename T> inline const T operator* (const Vec<I,T> &a,const Vec<I,T> &b) {
+    T c=0;  for (int i(0);i<I;++i) c+=a[i]*b[i];  return c;
+  };
+
+//  inline Vec<1,int> vceil(const Vec<1> &a) {return Vec<1,int>((int)ceil(a.x()));}
+//  inline Vec<1,int> vfloor(const Vec<1> &a) {return Vec<1,int>((int)floor(a.x()));}
+*/
+
+  ///creates from two Vectors a Vector with maximal components
+/*  template <typename T> inline Vec<3,T> cast_max(const Vec<3,T> &a,const Vec<3,T> &b) {
+    return Vec<3,T>(max(a.x(),b.x()),max(a.y(),b.y()),max(a.z(),b.z()));
+    }
+  ///creates from two Vectors a Vector with maximal components
+  template <typename T> inline Vec<3,T> cast_min(const Vec<3,T> &a,const Vec<3,T> &b) {
+    return Vec<3,T>(min(a.x(),b.x()),min(a.y(),b.y()),min(a.z(),b.z()));
+  }
+  template <typename T> inline Vec<3,T> vabs(const Vec<3,T> &a) {
+    return Vec<3,T>(fabs(a.x()),fabs(a.y()),fabs(a.z()));
+  }*/
+
+//  inline Vec<3,int> vround(const Vec<3> &a) {return Vec<3,int>((int)round(a.x()),(int)round(a.y()),(int)round(a.z()));}
+//  inline Vec<3,int> vtrunc(const Vec<3> &a) {return Vec<3,int>((int)a.x(),(int)a.y(),(int)a.z());}
+
+
+  ///returns minimum from the Vector components
+//  template <typename T> inline const T min(const Vec<1,T>& a){return a.x();}
+  ///returns maximum from the Vector components
+//  template <typename T> inline const T max(const Vec<1,T>& a){return a.x();}
+
+  ///Component production of Vector a on components of b
+//  template <typename T> inline const Vec<3,T> cprod(const Vec<3,T> &a,const Vec<3,T> &b) {
+//    return Vec<3,T>(a.x()*b.x(),a.y()*b.y(),a.z()*b.z());
+//  }
+
+/*  inline Vec<1,int> vec(int x){return Vec<1,int>(x);}
+  inline Vec<2,int> vec(int x,int y){return Vec<2,int>(x,y);}
+  inline Vec<3,int> vec(int x,int y,int z){return Vec<3,int>(x,y,z);}
+  inline Vec<1> vec(lFl x){return Vec<1>(x);}
+  inline Vec<2> vec(lFl x,lFl y){return Vec<2>(x,y);}
+  inline Vec<3> vec(lFl x,lFl y,lFl z){return Vec<3>(x,y,z);}
+*/
+		
+}
+
+#endif
+
diff --git a/src/num/CMakeLists.txt b/src/num/CMakeLists.txt
new file mode 100644
index 0000000..ae8e6f5
--- /dev/null
+++ b/src/num/CMakeLists.txt
@@ -0,0 +1,72 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslnum
+
+set(aslnum_PUBLIC_HEADERS
+	aslNumMethod.h
+	aslSingleKernelNM.h	
+	aslFDAdvectionDiffusion.h
+	aslFDAdvectionDiffusionBC.h
+	aslFDStefanMaxwell.h
+	aslFDElChemKinetics.h
+	aslFDMultiPhase.h
+	aslFDAdvectionDiffusion2.h
+	aslFDAdvectionDiffusionInhomogeneous.h
+	aslLBGK.h
+	aslLBGKBC.h
+	aslFDElasticity.h
+	aslFDPoroElasticity.h
+	aslFDPoroElasticityBC.h
+	aslBCond.h
+	aslBasicBC.h
+	aslBasicBC2.h
+	aslCrystalGrowthBC.h
+	aslNumMethodsMerger.h
+	aslFDElasticityBC.h
+	aslLevelSet.h
+	aslLevelSetLinear.h
+	aslDFOptimizer.h
+	aslLSNormalGrowth.h
+	aslInterfaceTrackingAlg1.h
+	aslLSFacetedGrowth.h
+	aslTimeContinuations.h
+	aslDataResampling.h
+)
+
+set(aslnum_SOURCES
+	${aslnum_PUBLIC_HEADERS}
+	aslNumMethod.cxx
+	aslSingleKernelNM.cxx
+	aslFDAdvectionDiffusion.cxx
+	aslFDAdvectionDiffusionBC.cxx
+	aslFDStefanMaxwell.cxx
+	aslFDElChemKinetics.cxx
+	aslFDMultiPhase.cxx
+	aslFDAdvectionDiffusion2.cxx
+	aslFDAdvectionDiffusionInhomogeneous.cxx
+	aslLBGK.cxx
+	aslLBGKBC.cxx
+	aslFDElasticity.cxx
+	aslFDPoroElasticity.cxx
+	aslFDPoroElasticityBC.cxx
+	aslBCond.cxx
+	aslBasicBC.cxx
+	aslBasicBC2.cxx
+	aslCrystalGrowthBC.cxx
+	aslFDElasticityBC.cxx
+	aslNumMethodsMerger.cxx
+	aslLevelSet.cxx
+	aslLevelSetLinear.cxx
+	aslDFOptimizer.cxx
+	aslInterfaceTrackingAlg1.cxx
+	aslLSNormalGrowth.cxx
+	aslLSFacetedGrowth.cxx
+	aslTimeContinuations.cxx
+	aslDataResampling.cxx
+)
+
+add_library(aslnum ${aslnum_SOURCES})
+target_link_libraries(aslnum aslacl)
+INSTALL_SUBLIB(aslnum aslnum_PUBLIC_HEADERS)
diff --git a/src/num/aslBCond.cxx b/src/num/aslBCond.cxx
new file mode 100644
index 0000000..9955cd3
--- /dev/null
+++ b/src/num/aslBCond.cxx
@@ -0,0 +1,682 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslBCond.h"
+#include <acl/acl.h>
+#include <acl/DataTypes/aclMemBlock.h>
+#include <acl/aclGenerators.h>
+//#include <agl/aglPointsList.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslDistanceFunctionAlg.h>
+
+namespace asl
+{
+
+	BCond::BCond(const Block & b):
+		block(b),
+		templ(nearestNeigboursVT(nD(b)))
+	{		
+	}
+
+	BCond::BCond(const Block & b, const VectorTemplate *const t):
+		block(b),
+		templ(t)
+	{		
+	}
+		
+	void BCond::addPoint(AVec<int> a,int d,double fr)
+	{
+		indices.push_back(block.c2i(a));
+		directions.push_back(d);
+		fractions.push_back(fr);
+	}
+
+
+	void BCond::loadIndicesToACL()
+	{
+		indicesACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices.size(),int(0)));
+		acl::copy(indices,(*indicesACL)[0]);
+	}
+
+
+	void BCond::loadDirectionsToACL()
+	{
+		directionsACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices.size(),int(0)));
+		acl::copy(directions,(*directionsACL)[0]);                       
+	}
+
+
+	void BCond::loadNeighbourIndicesToACL()
+	{
+		neighbourIndices.resize(indices.size());
+		for (unsigned int i(0); i < indices.size(); ++i)
+			neighbourIndices[i] =indices[i]+block.c2i(templ->vectors[directions[i]]);
+			
+		neighbourIndicesACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices.size(),int(0)));
+		acl::copy(neighbourIndices,(*neighbourIndicesACL)[0]);                       
+	}
+
+		
+	const Block& BCond::getBlock()
+	{
+		return block;	
+	}
+
+	BCondWithMap::BCondWithMap(SPAbstractDataWithGhostNodes m, const VectorTemplate * const vt):
+			pointsListFlag(false),
+			currentPoint(acl::generateVEIndex()),
+			templ(vt),
+			bl(m->getBlock()),
+			map(m)
+	{
+		unsigned int numD(nD(bl));
+		if(numD != 2 && numD != 3)
+			errorMessage("BCondWithMap : the map has wrong dimentionality");	
+
+	}	
+
+	BCondWithMap::BCondWithMap(SPDistanceFunction m, 
+	                           const Block & b, 
+	                           const VectorTemplate * const vt):
+		pointsListFlag(false),
+		currentPoint(acl::generateVEIndex()),
+		templ(vt),
+		bl(b),
+		mapDF(m)
+	{
+		unsigned int numD(nD(bl));
+		if(numD != 2 && numD != 3)
+			errorMessage("BCondWithMap : the map has wrong dimentionality");	
+	}	
+		
+	BCondWithMap::BCondWithMap(SPAbstractDataWithGhostNodes m, 
+	                           SPAbstractDataWithGhostNodes cd, 
+	                           const VectorTemplate * const vt):
+		pointsListFlag(false),
+		currentPoint(acl::generateVEIndex()),
+		templ(vt),
+		bl(m->getBlock()),
+		map(m),
+		computationalDomain(cd)	
+	{
+		unsigned int numD(nD(bl));
+		unsigned int numDcd(nD(computationalDomain->getBlock()));
+		if(numD != numDcd)
+			errorMessage("BCondWithMap : the map and computationalDomain has different dimentionality");	
+		if(numD != 2 && numD != 3)
+			errorMessage("BCondWithMap : the map has wrong dimentionality");	
+
+	}				
+
+	BCondWithMap::BCondWithMap(SPAbstractDataWithGhostNodes m, 
+	                           SPDistanceFunction cd, 
+	                           const VectorTemplate * const vt):
+		pointsListFlag(false),
+		currentPoint(acl::generateVEIndex()),
+		templ(vt),
+		bl(m->getBlock()),
+		map(m),
+		computationalDomainDF(cd)	
+	{
+		unsigned int numD(nD(bl));
+		if(numD != 2 && numD != 3)
+			errorMessage("BCondWithMap : the map has wrong dimentionality");	
+	}				
+
+	BCondWithMap::BCondWithMap(SPDistanceFunction m, 
+	                           SPDistanceFunction cd,
+	                           const Block & b,
+	                           const VectorTemplate * const vt):
+		pointsListFlag(false),
+		currentPoint(acl::generateVEIndex()),
+		templ(vt),
+		bl(b),
+		mapDF(m),
+		computationalDomainDF(cd)	
+	{
+		unsigned int numD(nD(bl));
+		if(numD != 2 && numD != 3)
+			errorMessage("BCondWithMap : the map has wrong dimentionality");	
+	}				
+		
+		
+	void BCondWithMap::initMapInfrastructure(acl::ExpressionContainer & ec)
+	{
+		bool isMapDF(mapDF.get()!=0);
+		bool isCDDF(computationalDomainDF.get()!=0);
+		//todo!!!!!!!!!!!!!!!!!!
+		if(isMapDF || isCDDF)
+		{
+			
+		}
+			
+		if(isMapDF)
+		{
+//			mapTVE.reset(new TemplateVE(*mapDF,, *templ));
+			ec << mapTVE->initValues;		
+			
+		}
+		else
+		{
+			auto mapX(generateDCFullSafe(map, -.9));
+			mapTVE.reset(new TemplateVE(*mapX, *templ));
+//			mapTVE.reset(new TemplateVE(*map, *templ));
+			ec << mapTVE->initValues;		
+		}
+		bool isCompDom(computationalDomain.get()!=0);
+		if(isCompDom)
+		{
+			auto compDomX(generateDCFullSafe(computationalDomain, -1));
+			cDomainTVE.reset(new TemplateVE(*compDomX, *templ));
+			ec << cDomainTVE->initValues;
+		}
+	}
+
+	acl::VectorOfElements BCondWithMap::isGhostNode(unsigned int i)
+	{
+		return asl::isGhostNode(*mapTVE,i);
+	}
+
+	acl::VectorOfElements BCondWithMap::isComputationNode(unsigned int i)
+	{
+		auto res(asl::isComputationNode(*mapTVE,i));
+		bool isCompDom(computationalDomain.get()!=0);
+		if(isCompDom)
+			copy(res && asl::isComputationNode(*cDomainTVE,i), res);
+		return res;
+	}
+
+	acl::VectorOfElements BCondWithMap::isComputationNode(const vector<unsigned int> & ii)
+	{
+		auto res(subVE(mapTVE->values,ii[0]) > 0.);
+		for(unsigned int i(1); i < ii.size(); ++i)
+			copy(res && (subVE(mapTVE->values,ii[i]) > 0.), res);
+		bool isCompDom(computationalDomain.get()!=0);
+		if(isCompDom)
+		for(unsigned int i(0); i < ii.size(); ++i)			
+			copy(res && (acl::subVE(cDomainTVE->values,ii[i]) > 0.), res);
+		return res;
+	}
+		
+	acl::VectorOfElements BCondWithMap::isGhostNode()
+	{
+		return (map->getEContainer() <= 0.);
+	}
+
+	acl::VectorOfElements BCondWithMap::isComputationNode()
+	{
+		auto res(map->getEContainer() > 0.);
+		bool isCompDom(computationalDomain.get()!=0);
+		if(isCompDom)
+			copy(res && (computationalDomain->getEContainer() > 0.), res);
+		return res;
+	}
+		
+	BCondSlice::BCondSlice(const Block & b):
+		block(b),
+		templ(NULL)
+	{		
+	}
+
+	BCondSlice::BCondSlice(const Block & b, const VectorTemplate *const t):
+		block(b),
+		templ(t)
+	{		
+	}
+
+	inline unsigned int count0(const AVec<int> &a)
+	{
+		unsigned int n(0);
+		for (unsigned int i(0); i < nD(a); ++i)
+			n+=a[i] ==0?1:0;
+		return n;
+	}
+		
+	void BCondSlice::addGhostSlice(AVec<int> pB,AVec<int> pE,int d)
+	{
+		pointB=block.c2i(pB);
+		pointE=block.c2i(pE);
+		direction=d;
+		AVec<int> dif (pE-pB);
+		unsigned int n(count0(dif));
+		sliceDimentions.resize(n);
+		sliceIncrements.resize(n);
+		for (unsigned int i(0),k(0); i < nD(dif); ++i){
+			sliceDimentions[k] =dif[i];
+			sliceIncrements[k] =block.c2iTransformVector[i];
+			k+=dif[i] ==0?0:1;
+		}
+	}
+
+	const Block& BCondSlice::getBlock()
+	{
+		return block;	
+	}
+		
+
+	BCondConnector::BCondConnector(const Block & b1, const Block & b2):
+		block1(b1),
+		block2(b2)
+	{		
+	}
+
+
+	void BCondConnector::addGhostPoint(AVec<int> a1,AVec<int> a2)
+	{
+		indices1.push_back(block1.c2i(a1));
+		directions1.push_back(0);
+		indices2.push_back(block2.c2i(a2));
+		directions2.push_back(0);
+	}
+
+
+	void BCondConnector::addGhostPoint(AVec<int> a1,int d1,AVec<int> a2,int d2)
+	{
+		indices1.push_back(block1.c2i(a1));
+		directions1.push_back(d1);
+		indices2.push_back(block2.c2i(a2));
+		directions2.push_back(d2);
+	}
+
+	const Block & BCondConnector::getBlock1()
+	{
+		return block1;	
+	}
+
+	const Block & BCondConnector::getBlock2()
+	{
+		return block2;	
+	}
+
+
+	void BCondConnector::loadIndicesToACL()
+	{
+		indices1ACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices1.size(),int(0)));
+		acl::copy(indices1,(*indices1ACL)[0]);                       
+		indices2ACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices2.size(),int(0)));
+		acl::copy(indices2,(*indices2ACL)[0]);                       
+	}
+
+
+	void BCondConnector::loadDirectionsToACL()
+	{
+		directions1ACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices1.size(),int(0)));
+		acl::copy(directions1,(*directions1ACL)[0]);                       
+		directions2ACL=acl::SPVectorOfElementsData(new acl::VectorOfElementsData(1,indices2.size(),int(0)));
+		acl::copy(directions2,(*directions2ACL)[0]);                       
+	}
+
+	BCondConnectorSlice::BCondConnectorSlice(const Block & b1, const Block & b2, const VectorTemplate *const t):
+		block1(b1),
+		block2(b2),
+		templ(t)
+	{		
+	}
+		
+	void BCondConnectorSlice::addGhostSlice1(AVec<int> pB,AVec<int> pE,int d)
+	{
+		point1B=block1.c2i(pB);
+		point1E=block1.c2i(pE);
+		direction1=d;
+		AVec<int> dif (pE-pB);
+		unsigned int n(count0(dif));
+		sliceDimentions1.resize(n);
+		sliceIncrements1.resize(n);
+		for (unsigned int i(0),k(0); i < nD(dif); ++i){
+			sliceDimentions1[k] =dif[i];
+			sliceIncrements1[k] =block1.c2iTransformVector[i];
+			k+=dif[i] ==0?0:1;
+		}
+	}
+
+
+	void BCondConnectorSlice::addGhostSlice2(AVec<int> pB,AVec<int> pE,int d)
+	{
+		point2B=block1.c2i(pB);
+		point2E=block1.c2i(pE);
+		direction2=d;
+		AVec<int> dif (pE-pB);
+		unsigned int n(count0(dif));
+		sliceDimentions2.resize(n);
+		sliceIncrements2.resize(n);
+		for (unsigned int i(0),k(0); i < nD(dif); ++i){
+			sliceDimentions2[k] =dif[i];
+			sliceIncrements2[k] =block2.c2iTransformVector[i];
+			k+=dif[i] ==0?0:1;
+		}
+	}
+		
+	void addSliceX0(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==2){
+			AVec<int> dir(vt->vectors[1]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[1]-1; ++i)
+						a.addPoint(makeAVec (1,i)-vt->vectors[k],k);
+		}
+		else
+			if (nD(s)==3){
+				AVec<int> dir(vt->vectors[1]);
+				for (unsigned int k(1); k<vt->vectors.size(); ++k)
+					if(vt->vectors[k]*dir>0)
+						for (int i(1); i < s[1]-1; ++i)
+							for (int j(1);j<s[2]-1;++j)
+								a.addPoint(makeAVec (1,i,j)-vt->vectors[k],k);
+			}			
+	}
+
+
+	void addSliceXE(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==2){
+			AVec<int> dir(vt->vectors[3]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[1]-1; ++i)
+						a.addPoint(makeAVec (s[0]-2,i)-vt->vectors[k],k);
+		}
+		else
+			if (nD(s)==3){
+				AVec<int> dir(vt->vectors[4]);
+				for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[1]-1; ++i)
+						for (int j(1);j<s[2]-1;++j)
+							a.addPoint(makeAVec (s[0]-2,i,j)-vt->vectors[k],k);
+			}			
+	}
+
+
+	void addSliceY0(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==2){
+			AVec<int> dir(vt->vectors[2]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[0]-1; ++i)
+						a.addPoint(makeAVec (i,1)-vt->vectors[k],k);
+		}
+		else
+			if (nD(s)==3){
+				AVec<int> dir(vt->vectors[2]);
+				for (unsigned int k(1); k<vt->vectors.size(); ++k)
+					if(vt->vectors[k]*dir>0)
+						for (int i(1); i < s[0]-1; ++i)
+							for (int j(1);j < s[2]-1;++j)
+								a.addPoint(makeAVec (i,1,j)-vt->vectors[k],k);
+			}			
+			
+	}
+
+
+	void addSliceYE(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==2){
+			AVec<int> dir(vt->vectors[4]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[0]-1; ++i)
+						a.addPoint(makeAVec (i,s[1]-2)-vt->vectors[k],k);
+		}else
+			if (nD(s)==3){
+				AVec<int> dir(vt->vectors[5]);
+				for (unsigned int k(1); k<vt->vectors.size(); ++k)
+					if(vt->vectors[k]*dir>0)
+						for (int i(1); i < s[0]-1; ++i)
+							for (int j(1); j < s[2]-1; ++j)
+								a.addPoint(makeAVec (i,s[1]-2,j)-vt->vectors[k],k);
+			}			
+	}
+
+
+	void addSliceZ0(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==3){
+			AVec<int> dir(vt->vectors[3]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[0]-1; ++i)
+						for (int j(1); j < s[1]-1; ++j)
+							a.addPoint(makeAVec (i,j,1)-vt->vectors[k],k);
+		}			
+			
+	}
+
+
+	void addSliceZE(BCond & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		const VectorTemplate * vt(a.getVT());
+		if (nD(s)==3){
+			AVec<int> dir(vt->vectors[6]);
+			for (unsigned int k(1); k<vt->vectors.size(); ++k)
+				if(vt->vectors[k]*dir>0)
+					for (int i(1); i < s[0]-1; ++i)
+						for (int j(1);j<s[1]-1;++j)
+							a.addPoint(makeAVec (i,j,s[2]-2)-vt->vectors[k],k);
+		}			
+	}
+
+	void addSlices(BCond & bc, const vector<SlicesNames> & sl)
+	{
+		if(find(sl.begin(), sl.end(), X0) != sl.end())
+			addSliceX0(bc);
+		if(find(sl.begin(), sl.end(), XE) != sl.end())
+			addSliceXE(bc);
+		if(find(sl.begin(), sl.end(), Y0) != sl.end())
+			addSliceY0(bc);
+		if(find(sl.begin(), sl.end(), YE) != sl.end())
+			addSliceYE(bc);
+		if(find(sl.begin(), sl.end(), Z0) != sl.end())
+			addSliceZ0(bc);
+		if(find(sl.begin(), sl.end(), ZE) != sl.end())
+			addSliceZE(bc);
+		
+	}
+
+		
+	void addSliceX(BCond & a, int x)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2){
+			for (int i(0); i < s[1]; ++i)
+				a.addPoint(makeAVec (x,i));
+		}
+		else
+			if (nD(s)==3){
+				for (int i(0); i < s[1]; ++i)
+					for (int j(0);j<s[2];++j)
+						a.addPoint(makeAVec (x,i,j));
+			}		
+	}
+
+	void addSliceY(BCond & a, int y)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2){
+			for (int i(0); i < s[0]; ++i)
+				a.addPoint(makeAVec (i,y));
+		}
+		else
+			if (nD(s)==3){
+				for (int i(0); i < s[0]; ++i)
+					for (int j(0);j<s[2];++j)
+						a.addPoint(makeAVec (i,y,j));
+			}		
+	}
+
+	void addSliceZ(BCond & a, int z)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2){
+			asl::errorMessage("addSliceZ: The data dimentionality is 2");
+		}
+		else
+			if (nD(s)==3){
+				for (int i(0); i < s[0]; ++i)
+					for (int j(0);j<s[1];++j)
+						a.addPoint(makeAVec (i,j,z));
+			}		
+	}
+		
+
+	void addSliceX0(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2)
+			a.addGhostSlice(makeAVec(0,0),makeAVec(0,s[1]),1);
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(0,0,0),makeAVec(0,s[1],s[2]),1);
+	}
+
+
+	void addSliceXE(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2)
+			a.addGhostSlice(makeAVec(s[0],0),makeAVec(s[0],s[1]),3);
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(s[0],0,0),makeAVec(s[0],s[1],s[2]),4);
+	}
+
+
+	void addSliceY0(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2)
+			a.addGhostSlice(makeAVec(0,0),makeAVec(s[0],0),2);
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(0,0,0),makeAVec(s[0],0,s[2]),2);
+	}
+
+
+	void addSliceYE(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)==2)
+			a.addGhostSlice(makeAVec(0,s[1]),makeAVec(s[0],s[1]),4);
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(0,s[1],0),makeAVec(s[0],s[1],s[2]),5);
+	}
+
+
+	void addSliceZ0(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)<3)
+			errorMessage ("addSliceZ0: The block dimensionality is less than 3");
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(0,0,0),makeAVec(s[0],s[1],0),3);
+	}
+
+
+	void addSliceZE(BCondSlice & a)
+	{
+		const AVec<int> & s(a.getBlock().getSize());
+		if (nD(s)<3)
+			errorMessage ("addSliceZE: The block dimensionality is less than 3");
+		else
+			if (nD(s)==3)
+				a.addGhostSlice(makeAVec(0,0,s[2]),makeAVec(s[0],s[1],s[2]),6);
+	}
+
+	/// checks intersection of a litice vector with a plane
+	/**
+		\param p0 point on the plane
+		\param n  plane normal
+		\param pn current node
+		\param templ the used template
+		\param dir number of direction
+	*/
+	inline bool checkIntersection(const AVec<> & p0, 
+	                               const AVec<> & n, 
+	                               const AVec<> & pn,
+	                               const VectorTemplate * templ, 
+	                               unsigned int dir)
+	{
+		double x(((p0-pn)*n)/(n*AVec<>(templ->vectors[dir])));
+		return x>0 && x<1; 
+	}
+
+	/// adds a point to a BCond object
+	/**
+		\param p0 point on the plane
+		\param n  plane normal
+		\param pn current node
+		\param templ the used template
+		\param dir number of direction
+	*/
+	inline void addPointToBC(BCond  & bc, 
+	             			  const AVec<> & p0, 
+	             			  const AVec<> & n, 
+	             			  const AVec<int> & pn)
+	{
+		if (in(bc.getBlock(),pn))
+		{
+			AVec<> r(AVec<>(pn)*bc.getBlock().dx+bc.getBlock().position);
+			double dist((r-p0)*n);
+			if (dist<=0 && dist>2.)
+				for(unsigned int i(0); i<bc.getVT()->vectors.size();++i)
+					if (checkIntersection(p0,n,r,bc.getVT(),i))
+						bc.addPoint(pn,i);
+		}
+		
+	}
+		
+/*	void addAGLObject(BCond  & bc, agl::SPPointsList geom)
+	{
+		unsigned int maxId(geom->maxId());		
+		for (unsigned int i(0); i < maxId; geom->next(i))
+		{
+			AVec<> p0(geom->getPoint(i));
+			AVec<int> pn0(asl::round((p0-bc.getBlock().position)/bc.getBlock().dx));
+			for(unsigned int i(0); i<bc.getVT()->vectors.size(); ++i)
+			{
+				AVec<int> pn(pn0+bc.getVT()->vectors[i]);
+				addPointToBC(bc, geom->getPoint(i), geom->getSurfaceNormal(i), pn);
+			}
+		}
+	}
+*/		
+} // asl
+
diff --git a/src/num/aslBCond.h b/src/num/aslBCond.h
new file mode 100644
index 0000000..8da3edb
--- /dev/null
+++ b/src/num/aslBCond.h
@@ -0,0 +1,353 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLBCOND_H
+#define ASLBCOND_H
+
+#include "aslNumMethod.h"
+#include <data/aslBlocks.h>
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+
+
+namespace acl
+{
+	class ExpressionContainer;
+}
+
+namespace asl
+{
+
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
+	typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
+	class TemplateVE;
+	class DistanceFunction;
+	typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;
+
+	
+	class AbstractDataWithGhostNodes; 
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Virtual class describes general interface for boundary conditions
+	/**
+		  \ingroup BoundaryConditions
+	*/
+	class BCond: public NumMethod
+	{
+		protected:
+			Block block;
+			const VectorTemplate * const templ;
+
+			std::vector<int> indices;
+			std::vector<int> directions;
+			std::vector<double> fractions;
+			std::vector<int> neighbourIndices;
+			
+			acl::SPVectorOfElementsData indicesACL;
+			acl::SPVectorOfElementsData neighbourIndicesACL;
+			acl::SPVectorOfElementsData directionsACL;
+			acl::SPVectorOfElementsData fractionsACL;
+			
+			void loadIndicesToACL();
+			void loadNeighbourIndicesToACL();
+			void loadDirectionsToACL();
+			void loadfractionsACL();
+
+		public:
+			BCond(const Block & b);
+			BCond(const Block & b, const VectorTemplate * const t);
+			void addPoint(AVec<int> a,int d=0,double fr=0);			
+			const Block & getBlock();
+			inline const VectorTemplate * getVT();
+			
+	};
+
+	typedef std::shared_ptr<BCond> SPBCond;
+
+	/// Virtual class describes general interface for boundary conditions
+	/**
+		\ingroup BoundaryConditions
+
+		The class is aimed to deal with numerical with computational map. Namely
+		it should be a DataWithGhestNodes object with values in each point 
+		which can be interpreted as a computation map. The inteprretation law is:
+		- computation region: \f$ map(\vec r) > 0 \f$
+		- outside region: \f$ map(\vec r) \leq 0 \f$
+	*/
+	class BCondWithMap:public NumMethod
+	{
+		protected:
+			/// flag whether the point list to be generated or not
+			bool pointsListFlag;
+			acl::VectorOfElements currentPoint;
+			const VectorTemplate * const templ;
+
+			/// block 
+			Block bl;
+			/// boundary description for the particular BC
+			SPAbstractDataWithGhostNodes map;			
+			SPDistanceFunction mapDF;
+			/// Computational domain which contains all boundaries and the particular boundary as well
+			SPAbstractDataWithGhostNodes computationalDomain;
+			SPDistanceFunction computationalDomainDF;
+
+			unique_ptr<TemplateVE> mapTVE;
+			unique_ptr<TemplateVE> cDomainTVE;
+
+			/// initialize mapTVE and cDomainTVE
+			virtual void initMapInfrastructure(acl::ExpressionContainer & ec);
+			/// returns expression corresponding to check if the node in i^th direction is ghost one
+			/**
+				 Requires call of initMapInfrastructure
+			*/
+			acl::VectorOfElements isGhostNode(unsigned int i);
+			/// returns expression corresponding to check if the node in i^th direction is computation one
+			/**
+				 Requires call of initMapInfrastructure
+			*/
+			acl::VectorOfElements isComputationNode(unsigned int i);
+			/// returns expression corresponding to check if nodes in directions \p ii are computation ones
+			/**
+				 Requires call of initMapInfrastructure
+			*/
+			acl::VectorOfElements isComputationNode(const vector<unsigned int> & ii);
+			/// returns expression corresponding to check if the current node is ghost one
+			acl::VectorOfElements isGhostNode();
+			/// returns expression corresponding to check if the current node is computation one
+			acl::VectorOfElements isComputationNode();
+			
+			/**
+			 \param m the map
+			 \param t the corresponding template
+			 */
+			BCondWithMap(SPAbstractDataWithGhostNodes m, const VectorTemplate * const vt);
+			/**
+			 \param m the map
+			 \param t the corresponding template
+			 */
+			BCondWithMap(SPDistanceFunction m, const Block & b, const VectorTemplate * const vt);
+			/**
+			 \param m the map for the particular boundary
+			 \param cd the map for the computational domain
+			 \param t the corresponding template
+			 */
+			BCondWithMap(SPAbstractDataWithGhostNodes m, 
+			             SPAbstractDataWithGhostNodes cd, 
+			             const VectorTemplate * const vt);			
+			/**
+			 \param m the map for the particular boundary
+			 \param cd the map for the computational domain
+			 \param t the corresponding template
+			 */
+			BCondWithMap(SPAbstractDataWithGhostNodes m, 
+			             SPDistanceFunction cd, 
+			             const VectorTemplate * const vt);			
+			/**
+			 \param m the map for the particular boundary
+			 \param cd the map for the computational domain
+			 \param t the corresponding template
+			 \param b the computation block
+			 */
+			BCondWithMap(SPDistanceFunction m, 
+			             SPDistanceFunction cd,
+			             const Block & b,
+			             const VectorTemplate * const vt);			
+		public:
+			inline const VectorTemplate * getVT();			
+	};
+
+	
+	/// Virtual class describes general interface for boundary conditions which connect two datas
+	/**
+		 \ingroup BoundaryConditions
+		 The class contains an explicit list of coneting points. 
+		 This gives certain flexibility for definition of the boundary geometry.
+	 */
+	class BCondConnector:public NumMethod
+	{
+		protected:
+			Block block1;
+			Block block2;
+			
+			std::vector<int> indices1;
+			std::vector<int> directions1;
+			std::vector<int> indices2;
+			std::vector<int> directions2;
+
+			acl::SPVectorOfElementsData indices1ACL;
+			acl::SPVectorOfElementsData directions1ACL;
+			acl::SPVectorOfElementsData indices2ACL;
+			acl::SPVectorOfElementsData directions2ACL;
+			
+			void loadIndicesToACL();
+			void loadDirectionsToACL();
+		public:
+			BCondConnector(const Block & b1, const Block & b2);
+			void addGhostPoint(AVec<int> a1,AVec<int> a2);
+			void addGhostPoint(AVec<int> a1,int d1,AVec<int> a2,int d2);
+			const Block & getBlock1();
+			const Block & getBlock2();
+	};
+
+
+	/// Virtual class describes general interface for boundary conditions
+	/**
+		 \ingroup BoundaryConditions
+
+		 The class differs from the class BCond by no use of the 
+		 explicite connection point lists. The boundary slice defined by first and last 
+		 points.
+		 
+		 \todo Add posibility to define several slices with different 
+		 dimensionalities
+	 */
+	class BCondSlice:public NumMethod
+	{
+		protected:
+			Block block;
+			const VectorTemplate * const templ;
+			
+			int pointB;
+			int pointE;
+			AVec<int> sliceDimentions;
+			AVec<int> sliceIncrements;
+			int direction;
+						
+		public:
+			BCondSlice(const Block & b);
+			BCondSlice(const Block & b, const VectorTemplate * const t);
+			void addGhostSlice(AVec<int> pB,AVec<int> pE, int dir);
+			const Block & getBlock();
+	};	
+	
+	/// Virtual class describes general interface for boundary conditions which connect two datas
+	/**
+		 \ingroup BoundaryConditions
+
+		 The class differs from the class BCondConnector by no use of the 
+		 explicite connection point lists. The boundary defined by fist and last 
+		 point numbers and by definition of corresponding increments and 
+		 dimensionality of the point set. 
+		 
+		 \todo Add posibility to define several slices with different 
+		 dimensionalities
+	 */
+	class BCondConnectorSlice:public NumMethod
+	{
+		protected:
+			Block block1;
+			Block block2;
+			const VectorTemplate * const templ;
+			
+			int point1B;
+			int point1E;
+			AVec<int> sliceDimentions1;
+			AVec<int> sliceIncrements1;
+			int direction1;
+
+			int point2B;
+			int point2E;
+			AVec<int> sliceDimentions2;
+			AVec<int> sliceIncrements2;
+			int direction2;
+						
+		public:
+			BCondConnectorSlice(const Block & b1, const Block & b2, const VectorTemplate *const t);
+			void addGhostSlice1(AVec<int> pB,AVec<int> pE, int dir);
+			void addGhostSlice2(AVec<int> pB,AVec<int> pE, int dir);
+			const Block & getBlock1();
+			const Block & getBlock2();
+	};
+
+	/// Virtual class describes general interface for boundary conditions 
+	/**
+		 The class is sutable for BC with moving boundary. It takes the 
+		 list points and corresponding normals as an input. The boundary conditions
+		 are computed automaticaly for a given VectorTemplate.
+		  \ingroup BoundaryConditions
+	*/
+	class BCondDynamic:public NumMethod
+	{
+		protected:
+			Block block;
+			const VectorTemplate * const templ;
+						
+			acl::SPVectorOfElementsData pointsACL;
+			acl::SPVectorOfElementsData normalsACL;
+			
+		public:
+			BCondDynamic(const Block & b);
+			BCondDynamic(const Block & b, const VectorTemplate * const t);
+			const Block & getBlock();
+			inline const VectorTemplate * getVT();
+	};
+
+	/// defines names of walls of a box \ingroup BoundaryConditions
+	enum SlicesNames {X0, XE, Y0, YE, Z0, ZE};
+	
+	///	\ingroup BoundaryConditions 
+	///@{
+	void addSliceX0(BCond &);
+	void addSliceXE(BCond &);
+	void addSliceY0(BCond &);
+	void addSliceYE(BCond &);
+	void addSliceZ0(BCond &);
+	void addSliceZE(BCond &);
+	///@}
+
+	void addSlices(BCond &, const vector<SlicesNames> &);	
+		
+	///adds slice only points without directions \ingroup BoundaryConditions 
+	///@{
+	void addSliceX(BCond &, int x);
+	void addSliceY(BCond &, int y);
+	void addSliceZ(BCond &, int z);
+	///@}
+		
+	///	\ingroup BoundaryConditions 
+	///@{
+	void addSliceX0(BCondSlice &);
+	void addSliceXE(BCondSlice &);
+	void addSliceY0(BCondSlice &);
+	void addSliceYE(BCondSlice &);
+	void addSliceZ0(BCondSlice &);
+	void addSliceZE(BCondSlice &);
+	///@}
+
+// --------------------------- Implementation ----------------------
+	inline const VectorTemplate * BCond::getVT()
+	{
+		return templ;
+	}
+		
+	inline const VectorTemplate * BCondWithMap::getVT()
+	{
+		return templ;
+	}
+	
+}
+
+#endif //ASLBCOND_H
diff --git a/src/num/aslBasicBC.cxx b/src/num/aslBasicBC.cxx
new file mode 100644
index 0000000..3478fd0
--- /dev/null
+++ b/src/num/aslBasicBC.cxx
@@ -0,0 +1,635 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslBasicBC.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/aclGenerators.h"
+#include <acl/Kernels/aclKernel.h>
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include <aslGenerators.h>
+#include <math/aslTemplateVE.h>
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslIndex2Position.h>
+#include <math/aslPositionFunction.h>
+#include <utilities/aslUValue.h>
+#include "aslBasicBC2.h"
+
+
+namespace asl
+{
+	BCConstantValue::BCConstantValue(Data d, const acl::VectorOfElements & v):
+		BCond(d->getBlock()),
+		kernel(new acl::Kernel()),
+		data(d),
+		value(v)
+	{
+	}
+
+
+	void BCConstantValue::init()
+	{
+		loadIndicesToACL();
+		kernel->clear();
+		(*kernel)<<(acl::excerpt(data->getEContainer(), *indicesACL) = value);
+		kernel->setup();
+	}
+
+
+	void BCConstantValue::execute()
+	{
+		kernel->compute();
+	}
+
+
+	void BCConstantValue::setValue(const acl::VectorOfElements & v)
+	{
+		 acl::copy(v,value);
+	}
+
+	BCConstantValueMap::BCConstantValueMap(Data d, 
+	                                       const acl::VectorOfElements & v, 
+	                                       Data map):
+		BCondWithMap(map, nearestNeigboursVT(nD(d->getBlock()))),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCConstantValueMap::~BCConstantValueMap()
+	{
+	}
+
+
+	void BCConstantValueMap::init()
+	{		
+		acl::ExpressionContainer kk;
+		
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		auto vGhost(data->getEContainer());
+		kk << (acl::assignmentSafe(vGhost, 
+		                           select(vGhost, value, isGhostNode(), type)));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCConstantValueMap::execute()
+	{
+		kernel->compute();
+	}
+		
+	BCValuePFMap::BCValuePFMap(Data d, 
+	                           SPPositionFunction v, 
+	                           Data map):
+		BCondWithMap(map, nearestNeigboursVT(nD(d->getBlock()))),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCValuePFMap::~BCValuePFMap()
+	{
+	}
+
+	void BCValuePFMap::init()
+	{		
+		acl::ExpressionContainer kk;
+		
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		auto vGhost(data->getEContainer());
+		asl::Index2PositionACL i2p(data->getBlock(),type);
+
+		kk << i2p.initPosition;		
+		auto val(value->value(i2p.position));
+		kk << (acl::assignmentSafe(vGhost, 
+		                           select(vGhost, val, isGhostNode(), type)));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCValuePFMap::execute()
+	{
+		kernel->compute();
+	}
+
+		
+	BCConstantValueMiddlePointMap::
+		BCConstantValueMiddlePointMap(Data d, 
+	                                  const acl::VectorOfElements & v, 
+	                                  Data map,
+	                                  const VectorTemplate *const t):
+		BCondWithMap(map, t),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCConstantValueMiddlePointMap::~BCConstantValueMiddlePointMap()
+	{
+	}
+
+
+	void BCConstantValueMiddlePointMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nc(data->getEContainer().size());
+		
+		auto dataX(generateDCFullSafe(data));
+
+		acl::TypeID type(getElementType(data->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		initMapInfrastructure(kk);
+
+		vector<TemplateVE> dataTVE(nc);
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE[ii].init(*dataX, *templ, ii);
+			kk << dataTVE[ii].initValues;
+		}
+
+		auto vLocal(generateVEPrivateVariable(nc,type));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+		auto counter(generateVEPrivateVariable(1,type));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		
+		kk << (vLocal = acl::generateVEConstantN(nc,0.));
+		kk << (counter = acl::generateVEConstant(0.));
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i));
+
+			for(unsigned int ii(0); ii < nc; ++ii)
+			{
+				auto vBulk(subVE(dataTVE[ii].values,i));			                                       
+				kk << (subVE(vLocal,ii) += select(2.*subVE(value, ii) - vBulk, 
+			    		           			      isBoundary,
+			        		       				  type) * templ->laplasCoefs[i]);
+			}
+			kk << (counter+= select(acl::generateVEConstant( templ->laplasCoefs[i] ), 
+			                        isBoundary,
+			                        type));
+		}	
+
+		kk << (vLocal /= max(counter,acl::generateVEConstant(.01),type));
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			kk << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+		                               select(subVE(dataTVE[ii].values,0), 
+		                                      subVE(vLocal,ii),
+		                                      isGhostNode(0), 
+		                                      type)));
+		}
+		kernel->addExpression(acl::elementOperators::
+			                      ifElse(acl::elementOperators::any((isGhostNode() && 
+			                                                         map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCConstantValueMiddlePointMap::execute()
+	{
+		kernel->compute();
+	}
+
+		
+	BCConstantGradient::BCConstantGradient(Data d, 
+		                           const acl::VectorOfElements & v, 
+	                               const VectorTemplate *const t):
+		BCond(d->getBlock(), t),
+		kernel(new acl::Kernel()),
+		data(d),
+		value(v * block.dx)
+	{
+	}
+
+	void BCConstantGradient::init()
+	{
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		kernel->clear();
+		(*kernel) << (acl::excerpt(data->getEContainer(), *indicesACL) =
+		              acl::excerpt(data->getEContainer(), *neighbourIndicesACL) -
+		              value);
+		kernel->setup();
+	}
+
+	void BCConstantGradient::execute()
+	{
+		kernel->compute();
+	}
+
+	void BCConstantGradient::setValue(const acl::VectorOfElements & v)
+	{
+		acl::copy(v * block.dx, value);
+	}
+
+	BCConstantGradientMap::BCConstantGradientMap(Data d, 
+	                                     const acl::VectorOfElements & v, 
+	                                     Data map,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, t),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCConstantGradientMap::BCConstantGradientMap(Data d, 
+	                                     const acl::VectorOfElements & v, 
+	                                     Data map,
+	                                     Data computationalDomain,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, computationalDomain, t),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+		
+	BCConstantGradientMap::~BCConstantGradientMap()
+	{
+	}
+
+
+	void BCConstantGradientMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nc(data->getEContainer().size());
+		unsigned int nDir(templ->vectors.size());
+		unsigned int nd(nD(data->getBlock()));
+		
+		auto dataX(generateDCFullSafe(data));
+
+		initMapInfrastructure(kk);
+					
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto vLocal(generateVEPrivateVariable(1,type));
+		auto counter(generateVEPrivateVariable(1,type));
+		auto dirCoef(generateVEPrivateVariable(1,type));
+
+		kk << (counter = acl::generateVEConstant(0.));
+		kk << (normal = gradient(*mapTVE));
+		kk << (gcNormalize(normal));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kk << (dirCoef *= dirCoef );			
+			kk << (counter+= select(dirCoef, isComputationNode(i), type));
+		}
+		kk << (counter = max(counter,acl::generateVEConstant(.001), type));
+		
+		
+		TemplateVE dataTVE;	
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE.init(*dataX, *templ, ii,false);
+			kk << (vLocal = acl::generateVEConstant(0.));
+			for(unsigned int i(1); i < nDir; ++i)
+			{
+				kk << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+				kk << (dirCoef *= dirCoef );							
+				kk << (vLocal += select((dataTVE.getValue(i) - 
+				                         (normal*normalize(templ->vectors[i]))*subVE(value, ii)) *
+				                        dirCoef, 
+				                        isComputationNode(i),
+				                        type));
+			}		
+			kk << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+				                       select(subVE(dataTVE.values,0), 
+				                              vLocal/counter, 
+				                              isGhostNode(0) && counter>0.1, 
+				                              type)));
+		}
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+/*	void BCConstantGradientMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nc(data->getEContainer().size());
+		unsigned int nd(nD(data->getBlock()));
+		
+		auto dataX(generateDCFullSafe(data));
+
+		initMapInfrastructure(kk);
+					
+		acl::TypeID type(getElementType(data->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		vector<TemplateVE> dataTVE(nc);
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE[ii].init(*dataX, *templ, ii);
+			kk << dataTVE[ii].initValues;
+		}
+
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto vLocal(generateVEPrivateVariable(nc,type));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+		auto counter(generateVEPrivateVariable(1,type));
+		auto dirCoef(generateVEPrivateVariable(1,type));
+		
+		unsigned int nDir(templ->vectors.size());
+		
+		kk << (vLocal = acl::generateVEConstantN(nc,0.));
+		kk << (counter = acl::generateVEConstant(0.));
+		kk << (normal = gradient(*mapTVE));
+		kk << (gcNormalize(normal));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i));
+			kk << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kk << (dirCoef *= dirCoef );
+			for(unsigned int ii(0); ii < nc; ++ii)
+			{
+				auto vBulk(subVE(dataTVE[ii].values,i));			                                       
+				kk << (subVE(vLocal,ii) += select(acl::generateVEConstant(0.), 
+					    				          vBulk - subVE(value, ii) * 
+				                                  (normal * templ->vectors[i]), 
+			    		           			      isBoundary,
+			        		       				  type) * dirCoef);
+			}
+			kk << (counter+= select(acl::generateVEConstant( 0.), 
+			                        dirCoef, 
+			                        isBoundary,
+			                        type));
+		}	
+		kk << (vLocal /= max(counter,acl::generateVEConstant(.01)));
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			kk << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+		                               select(subVE(dataTVE[ii].values,0),
+		                                      subVE(vLocal,ii),
+		                                      isGhostNode(0), 
+		                                      type)));
+		}
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+*/
+	void BCConstantGradientMap::execute()
+	{
+		kernel->compute();
+	}
+
+		
+	BCConstantSource::BCConstantSource(Data d, cl_double v):
+		BCond(d->getBlock()),
+		kernel(new acl::Kernel()),
+		data(d),
+		value(v)
+	{
+	}
+		
+	void BCConstantSource::init()
+	{
+		loadIndicesToACL();
+		kernel->clear();
+		(*kernel)<<(acl::excerpt(data->getEContainer(),*indicesACL)+=
+		         acl::generateVEVariableR(value));
+		kernel->setup();
+	}
+
+
+	void BCConstantSource::execute()
+	{
+		kernel->compute();
+	}
+
+
+	void BCConstantSource::setValue(cl_double v)
+	{
+		value = v;
+	}
+		
+
+	BCDirectCopier::BCDirectCopier(Data dSource, Data dDestination):
+		BCondConnector(dSource->getBlock(), dDestination->getBlock()),
+		kernel(new acl::Kernel()),
+		source(dSource),
+		destination(dDestination)
+	{
+	}
+
+
+	void BCDirectCopier::init()
+	{
+		loadIndicesToACL();
+		kernel->clear();
+		(*kernel)<<(acl::excerpt(destination->getEContainer(),*indices2ACL)=
+		         acl::excerpt(source->getEContainer(),*indices1ACL));
+//		(*kernel)<<(*indices2ACL=*indices1ACL);
+		kernel->setup();
+	}
+
+
+	void BCDirectCopier::execute()
+	{
+		kernel->compute();
+	}
+
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                double v, 
+	                                const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantValue>(d, acl::generateVEConstant(v)));
+		addSlices(*bc,sl);	
+		return bc;
+	}		
+
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                UValue<double> & v, 
+	                                const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantValue>(d, acl::generateVEVariableSP(v.p)));
+		addSlices(*bc,sl);	
+		return bc;		
+	}
+		
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                UValue<AVec<float>> & v, 
+	                                const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantValue>(d, acl::generateVEVariableSP(v.p)));
+		addSlices(*bc,sl);	
+		return bc;		
+	}
+		
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                AVec<> v, 
+	                                const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantValue>(d, acl::generateVEConstant(v)));
+		addSlices(*bc,sl);	
+		return bc;
+	}
+		
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                double v, 
+	                                SPAbstractDataWithGhostNodes map)
+	{
+		return make_shared<BCConstantValueMap>(d, acl::generateVEConstant(v), map);		
+	}
+
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                AVec<> v, 
+	                                SPAbstractDataWithGhostNodes map)
+	{
+		return make_shared<BCConstantValueMap>(d, acl::generateVEConstant(v), map);		
+	}
+
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                    SPPositionFunction v, 
+	                                    SPAbstractDataWithGhostNodes map)
+	{
+		return make_shared<BCValuePFMap>(d, v, map);		
+	}
+		
+	SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d, 
+	                                               double v, 
+	                                               SPAbstractDataWithGhostNodes map,
+	                                               const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantValueMiddlePointMap>
+			      (d, acl::generateVEConstant(v), map, t);		
+	}
+
+	SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d, 
+	                                               AVec<> v, 
+	                                               SPAbstractDataWithGhostNodes map,
+	                                               const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantValueMiddlePointMap>
+			      (d, acl::generateVEConstant(v), map, t);		
+	}
+
+	SPBCond generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                               double v,
+	                               const VectorTemplate *const t,
+	                               const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantGradient>(d, acl::generateVEConstant(v),t));
+		addSlices(*bc,sl);	
+		return bc;
+	}
+
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       double v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap>
+			      (d, acl::generateVEConstant(v), map, t);	
+	}
+
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       AVec<> v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap>
+			      (d, acl::generateVEConstant(v), map, t);	
+	}
+
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       double v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       SPAbstractDataWithGhostNodes computationalDomain,
+	                                       const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap>
+			      (d, acl::generateVEConstant(v), map, computationalDomain, t);	
+	}
+
+		
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        double v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap2>
+			      (d, acl::generateVEConstant(v), map, t);	
+	}
+
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        AVec<> v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap2>
+			(d, acl::generateVEConstant(v), map, t);	
+	}
+
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        double v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        SPAbstractDataWithGhostNodes computationalDomain,
+	                                        const VectorTemplate *const t)
+	{
+		return make_shared<BCConstantGradientMap2>
+			(d, acl::generateVEConstant(v), map, computationalDomain, t);	
+	}
+		
+} // asl
+
diff --git a/src/num/aslBasicBC.h b/src/num/aslBasicBC.h
new file mode 100644
index 0000000..87589e0
--- /dev/null
+++ b/src/num/aslBasicBC.h
@@ -0,0 +1,335 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLBASICBC_H
+#define ASLBASICBC_H
+
+#include "aslBCond.h"
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+
+
+namespace acl{
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+}
+
+
+
+namespace asl
+{
+	template <typename T> class UValue;
+	class PositionFunction;
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+
+
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	class BCConstantValue:public BCond
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantValue(Data d, const acl::VectorOfElements & v);
+			virtual void execute();
+			virtual void init();		
+			void setValue(const acl::VectorOfElements & v);
+	};
+
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	class BCConstantValueMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantValueMap(Data d, 
+			                   const acl::VectorOfElements & v, 
+			                   Data map);
+			~BCConstantValueMap();
+			virtual void execute();
+			virtual void init();		
+			void setValue(const acl::VectorOfElements & v);
+	};
+
+	/// Bondary condition that puts fixed value in each boundary point
+	/**
+		\ingroup GenericBC		 
+	*/	
+	class BCConstantValueMiddlePointMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantValueMiddlePointMap(Data d, 
+			                              const acl::VectorOfElements & v, 
+			                              Data map,
+			                              const VectorTemplate *const t);
+			~BCConstantValueMiddlePointMap();
+			virtual void execute();
+			virtual void init();		
+			void setValue(const acl::VectorOfElements & v);
+	};
+
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	class BCValuePFMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			SPPositionFunction value;
+		public:
+			BCValuePFMap(Data d, 
+		  	             SPPositionFunction val, 
+			             Data map);
+			~BCValuePFMap();
+			virtual void execute();
+			virtual void init();		
+			void setValue(SPPositionFunction v);
+	};
+	
+	
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                double v, 
+	                                const std::vector<SlicesNames> & sl);
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                UValue<double> & v, 
+	                                const std::vector<SlicesNames> & sl);
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                UValue<AVec<float>> & v, 
+	                                const std::vector<SlicesNames> & sl);
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+	SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                AVec<> v, 
+	                                const std::vector<SlicesNames> & sl);
+	
+	/// Bondary condition that puts fixed value in each point \ingroup GenericBC		 
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                   double v, 
+	                                   SPAbstractDataWithGhostNodes map);
+	
+	/// Bondary condition that puts fixed value in each point \ingroup GenericBC		 
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                   AVec<> v, 
+	                                   SPAbstractDataWithGhostNodes map);
+
+	/// Bondary condition that puts fixed value in each point \ingroup GenericBC		 
+	SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d, 
+	                                   SPPositionFunction v, 
+	                                   SPAbstractDataWithGhostNodes map);
+
+	/// Bondary condition that puts fixed value in each point \ingroup GenericBC		 
+	SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d, 
+	                                               double v, 
+	                                               SPAbstractDataWithGhostNodes map,
+	                                               const VectorTemplate *const t);
+
+	/// Bondary condition that puts fixed value in each point \ingroup GenericBC		 
+	SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d, 
+	                                               AVec<> v, 
+	                                               SPAbstractDataWithGhostNodes map,
+	                                               const VectorTemplate *const t);
+	
+
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	class BCConstantGradient:public BCond
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data  data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantGradient(Data d, 
+			               const acl::VectorOfElements & v, 
+			               const VectorTemplate *const t);
+			virtual void execute();
+			virtual void init();			
+			void setValue(const acl::VectorOfElements & value);	
+	};
+
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	class BCConstantGradientMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data  data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantGradientMap(Data d, 
+			                  const acl::VectorOfElements & v, 
+			                  Data map, 
+			                  const VectorTemplate *const t);
+			BCConstantGradientMap(Data d, 
+			                  const acl::VectorOfElements & v, 
+			                  Data map, 
+			                  Data computationalDomain, 
+			                  const VectorTemplate *const t);
+			~BCConstantGradientMap();
+			virtual void execute();
+			virtual void init();			
+			void setValue(const acl::VectorOfElements & v);	
+	};
+	
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	SPBCond generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                               double v,
+	                               const VectorTemplate *const t,	                               
+	                               const std::vector<SlicesNames> & sl);
+
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       double v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       const VectorTemplate *const t);
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       double v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       SPAbstractDataWithGhostNodes computatinalDomain,
+	                                       const VectorTemplate *const t);
+
+	/// Bondary condition that makes fixed gradient	\ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d, 
+	                                       AVec<> v, 
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       const VectorTemplate *const t);
+
+	/// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        double v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        const VectorTemplate *const t);
+	/// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        double v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        SPAbstractDataWithGhostNodes computatinalDomain,
+	                                        const VectorTemplate *const t);
+	
+	/// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC		 
+	SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d, 
+	                                        AVec<> v, 
+	                                        SPAbstractDataWithGhostNodes map,
+	                                        const VectorTemplate *const t);
+	
+	/// Bondary condition that adds fixed value to one in each point
+	/**
+		\ingroup GenericBC	
+	*/
+	class BCConstantSource:public BCond
+	{		
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			cl_double value; 
+		public:
+			BCConstantSource(Data d, cl_double v);
+			virtual void execute();
+			virtual void init();			
+			void setValue(cl_double value);
+	};
+
+	
+	/// Bondary condition that copies directly the values from one data to another
+	/**
+		\ingroup GenericBC		 
+	*/
+	class BCDirectCopier:public BCondConnector
+	{		
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data & source;
+			Data & destination;
+		public:
+			BCDirectCopier(Data dSource,Data dDestination);
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition that puts fixed value in each point uses Slices
+	/**
+		\ingroup GenericBC		 
+	*/
+	class BCSConstantValue:public BCondSlice
+	{		
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+		protected:
+			acl::SPKernel kernel;			
+			Data data;
+			cl_double value; 
+		public:
+			BCSConstantValue(Data d, cl_double v);
+			virtual void execute();
+			virtual void init();			
+	};
+
+	
+	
+} //asl
+
+#endif //ASLBASICBC_H
diff --git a/src/num/aslBasicBC2.cxx b/src/num/aslBasicBC2.cxx
new file mode 100644
index 0000000..3494cf9
--- /dev/null
+++ b/src/num/aslBasicBC2.cxx
@@ -0,0 +1,273 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslBasicBC2.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/acl.h"
+#include "acl/aclGenerators.h"
+#include <acl/Kernels/aclKernel.h>
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include <aslGenerators.h>
+#include <math/aslTemplateVE.h>
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslIndex2Position.h>
+#include <math/aslPositionFunction.h>
+#include <utilities/aslUValue.h>
+#include <math/aslDistanceFunctionAlg.h>
+
+
+namespace asl
+{
+
+/*	BCConstantValueMap::BCConstantValueMap(Data d, 
+	                                       const acl::VectorOfElements & v, 
+	                                       Data map):
+		BCondWithMap(map, nearestNeigboursVT(nD(d->getBlock()))),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCConstantValueMap::~BCConstantValueMap()
+	{
+	}
+
+
+	void BCConstantValueMap::init()
+	{		
+		acl::ExpressionContainer kk;
+		
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		auto vGhost(data->getEContainer());
+		kk << (acl::assignmentSafe(vGhost, 
+		                           select(vGhost, value, isGhostNode(), type)));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCConstantValueMap::execute()
+	{
+		kernel->compute();
+	}
+*/
+/*
+	BCValuePFMap::BCValuePFMap(Data d, 
+	                           SPPositionFunction v, 
+	                           Data map):
+		BCondWithMap(map, nearestNeigboursVT(nD(d->getBlock()))),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCValuePFMap::~BCValuePFMap()
+	{
+	}
+
+	void BCValuePFMap::init()
+	{		
+		acl::ExpressionContainer kk;
+		
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		auto vGhost(data->getEContainer());
+		asl::Index2PositionACL i2p(data->getBlock(),type);
+
+		kk << i2p.initPosition;		
+		auto val(value->value(i2p.position));
+		kk << (acl::assignmentSafe(vGhost, 
+		                           select(vGhost, val, isGhostNode(), type)));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCValuePFMap::execute()
+	{
+		kernel->compute();
+	}
+*/
+		
+	BCConstantGradientMap2::BCConstantGradientMap2(Data d, 
+	                                               const acl::VectorOfElements & v, 
+	                                               Data map,
+	                                               const VectorTemplate *const t):
+		BCondWithMap(map, t),
+//		kernelCN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+//		kernelGN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernelCN(new acl::Kernel(acl::KERNEL_BASIC)),
+		kernelGN(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		value(v)
+	{
+	}
+
+	BCConstantGradientMap2::BCConstantGradientMap2(Data d, 
+	                                     const acl::VectorOfElements & v, 
+	                                     Data map,
+	                                     Data computationalDomain,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, computationalDomain, t),
+//		kernelCN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+//		kernelGN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernelCN(new acl::Kernel(acl::KERNEL_BASIC)),
+		kernelGN(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		value(v)
+	{
+	}
+		
+	BCConstantGradientMap2::~BCConstantGradientMap2()
+	{
+	}
+
+
+	void BCConstantGradientMap2::init()
+	{		
+		unsigned int nd(nD(data->getBlock()));
+		unsigned int nc(data->getEContainer().size()); // number of components 
+		unsigned int nDir(templ->vectors.size());
+		acl::TypeID type(getElementType(data->getEContainer()));
+		
+		auto counter(generateVEPrivateVariable(1,type));
+		auto vLocal(generateVEPrivateVariable(1,type));
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto dirCoef(generateVEPrivateVariable(1,type));
+		auto xx(generateVEPrivateVariable(1,type));
+
+		auto dataX(generateDCFullSafe(data));
+		TemplateVE dataTVE;	
+
+		acl::ExpressionContainer kkCN;
+		initMapInfrastructure(kkCN);
+		kkCN << (normal = gradient(*mapTVE));
+		kkCN << (gcNormalize(normal));
+		kkCN << (counter = acl::generateVEConstant(0.));
+		kkCN << (xx = acl::generateVEConstant(0.));
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kkCN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kkCN << (dirCoef *= dirCoef );			
+			kkCN << (counter+= select(dirCoef, isGhostNode(templ->invertVectors[i]), type));
+			kkCN << (xx+= select(dirCoef * exBoundaryX(*mapTVE,templ->invertVectors[i]), 
+			                     isGhostNode(templ->invertVectors[i]), type));
+		}
+		kkCN << (xx=select(acl::generateVEConstant(1.),xx/counter,counter>0.001,type));
+		kkCN << (counter = max(counter,acl::generateVEConstant(.001), type));
+		
+		
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE.init(*dataX, *templ, ii,false);
+			kkCN << (vLocal = acl::generateVEConstant(0.));
+			for(unsigned int i(1); i < nDir; ++i)
+			{
+				kkCN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+				kkCN << (dirCoef *= dirCoef );							
+				kkCN << (vLocal += select((dataTVE.getValue(i) - 
+				                           (normal*templ->vectors[i])*subVE(value, ii)) *
+				                          dirCoef, 
+				                          isGhostNode(templ->invertVectors[i]),
+				                          type));
+			}
+			kkCN << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+			                             select(dataTVE.getValue(0),
+			                             xx*dataTVE.getValue(0) + (1.-xx)*vLocal/counter, 
+			                                    isComputationNode(0), 
+			                                    type)));
+		}
+		kernelCN->addExpression(acl::elementOperators::
+			                        ifElse(acl::elementOperators::any((isComputationNode() && 
+			                                                           map->getEContainer() < .9999)[0]),
+			                               kkCN.expression, 
+			                               {} ));
+		kernelCN->setup();
+
+		
+		acl::ExpressionContainer kkGN;
+		initMapInfrastructure(kkGN);
+		kkGN << (normal = gradient(*mapTVE));
+		kkGN << (gcNormalize(normal));
+		kkGN << (counter = acl::generateVEConstant(0.));
+					
+		
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kkGN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kkGN << (dirCoef *= dirCoef );			
+			kkGN << (counter+= select(dirCoef, isComputationNode(i), type));
+		}
+		kkGN << (counter = max(counter,acl::generateVEConstant(.001), type));
+
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE.init(*dataX, *templ, ii,false);
+			kkGN << (vLocal = acl::generateVEConstant(0.));
+			for(unsigned int i(1); i < nDir; ++i)
+			{
+				kkGN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+				kkGN << (dirCoef *= dirCoef );							
+				kkGN << (vLocal += select((dataTVE.getValue(i) - 
+				                           (normal*templ->vectors[i])*subVE(value, ii)) *
+				                          dirCoef, 
+				                          isComputationNode(i),
+				                          type));
+			}
+			kkGN << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+			                             select(subVE(dataTVE.values,0), 
+			                                    vLocal/counter, 
+			                                    isGhostNode(0), 
+			                                    type)));
+		}
+		kernelGN->addExpression(acl::elementOperators::
+			                        ifElse(acl::elementOperators::any((isGhostNode() && 
+			                                                           map->getEContainer() > -.9999)[0]),
+			                               kkGN.expression, 
+			                               {} ));
+		kernelGN->setup();
+	}
+
+	void BCConstantGradientMap2::execute()
+	{
+		kernelCN->compute();
+		kernelGN->compute();
+	}
+
+		
+} // asl
+
diff --git a/src/num/aslBasicBC2.h b/src/num/aslBasicBC2.h
new file mode 100644
index 0000000..b5c6654
--- /dev/null
+++ b/src/num/aslBasicBC2.h
@@ -0,0 +1,121 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLBASICBC2_H
+#define ASLBASICBC2_H
+
+#include "aslBCond.h"
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+
+
+namespace acl{
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+}
+
+
+
+namespace asl
+{
+	template <typename T> class UValue;
+	class PositionFunction;
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+
+
+
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+/*	class BCConstantValueMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantValueMap(Data d, 
+			                   const acl::VectorOfElements & v, 
+			                   Data map);
+			~BCConstantValueMap();
+			virtual void execute();
+			virtual void init();		
+			void setValue(const acl::VectorOfElements & v);
+	};
+*/
+
+	/// Bondary condition that puts fixed value in each point
+	/**
+		\ingroup GenericBC		 
+	*/
+/*	class BCValuePFMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data data;
+			SPPositionFunction value;
+		public:
+			BCValuePFMap(Data d, 
+		  	             SPPositionFunction val, 
+			             Data map);
+			~BCValuePFMap();
+			virtual void execute();
+			virtual void init();		
+			void setValue(SPPositionFunction v);
+	};
+*/	
+	
+	/// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC		 
+	class BCConstantGradientMap2:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernelCN;
+			acl::SPKernel kernelGN;
+		protected:
+			Data  data;
+			acl::VectorOfElements value; 
+		public:
+			BCConstantGradientMap2(Data d, 
+			                       const acl::VectorOfElements & v, 
+			                       Data map, 
+			                       const VectorTemplate *const t);
+			BCConstantGradientMap2(Data d, 
+			                       const acl::VectorOfElements & v, 
+			                       Data map, 
+			                       Data computationalDomain, 
+			                       const VectorTemplate *const t);
+			~BCConstantGradientMap2();
+			virtual void execute();
+			virtual void init();			
+			void setValue(const acl::VectorOfElements & v);	
+	};
+		
+} //asl
+
+#endif //ASLBASICBC2_H
diff --git a/src/num/aslCrystalGrowthBC.cxx b/src/num/aslCrystalGrowthBC.cxx
new file mode 100644
index 0000000..e55a862
--- /dev/null
+++ b/src/num/aslCrystalGrowthBC.cxx
@@ -0,0 +1,470 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslCrystalGrowthBC.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/aclGenerators.h"
+#include <acl/Kernels/aclKernel.h>
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include <aslGenerators.h>
+#include <math/aslTemplateVE.h>
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslIndex2Position.h>
+#include <math/aslPositionFunction.h>
+#include <math/aslDistanceFunctionAlg.h>
+
+namespace asl
+{
+
+	BCLinearGrowthMap::BCLinearGrowthMap(Data d, 
+	                                     const acl::VectorOfElements & ceq, 
+	                                     const acl::VectorOfElements & b, 
+	                                     Data map,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, t),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+
+	BCLinearGrowthMap::BCLinearGrowthMap(Data d, 
+	                                     const acl::VectorOfElements & ceq, 
+	                                     const acl::VectorOfElements & b, 
+	                                     Data map,
+	                                     Data computationalDomain,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, computationalDomain, t),
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+		
+	BCLinearGrowthMap::~BCLinearGrowthMap()
+	{
+	}
+
+	void BCLinearGrowthMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nd(nD(data->getBlock()));
+		unsigned int nc(data->getEContainer().size());
+		
+		auto dataX(generateDCFullSafe(data));
+		
+		initMapInfrastructure(kk);
+					
+		acl::TypeID type(getElementType(data->getEContainer()));
+
+		vector<TemplateVE> dataTVE(nc);
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE[ii].init(*dataX, *templ, ii);
+			kk << dataTVE[ii].initValues;
+		}
+
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto vLocal(generateVEPrivateVariable(nc,type));
+		auto counter(generateVEPrivateVariable(1,type));
+		auto dirCoef(generateVEPrivateVariable(1,type));
+		
+		unsigned int nDir(templ->vectors.size());
+		
+		kk << (vLocal = acl::generateVEConstantN(nc,0.));
+		kk << (counter = acl::generateVEConstant(0.));
+		kk << (normal = gradient(*mapTVE));
+		kk << (gcNormalize(normal));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kk << (dirCoef *= dirCoef );
+			auto xx(exBoundaryX(*mapTVE,i));
+			for(unsigned int ii(0); ii < nc; ++ii)
+			{
+				auto vBulk(subVE(dataTVE[ii].values,i));
+				auto anv(subVE(beta,ii)*(normal * templ->vectors[i]));
+				auto c(subVE(cEq,ii));
+				kk << (subVE(vLocal,ii) += select(acl::generateVEConstant(0.), 
+					    				          (vBulk * (1.+ anv * xx) - anv*c) / 
+				                                  (1. - anv*(1. - xx)), 
+			    		           			      isComputationNode(i),
+			        		       				  type) * dirCoef);
+			}
+			kk << (counter+= select(acl::generateVEConstant( 0.), 
+			                        dirCoef, 
+			                        isComputationNode(i),
+			                        type));
+		}	
+		kk << (vLocal /= max(counter,acl::generateVEConstant(.01)));
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			kk << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+		                               select(subVE(dataTVE[ii].values,0),
+		                                      subVE(vLocal,ii),
+		                                      isGhostNode(0), 
+		                                      type)));
+		}
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCLinearGrowthMap::execute()
+	{
+		kernel->compute();
+	}
+
+	BCLinearGrowthMap1::BCLinearGrowthMap1(Data d, 
+	                                     const acl::VectorOfElements & ceq, 
+	                                     const acl::VectorOfElements & b, 
+	                                     Data map,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, t),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+
+	BCLinearGrowthMap1::BCLinearGrowthMap1(Data d, 
+	                                     const acl::VectorOfElements & ceq, 
+	                                     const acl::VectorOfElements & b, 
+	                                     Data map,
+	                                     Data computationalDomain,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, computationalDomain, t),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+		
+	BCLinearGrowthMap1::~BCLinearGrowthMap1()
+	{
+	}
+
+
+	void BCLinearGrowthMap1::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nd(nD(data->getBlock())); //< number of dimmentions
+		unsigned int nc(data->getEContainer().size()); // number of components 
+		
+		auto dataX(generateDCFullSafe(data));
+		
+		initMapInfrastructure(kk);
+					
+		acl::TypeID type(getElementType(data->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		TemplateVE dataTVE(*dataX, *templ);
+		kk << dataTVE.initValues;
+		
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto area(generateVEPrivateVariable(1,type));		
+		auto sw(generateVEPrivateVariable(1,type));
+		auto swc(generateVEPrivateVariable(1,type));
+		auto sna(generateVEPrivateVariable(1,type));		
+		auto sna1mx(generateVEPrivateVariable(1,type));		
+		auto snaxc(generateVEPrivateVariable(nc,type));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+		
+		unsigned int nDir(templ->vectors.size());
+		
+		kk << (sw = acl::generateVEConstant(0.));
+		kk << (swc = acl::generateVEConstant(0.));
+		kk << (sna = acl::generateVEConstant(0.));
+		kk << (sna1mx = acl::generateVEConstant(0.));
+		kk << (snaxc = acl::generateVEConstant(0.));
+		kk << (normal = gradient(*mapTVE));
+		kk << (gcNormalize(normal));
+		kk << gcBoundaryAreaPerGhostPoint(*mapTVE, area); 
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i));
+			kk << (sw += select(acl::generateVEConstant(templ->laplasCoefs[i]), 
+			                    isBoundary,type));
+			kk << (swc += select(dataTVE.getValue(i) * templ->laplasCoefs[i], 
+			                    isBoundary,type));
+			auto a(normalize(templ->vectors[i]));
+			kk << (sna += select(normal * a, 
+			                     isBoundary,type));
+			kk << (sna1mx += select((normal * a)*(1.-exBoundaryX(*mapTVE,i)), 
+			                        isBoundary,type));
+			kk << (snaxc += select((normal * a)*exBoundaryX(*mapTVE,i)*dataTVE.getValue(i), 
+			                       isBoundary,type));
+
+		}
+		auto vLocal((swc*sna-area*beta*snaxc+area*beta*cEq*sna)/(area*beta*sna1mx+sw*sna));
+		kk << (acl::assignmentSafe(data->getEContainer(), 
+		                           select(dataTVE.getValue(0), vLocal, isGhostNode(0), type)));
+		
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((isGhostNode() && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+	void BCLinearGrowthMap1::execute()
+	{
+		kernel->compute();
+	}
+
+	BCLinearGrowthMap2::BCLinearGrowthMap2(Data d, 
+	                                       const acl::VectorOfElements & ceq, 
+	                                       const acl::VectorOfElements & b, 
+	                                       Data map,
+	                                       const VectorTemplate *const t):
+		BCondWithMap(map, t),
+//		kernelCN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+//		kernelGN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernelCN(new acl::Kernel(acl::KERNEL_BASIC)),
+		kernelGN(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+
+	BCLinearGrowthMap2::BCLinearGrowthMap2(Data d, 
+	                                       const acl::VectorOfElements & ceq, 
+	                                       const acl::VectorOfElements & b, 
+	                                       Data map,
+	                                       Data computationalDomain,
+	                                       const VectorTemplate *const t):
+		BCondWithMap(map, computationalDomain, t),
+//		kernelCN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+//		kernelGN(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernelCN(new acl::Kernel(acl::KERNEL_BASIC)),
+		kernelGN(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		cEq(ceq),
+		beta(b)
+	{
+	}
+		
+	BCLinearGrowthMap2::~BCLinearGrowthMap2()
+	{
+	}
+
+	void BCLinearGrowthMap2::init()
+	{		
+		unsigned int nd(nD(data->getBlock()));
+		unsigned int nc(data->getEContainer().size());
+		unsigned int nDir(templ->vectors.size());
+		acl::TypeID type(getElementType(data->getEContainer()));
+		
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto vLocal(generateVEPrivateVariable(nc,type));
+		auto counter(generateVEPrivateVariable(1,type));
+		auto dirCoef(generateVEPrivateVariable(1,type));
+		auto xx(generateVEPrivateVariable(1,type));
+
+		auto dataX(generateDCFullSafe(data));
+		TemplateVE dataTVE;	
+
+
+		acl::ExpressionContainer kkCN;
+		initMapInfrastructure(kkCN);
+		
+		kkCN << (vLocal = acl::generateVEConstantN(nc,0.));
+		kkCN << (counter = acl::generateVEConstant(0.));
+		kkCN << (normal = gradient(*mapTVE));
+		kkCN << (gcNormalize(normal));
+		kkCN << (xx = acl::generateVEConstant(0.));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kkCN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kkCN << (dirCoef *= dirCoef );			
+			kkCN << (counter+= select(dirCoef, isGhostNode(templ->invertVectors[i]), type));
+			kkCN << (xx+= select(dirCoef * exBoundaryX(*mapTVE,templ->invertVectors[i]), 
+			                     isGhostNode(templ->invertVectors[i]), type));			
+		}
+		kkCN << (xx=select(acl::generateVEConstant(1.),xx/counter,counter>0.001,type));
+		kkCN << (counter = max(counter,acl::generateVEConstant(.001), type));
+
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE.init(*dataX, *templ, ii,false);
+			kkCN << (vLocal = acl::generateVEConstant(0.));
+			for(unsigned int i(1); i < nDir; ++i)
+			{
+				kkCN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+				kkCN << (dirCoef *= dirCoef);
+				auto anv(subVE(beta,ii)*(-normal * templ->vectors[i]));
+				kkCN << (vLocal += select((dataTVE.getValue(i)*(1.+anv*xx) + anv*subVE(cEq,ii)) /
+				                          (1.+ anv*(1.+xx)) * dirCoef, 
+				                          isGhostNode(templ->invertVectors[i]),
+				                          type));
+			}
+			kkCN << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+			                             select(subVE(dataTVE.values,0), 
+			                                    xx*dataTVE.getValue(0) + (1.-xx)*vLocal/counter, 
+			                                    isComputationNode(0), 
+			                                    type)));
+		}
+		kernelCN->addExpression(acl::elementOperators::
+			                        ifElse(acl::elementOperators::any((isGhostNode() && 
+			                                                           map->getEContainer() > -.9999)[0]),
+			                               kkCN.expression, 
+			                               {} ));
+
+		kernelCN->setup();
+		
+		acl::ExpressionContainer kkGN;
+		initMapInfrastructure(kkGN);
+		
+		kkGN << (vLocal = acl::generateVEConstantN(nc,0.));
+		kkGN << (counter = acl::generateVEConstant(0.));
+		kkGN << (normal = gradient(*mapTVE));
+		kkGN << (gcNormalize(normal));
+		kkGN << (xx = acl::generateVEConstant(0.));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kkGN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+			kkGN << (dirCoef *= dirCoef );			
+			kkGN << (counter+= select(dirCoef, isComputationNode(i), type));
+			kkGN << (xx+= select(dirCoef * exBoundaryX(*mapTVE,i), 
+			                     isComputationNode(i), type));			
+		}
+		kkGN << (xx=select(acl::generateVEConstant(1.),xx/counter,counter>0.001,type));
+		kkGN << (counter = max(counter,acl::generateVEConstant(.001), type));
+
+		for(unsigned int ii(0); ii < nc; ++ii)
+		{
+			dataTVE.init(*dataX, *templ, ii,false);
+			kkGN << (vLocal = acl::generateVEConstant(0.));
+			for(unsigned int i(1); i < nDir; ++i)
+			{
+				kkGN << (dirCoef = (normal * normalize(templ->vectors[i])) + 1.);
+				kkGN << (dirCoef *= dirCoef );
+				auto anv(subVE(beta,ii)*(-normal * templ->vectors[i]));
+				kkGN << (vLocal += select((dataTVE.getValue(i)*(1.-anv*xx) + anv*subVE(cEq,ii)) /
+				                          (1.+ anv*(1.-xx)) * dirCoef, 
+				                          isComputationNode(i),
+				                          type));
+			}
+			kkGN << (acl::assignmentSafe(subVE(data->getEContainer(),ii), 
+			                             select(subVE(dataTVE.values,0), 
+			                                    vLocal/counter, 
+			                                    isGhostNode(0), 
+			                                    type)));
+		}
+		kernelGN->addExpression(acl::elementOperators::
+			                        ifElse(acl::elementOperators::any((isGhostNode() && 
+			                                                           map->getEContainer() > -.9999)[0]),
+			                               kkGN.expression, 
+			                               {} ));
+
+		kernelGN->setup();
+	}
+
+	void BCLinearGrowthMap2::execute()
+	{
+		kernelCN->compute();
+		kernelGN->compute();
+	}
+
+		
+	SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d, 
+	                                   double cEq,
+	                                   double beta,
+	                                   SPAbstractDataWithGhostNodes map,
+	                                   const VectorTemplate *const t)
+	{
+		return make_shared<BCLinearGrowthMap>
+			      (d, 
+			       acl::generateVEConstant(cEq), 
+			       acl::generateVEConstant(beta), 
+			       map, 
+			       t);	
+	}
+
+	SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d, 
+	                                       double cEq,
+	                                       double beta,
+	                                       SPAbstractDataWithGhostNodes map,
+	                                       SPAbstractDataWithGhostNodes computationalDomain,
+	                                       const VectorTemplate *const t)
+	{
+		return make_shared<BCLinearGrowthMap1>
+			      (d, 
+			       acl::generateVEConstant(cEq), 
+			       acl::generateVEConstant(beta), 
+			       map, 
+			       computationalDomain, 
+			       t);	
+	}
+
+	SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d, 
+	                                    double cEq,
+	                                    double beta,
+	                                    SPAbstractDataWithGhostNodes map,
+	                                    const VectorTemplate *const t)
+	{
+		return make_shared<BCLinearGrowthMap2>
+			(d, 
+			 acl::generateVEConstant(cEq), 
+			 acl::generateVEConstant(beta), 
+			 map, 
+			 t);	
+	}
+
+	SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d, 
+	                                    double cEq,
+	                                    double beta,
+	                                    SPAbstractDataWithGhostNodes map,
+	                                    SPAbstractDataWithGhostNodes computationalDomain,
+	                                    const VectorTemplate *const t)
+	{
+		return make_shared<BCLinearGrowthMap2>
+			(d, 
+			 acl::generateVEConstant(cEq), 
+			 acl::generateVEConstant(beta), 
+			 map, 
+			 computationalDomain, 
+			 t);	
+	}
+
+		
+} // asl
+
diff --git a/src/num/aslCrystalGrowthBC.h b/src/num/aslCrystalGrowthBC.h
new file mode 100644
index 0000000..de1bbd8
--- /dev/null
+++ b/src/num/aslCrystalGrowthBC.h
@@ -0,0 +1,204 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLCRYSTALGROWTHBC_H
+#define ASLCRYSTALGROWTHBC_H
+
+#include "aslBCond.h"
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+
+
+namespace acl{
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+}
+
+
+
+namespace asl
+{
+	class PositionFunction;
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+
+	
+	/// Bondary condition that makes gradient	proportional to a surface concentration \ingroup BoundaryConditions		 
+	class BCLinearGrowthMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data  data;
+			acl::VectorOfElements cEq;
+			acl::VectorOfElements beta;
+		public:
+			BCLinearGrowthMap(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  const VectorTemplate *const t);
+			BCLinearGrowthMap(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  Data computationalDomain, 
+			                  const VectorTemplate *const t);
+			~BCLinearGrowthMap();
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition that makes gradient proportional to a surface concentration 
+	/**	
+		 \ingroup BoundaryConditions
+		 The boundary condition corresponds to different system with surface reaction. 
+
+		 Fist system is temperature reliase during the crystal growth process from melt.
+		 There growth velocity defined by the following equation
+		 \f[ \vec v = \vec n \beta (T -T^{eq}) \f]
+		 where \f$ \beta \f$ is a kinetic coefficient and \f$ T^{eq} \f$ is an equilibrium temperature.
+		 This condition can be expressed in terms of flux for puarlly diffusion equation
+		 \f[ \vec j = D \vec \nabla T, \f]
+		 \f[ \vec j = v L, \f]
+		 where \f$ L \f$ is latent heat. These two equation allow to write an expression for temperature
+		 on the boundary as follows:
+		 \f[ \beta^* (T-T^{eq}) = \vec n \cdot \vec \nabla T, \f]
+		 where \f$ \beta^* \equiv \frac{\beta L}{D} \f$ it corresponds to \p ::beta.
+		 In the discrete case the two eequations for flux can not be combines so simply. 
+		 Fist of all let us introduce two help values surface area per ghost node and 
+		 flux per ghost point. There is set of template directions dirrectod towards computational domain 
+		 \f$ \Omega\f$. The flux per ghost point can be expressed as follows 
+		 \f[ j^{gh} = \sum_{i \in \Omega} w_i(T_i - T_0)  \f] 	
+		 It is seen that this equation doen not contains the surface area explicetely.
+		 \f[ j^{gh} = S^{gh} \beta^* (T-T^{eq}) \f]. Note, \f$ T \f$ is temperature on the surface
+		 It can be expressed as alinear combunation of \f$ T_0 \f$ and \f$ T_i \f$ like this:
+		 \f[ T = A T_0 + \sum_{i \in \Omega} B_i T_i \f]
+		 Than the \f$ T_0 \f$ can be computed as follows:
+		 \f[ T_0 = \frac{ \sum_{i\in \Omega} (w_i  - S^{gh}\beta^* B_i ) T_i + S^{gh}\beta^* T^{eq} }
+                        {S^{gh}\beta^* A + \sum_{i\in \Omega} w_i} \f]
+
+		 The coefficients \f$ A \f$ and \f$ B_i \f$ can be chosen as follows. 
+		 \f[ T = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
+		         \sum_{i \in \Omega} (T_0(1-x_i) + T_i x_i) \vec n \cdot\vec a_i
+                       
+		 \f] 				
+		 thus 
+		 \f[ A = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
+		         \sum_{i \in \Omega} (1-x_i) \vec n \cdot\vec a_i
+                       
+		 \f] 				
+		 \f[ B_i = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
+		           x_i \vec n \cdot\vec a_i
+                       
+		 \f] 		
+
+		 \note The function is realized for 1 component only!
+
+*/
+		
+	class BCLinearGrowthMap1:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data  data;
+			acl::VectorOfElements cEq;
+			acl::VectorOfElements beta;
+		public:
+			BCLinearGrowthMap1(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  const VectorTemplate *const t);
+			BCLinearGrowthMap1(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  Data computationalDomain, 
+			                  const VectorTemplate *const t);
+			~BCLinearGrowthMap1();
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition that makes gradient proportional to a surface concentration, second order \ingroup BoundaryConditions		 
+	class BCLinearGrowthMap2:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernelCN;			
+			acl::SPKernel kernelGN;			
+		protected:
+			Data  data;
+			acl::VectorOfElements cEq;
+			acl::VectorOfElements beta;
+		public:
+			BCLinearGrowthMap2(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  const VectorTemplate *const t);
+			BCLinearGrowthMap2(Data d, 
+			                  const acl::VectorOfElements & cEq,
+			                  const acl::VectorOfElements & beta,			                  
+			                  Data map, 
+			                  Data computationalDomain, 
+			                  const VectorTemplate *const t);
+			~BCLinearGrowthMap2();
+			virtual void execute();
+			virtual void init();			
+	};
+
+	
+	
+	SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d, 
+                                       double cEq,
+                                       double beta,
+                                       SPAbstractDataWithGhostNodes map,
+                                       const VectorTemplate *const t);
+	
+	SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d, 
+	                                   double cEq,
+                                       double beta,
+	                                   SPAbstractDataWithGhostNodes map,
+	                                   SPAbstractDataWithGhostNodes computationalDomain,
+	                                   const VectorTemplate *const t);
+
+	SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d, 
+	                                    double cEq,
+	                                    double beta,
+	                                    SPAbstractDataWithGhostNodes map,
+	                                    const VectorTemplate *const t);
+	
+	SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d, 
+	                                    double cEq,
+	                                    double beta,
+	                                    SPAbstractDataWithGhostNodes map,
+	                                    SPAbstractDataWithGhostNodes computationalDomain,
+	                                    const VectorTemplate *const t);
+	
+} //asl
+
+#endif //ASLCRYSTALGROWTHBC_H
diff --git a/src/num/aslDFOptimizer.cxx b/src/num/aslDFOptimizer.cxx
new file mode 100644
index 0000000..9219e80
--- /dev/null
+++ b/src/num/aslDFOptimizer.cxx
@@ -0,0 +1,100 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDFOptimizer.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include "acl/aclHardware.h"
+#include <math/aslTemplateVE.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+#include <math/aslDistanceFunctionAlg.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	DFOptimizer::DFOptimizer():
+//		SingleKernelNM(acl::KERNEL_SIMDUA),
+		SingleKernelNM(acl::KERNEL_BASIC),
+		vectorTemplate(NULL)
+	{
+	}
+
+
+	DFOptimizer::DFOptimizer(Data inD, const VectorTemplate* vT):
+//		SingleKernelNM(acl::KERNEL_SIMDUA),
+		SingleKernelNM(acl::KERNEL_BASIC),
+		inData(inD),
+		vectorTemplate(vT)
+	{
+	}
+		
+	void DFOptimizer::init0()
+	{
+		unsigned int nDir(vectorTemplate->vectors.size());
+		acl::TypeID type(getElementType(inData->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto dataX(generateDCFullSafe(inData, -.9));
+		
+		acl::VectorOfElements vnew(acl::generateVEPrivateVariable(1, type));
+		acl::VectorOfElements isAnyComp(acl::generateVEPrivateVariable(1, typeI));
+		acl::VectorOfElements isAnyGhost(acl::generateVEPrivateVariable(1, typeI));
+		
+		TemplateVE dT;
+		dT.init(*dataX, *vectorTemplate);
+		(*kernel) << dT.initValues;
+		(*kernel) << (isAnyComp = acl::generateVEConstant(0));
+		(*kernel) << (isAnyGhost = acl::generateVEConstant(0));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			(*kernel) << (isAnyComp = isAnyComp || isComputationNode(dT, i));
+			(*kernel) << (isAnyGhost = isAnyGhost || isGhostNode(dT, i));
+		}
+		(*kernel) << (vnew = dT.getValue(0));
+		(*kernel) << (vnew = select(vnew, acl::generateVEConstant(-0.9998), 
+		                            (dT.getValue(0)<=-0.9999) && isAnyComp, type));
+		(*kernel) << (vnew = select(vnew, acl::generateVEConstant(0.9998), 
+		                            dT.getValue(0)>=0.9999 && isAnyGhost, type));
+		(*kernel) << (vnew = select(vnew, acl::generateVEConstant(-1), 
+		                            (dT.getValue(0)<0 && dT.getValue(0)>-0.9999) && !isAnyComp,type));
+		(*kernel) << (vnew = select(vnew, acl::generateVEConstant(1), 
+		                            (dT.getValue(0)>0 && dT.getValue(0)<0.9999) && !isAnyGhost,type));
+		
+		(*kernel) << (assignmentSafe(inData->getEContainer(), vnew));		
+	}
+			
+	void optimizeMap(SPDataWithGhostNodesACLData c, const VectorTemplate* vt)
+	{
+		auto nm(make_shared<DFOptimizer> (c, vt));
+		nm->init();
+		nm->execute();
+	}
+		
+		
+} //asl
diff --git a/src/num/aslDFOptimizer.h b/src/num/aslDFOptimizer.h
new file mode 100644
index 0000000..ece5189
--- /dev/null
+++ b/src/num/aslDFOptimizer.h
@@ -0,0 +1,86 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDFOPTIMIZER_H
+#define ASLDFOPTIMIZER_H
+
+#include "aslSingleKernelNM.h"
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which makes changes in the input map and produces map suitbale and optimal for use in BC
+	/**
+		 \ingroup LevelSet
+		 \ingroup NumMethods
+	 
+	*/
+	class DFOptimizer: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+		private:	
+			Data inData;
+
+			const VectorTemplate* vectorTemplate;
+
+			virtual void init0();
+		public:			
+			DFOptimizer();
+			DFOptimizer(Data inD, const VectorTemplate* vT);
+			void setVectorTemplate(VectorTemplate* vT);
+			inline const VectorTemplate* getVectorTemplate() const;
+			inline Data & getInData();
+	};
+
+	typedef std::shared_ptr<DFOptimizer> SPDFOptimizer;
+
+	void optimizeMap(SPDataWithGhostNodesACLData c, const VectorTemplate* vt);
+	
+// ------------------------- Implementation ------------------------
+	
+	inline DFOptimizer::Data & DFOptimizer::getInData()
+	{
+		return inData;
+	}
+	
+	inline const VectorTemplate* DFOptimizer::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION_H
diff --git a/src/num/aslDataResampling.cxx b/src/num/aslDataResampling.cxx
new file mode 100644
index 0000000..1a5064d
--- /dev/null
+++ b/src/num/aslDataResampling.cxx
@@ -0,0 +1,145 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslDataResampling.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <math/aslTemplateVE.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+#include <math/aslIndex2Position.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+
+	Block generateCoarsedBlock(const Block & b)
+	{
+		unsigned int n(nD(b));
+		AVec<int> s(b.getSize()/2-Block::DV(n,1));
+		double dx(b.dx*2);
+		AVec<> pos(b.position+Block::V(n,.75*dx));
+		return {s,dx,pos};
+	}
+	
+	DataCoarser::DataCoarser():
+		SingleKernelNM(acl::KERNEL_BASIC),
+		dataIn(0),
+		dataOut(0),
+		vectorTemplate(NULL)		
+	{
+	}
+
+
+	DataCoarser::DataCoarser(Data dIn):
+		SingleKernelNM(acl::KERNEL_BASIC),
+		dataIn(dIn),
+		dataOut(0),
+		vectorTemplate(elementaryCellVT(nD(dIn->getBlock())))
+	{
+	}
+
+		
+	
+	void DataCoarser::init0()
+	{
+		
+		acl::TypeID type(getElementType(dataIn->getDContainer()));
+		unsigned int gN(dataIn->getGhostBorder());		
+		Block bOut(generateCoarsedBlock(dataIn->getInternalBlock()));
+		acl::VectorOfElementsData veIn(dataIn->getDContainer());
+		unsigned int nc(veIn.size());
+		
+		dataOut=generateDataContainerACL_SP(bOut,type,nc,gN);
+		acl::VectorOfElementsData veOut(dataOut->getDContainer());
+
+		acl::VectorOfElements v(acl::generateVEPrivateVariable(nc, type));
+
+		auto dataIn0(resizeGhostNodes(dataIn,0)); 
+			
+		TemplateVE tVE(*dataIn0, *vectorTemplate);
+
+		Index2PositionDiscreteACL t2p(dataOut->getBlock());
+		(*kernel) << t2p.initPosition;
+		acl::VectorOfElements fineIndex(t2p.position * 2 *
+		                                dataIn0->getBlock().c2iTransformVector);
+		
+		(*kernel) << (acl::excerpt(tVE.initValues,
+		                           fineIndex));
+		/// \todoZeev add support for unsigned long type in Hardware
+		/// and then remove (cl_uint) casting
+		(*kernel) << (veOut = acl::sumOfElements(tVE.values)/(cl_uint)tVE.values.size());	
+	}
+
+
+	Block generateClippedBlock(const Block & b, 
+	                           const AVec<int> & a0, 
+	                           const AVec<int> & aE)
+	{
+		unsigned int nd(nD(a0));
+		return {aE-a0+AVec<int>(nd,1), b.dx, b.position+b.dx*Block::V(a0)};
+	}
+	
+	DataClipper::DataClipper():
+		SingleKernelNM(acl::KERNEL_BASIC),
+		dataIn(0),
+		dataOut(0)		
+	{
+	}
+
+
+	DataClipper::DataClipper(Data dIn, AVec<int> a0, AVec<int> aE):
+		SingleKernelNM(acl::KERNEL_BASIC),
+		dataIn(dIn),
+		dataOut(0),
+		a0(a0),
+		aE(aE)
+	{
+	}
+	
+	void DataClipper::init0()
+	{
+		acl::TypeID type(getElementType(dataIn->getDContainer()));
+		unsigned int gN(dataIn->getGhostBorder());		
+		Block bOut(generateClippedBlock(dataIn->getInternalBlock(), a0, aE));
+		acl::VectorOfElementsData veIn(dataIn->getDContainer());
+		unsigned int nc(veIn.size());
+		
+		dataOut=generateDataContainerACL_SP(bOut,type,nc,gN);
+		acl::VectorOfElementsData veOut(dataOut->getDContainer());
+			
+		Index2PositionDiscreteACL t2p(dataOut->getBlock());
+		(*kernel) << t2p.initPosition;
+		acl::VectorOfElements index((t2p.position + a0)*
+		                            dataIn->getBlock().c2iTransformVector);
+		
+		(*kernel) << (veOut = acl::excerpt(veIn, index));	
+	}
+		
+		
+} //asl
diff --git a/src/num/aslDataResampling.h b/src/num/aslDataResampling.h
new file mode 100644
index 0000000..26db884
--- /dev/null
+++ b/src/num/aslDataResampling.h
@@ -0,0 +1,137 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLDATARESAMPLING_H
+#define ASLDATARESAMPLING_H
+
+#include "aslSingleKernelNM.h"
+#include "math/aslVectors.h"
+#include <CL/cl.hpp>
+
+namespace acl
+{
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Algorithm for generation of coarsed dataset
+	/**
+		 \ingroup NumMethods		 
+		 
+		 \todo make and test
+	*/
+	class DataCoarser: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			
+		private:	
+			Data dataIn;
+			Data dataOut;
+			const VectorTemplate* vectorTemplate;
+	
+			virtual void init0();
+		public:			
+			DataCoarser();
+			DataCoarser(Data dIn);
+			inline Data getDataOut();
+	};
+
+	typedef std::shared_ptr<DataCoarser> SPDataCoarser;
+
+	/// \ingroup DataUtilities
+	SPDataWithGhostNodesACLData coarseData(SPDataWithGhostNodesACLData d);
+
+	/// Algorithm for generation of coarsed dataset
+	/**
+		 \ingroup NumMethods		 
+		 
+		 \todo make and test
+	*/
+	class DataClipper: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			
+		private:	
+			Data dataIn;
+			Data dataOut;
+			AVec<int> a0;
+			AVec<int> aE;
+	
+			virtual void init0();
+		public:			
+			DataClipper();
+			DataClipper(Data dIn, AVec<int> a0, AVec<int> aE);
+			inline Data getDataOut();
+	};
+	
+	typedef std::shared_ptr<DataClipper> SPDataClipper;
+
+	/// \ingroup DataUtilities
+	inline SPDataWithGhostNodesACLData clipData(SPDataWithGhostNodesACLData d,
+	                                             AVec<int> a0, 
+	                                             AVec<int> aE);
+
+//----------------------------- Implementation -----------------------
+
+	DataCoarser::Data DataCoarser::getDataOut()
+	{
+		return dataOut;
+	}
+
+	DataClipper::Data DataClipper::getDataOut()
+	{
+		return dataOut;
+	}
+
+	inline SPDataWithGhostNodesACLData coarseData(SPDataWithGhostNodesACLData d)
+	{
+		DataCoarser dc(d);
+		dc.init();
+		dc.execute();
+		return dc.getDataOut();
+		
+	}
+
+	inline SPDataWithGhostNodesACLData clipData(SPDataWithGhostNodesACLData d,
+	                                     AVec<int> a0, 
+	                                     AVec<int> aE)
+	{
+		asl::DataClipper dcl(d, a0,aE);
+		dcl.init();
+		dcl.execute();
+		return dcl.getDataOut();
+	}
+
+	
+} // asl
+#endif // ASLDATARESAMPLING_H
diff --git a/src/num/aslElasticity.dox b/src/num/aslElasticity.dox
new file mode 100644
index 0000000..eb6cc80
--- /dev/null
+++ b/src/num/aslElasticity.dox
@@ -0,0 +1,146 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+ \defgroup Elasticity Elasticity
+ \ingroup Physics
+
+\section Theory Theory
+
+Equation of motion:\anchor eq_mothion
+\f[
+\rho\ddot u_j =\nabla_i \sigma_{ij}, 
+\f]
+
+where \f$ \vec u \f$ is the displacement vector, \f$ \sigma_{i,j} \f$ is the Cauchy stress 
+tensor. The strain-displacement equation is:
+\f[
+\varepsilon_{ij}=\frac{1}{2}\left( \nabla_i u_j + \nabla_j u_i \right)
+\f]
+strain tensor is related to the stress tensor by the following equation:\anchor eq_strain_stress
+\f[
+\sigma_{ij}=C_{ijkl}\varepsilon_{kl},
+\f]
+where \f$ C_{ijkl} \f$ is the stiffness tensor which has the following properties:
+\f[
+C_{ijkl}=C_{klij}=C_{jikl}=C_{ijlk}
+\f]
+
+There are several different tensors used in the elasticity theory:
+- Deformation gradient tensor 
+\f[ 
+F_{ij} = \nabla_j u_i + \delta_{ij}
+\f]
+- Finite strain tensor 
+\f[ 
+E_{ij}=\frac{1}{2}\left( \nabla_i u_j + \nabla_j u_i + \nabla_i u_k \nabla_j u_k \right)
+\f]
+- Right Cauchy-Green deformation tensor
+\f[ 
+C_{ij}= F_{ki}F_{kj}= \left( \nabla_i u_j + \nabla_j u_i + \nabla_i u_k \nabla_j u_k + \delta_{ij} \right)	
+\f]
+
+
+\subsection IsotropicHomogenious Isotropic and homogeneous media
+
+In the case of isotropic homogeneous media the stiffness tensor is defined by 
+two modules: \f$ K \f$  is the bulk modulus (or incompressibility) and \f$ \mu \f$ is the 
+shear modulus (or rigidity). The corresponding expression is:
+\f[
+C_{ijkl}=K \delta_{ij}\delta_{kl}+\mu\left(\delta_{ik}\delta_{jl}+
+				      \delta_{il}\delta_{jk}-
+				      \frac{2}{3}\delta_{ij}\delta_{kl}\right)
+\f]
+\ref eq_strain_stress "Stress-strain relation" can be rewritten as follows:\anchor eq_strain_stress_isotrop
+\f[
+\sigma_{ij}=\lambda\delta_{ij}\varepsilon_{kk}+2\mu\varepsilon_{ij},
+\f]
+where \f$ \lambda\equiv K-2/3\mu \f$ is Lam\'e's first parameter.
+
+The media can be parametrized by \f$ v_p \f$ and \f$ v_s \f$ velocities:
+\f[
+v_p=\sqrt{(\lambda+2\mu)/\rho},\;\; v_s=\sqrt{\mu/\rho}.
+\f]
+
+
+\ref eq_mothion "Equation of motion" can be simplified for an isotropic case: \anchor eq_mothion_isot
+\f[
+\rho\ddot u_j =\nabla_j \lambda \nabla_k u_k+ \nabla_k \mu \nabla_k u_j+ 
+					      \nabla_k \mu \nabla_j u_k, 
+\f]
+
+In a homogeneous case it takes: \anchor eq_mothion_isot_hom
+\f[
+\rho\ddot u_j =(\lambda+\mu)\nabla_j  \nabla_k u_k+ \mu \Delta u_j
+\f]
+This equation is solved by following classes:
+asl::FDElasticity, asl::FDElasticity2
+
+
+The potential energy density is:
+\f[
+U=\frac{1}{2}\sigma_{ij}\varepsilon_{ij}
+\f]
+
+\subsection BoundarConditions Boundary Conditions
+
+Free surface BC with surface orientations \f$ \vec n \f$ is:
+\f[
+\sigma_{ij} n_j = F_i
+\f]
+For the isotropic and inhomogeneous case substitution of the \ref eq_strain_stress_isotrop "strain-stress relation"
+results:
+\f[
+\lambda n_i\nabla_k u_k+\mu n_j \left( \nabla_i u_j + \nabla_j u_i \right) = F_i,
+ \f]
+
+\subsection Units Units
+
+\f[[\rho]=kg/m^3 \f]
+\f[[\sigma_{ij}]=\frac{kg}{ms^2}=Pa\f]
+\f[[\mu]=[K]=[\lambda]=Pa\f]
+\f[\left[\frac{\mu}{\rho}\right]=
+  \left[\frac{K}{\rho}\right]=
+  \left[\frac{\lambda}{\rho}\right]=\frac{m^2}{s^2}\f]
+
+*/
+
+/**
+ \class asl::FDElasticityIncompressibleStatic
+
+	\f[ \rho\ddot u_j =(K+\mu/3)\nabla_j  \nabla_k u_k+ \mu \Delta u_j \f]
+	where 
+	- \f$K\f$ is the bulk modulus, 
+	- \f$\mu\f$ is the shear modulus, 
+	- \f$\vec u\f$ is a displacement vector field
+
+	This implementation is aided to improve stability for incompressible materials.
+	Let us reformulate the elasticity equation by the following way:
+	\f[ \rho\ddot u_j =\mu (\Delta u_j - \nabla_j p),  \f]
+	\f[ p = -\frac{K+\mu/3}{\mu} \nabla_k u_k. \f]
+	The second equation leads to an instability for low values of the Poisson ration (for nearly incompressible materials).
+	Therefore the last equation we would like to replace by a relaxation one:
+	\f[ \dot p = - w\left( \frac{K+\mu/3}{\mu} \nabla_k u_k + p\right), \f]
+	where \f$ w \f$ is a relaxation parameter.
+*/
+
diff --git a/src/num/aslFDAdvectionDiffusion.cxx b/src/num/aslFDAdvectionDiffusion.cxx
new file mode 100644
index 0000000..19b1138
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusion.cxx
@@ -0,0 +1,229 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDAdvectionDiffusion.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <math/aslTemplateVE.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDAdvectionDiffusion::FDAdvectionDiffusion():
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData(0),
+		cInternalData(0),
+		electricField(false),
+		efChargeAnd(0),
+		compressibilityCorrectionFlag(false),
+		vectorTemplate(NULL)
+	{
+	}
+
+
+	FDAdvectionDiffusion::FDAdvectionDiffusion(Data c, 
+	                                           const acl::VectorOfElements & dC, 
+	                                           const VectorTemplate* vT):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData(1u, c),
+		cInternalData(0u),
+		electricField(false),		
+		efChargeAnd(0u),
+		compressibilityCorrectionFlag(false),
+		vectorTemplate(vT),
+		diffusionCoefficient(1u, dC)
+	{
+	}
+
+		
+	void FDAdvectionDiffusion::setElectricFieldParameters(Field phi, Field f1, Field f2, Field qAnd)
+	{
+		electricField = true;
+		efPhi = phi;
+		efFactor1 = f1;
+		efFactor2 = f2;
+		efChargeAnd.resize(1);
+		efChargeAnd[0] = qAnd;
+	}
+
+		
+	void FDAdvectionDiffusion::init0()
+	{
+		if (electricField)
+		{
+			if (cData.size() != diffusionCoefficient.size() || cData.size() != efChargeAnd.size())
+				errorMessage("FDAdvectionDiffusion::init - some of compenents are underdefined");
+		}
+		else
+		{
+			if (cData.size() != diffusionCoefficient.size())
+				errorMessage("FDAdvectionDiffusion::init - some of compenents are underdefined");
+		}
+
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cInternalData[i] = clone(cData[i]);
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(1, type)); 
+		std::unique_ptr<TemplateVE> f1;
+		std::unique_ptr<TemplateVE> f2;
+		std::unique_ptr<TemplateVE> phi;
+
+
+		if (electricField)
+		{
+			f1.reset(new TemplateVE(*efFactor1, *vectorTemplate));
+			f2.reset(new TemplateVE(*efFactor2, *vectorTemplate));				
+			phi.reset(new TemplateVE(*efPhi, *vectorTemplate));				
+			(*kernel) << f1->initValues;
+			(*kernel) << f2->initValues;
+			(*kernel) << phi->initValues;
+		}
+
+		unsigned int nd(nD(*vectorTemplate));
+
+		vector<TemplateVE> velocityT(nd);
+		if(velocity.get() != 0)
+			for(unsigned int i(0); i < nd; ++i)
+			{
+				velocityT[i].init(*velocity, *vectorTemplate, i);
+				*(kernel) << velocityT[i].initValues;
+			}
+		
+		TemplateVE cT;
+		for (unsigned int i(0); i < cData.size(); ++i)
+		{
+			cT.init(*cData[i], *vectorTemplate);
+			(*kernel) << cT.initValues;
+			(*kernel) << (cnew = 
+			              diffusionCoefficient[i] * laplas(cT) + 
+			              cT.getValue(0));
+			if(velocity.get() != 0)
+			{
+				(*kernel) << (cnew -= divProduct(velocityT, cT));
+				if(compressibilityCorrectionFlag)
+				{
+					(*kernel) << (cnew /= (1. - div(velocityT)));
+					// improovment of stability
+					if(nd == 3)
+					{
+						auto vl(acl::cat(subVE(velocityT[0].values,0), 
+						                 subVE(velocityT[1].values,0), 
+						                 subVE(velocityT[2].values,0)));
+						(*kernel) << (cnew += laplas(cT) * (vl*vl)*.5);
+					}
+				}
+			}
+//			if(distributionFunction.get() != 0)
+//			{
+//			}
+			if (electricField)
+			{
+				TemplateVE q(*efChargeAnd[i], *vectorTemplate);
+				(*kernel) << q.initValues;
+				(*kernel) << (cnew -= divAgradB(cT*q/(*f1), (*phi)/*+(*f2)*/)); 
+			}
+			(*kernel) << (assignmentSafe(cInternalData[i]->getSubContainer(), cnew));
+		}		
+	}
+
+		
+	void FDAdvectionDiffusion::postProcessing()
+	{
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(), cInternalData[i]->getDContainer());
+	}
+		
+
+	void FDAdvectionDiffusion::setDiffusionCoefficient(acl::VectorOfElements dC, 
+	                                                   unsigned int i)
+	{
+		copy(dC,diffusionCoefficient[i]);
+	}
+
+		
+	void FDAdvectionDiffusion::addComponent(Data c, acl::VectorOfElements & dC)
+	{
+		if (electricField)
+			errorMessage("FDAdvectionDiffusion::addComponent: \"Electric field\" is swiched on \n therefore \"qAnd\" value should be specified");
+		unsigned int n(diffusionCoefficient.size());
+		diffusionCoefficient.resize(n+1);
+		setDiffusionCoefficient(dC,n);
+		
+		cData.push_back(c);
+	}
+
+		
+	void FDAdvectionDiffusion::addComponent(Data c, 
+	                                        acl::VectorOfElements & dC,
+	                                        Field qAnd)
+	{
+		unsigned int n(diffusionCoefficient.size());
+		diffusionCoefficient.resize(n+1);
+		setDiffusionCoefficient(dC,n);
+		cData.push_back(c);
+		efChargeAnd.push_back(qAnd);
+	}
+
+	void FDAdvectionDiffusion::setVelocity(Field v, bool cCF)
+	{
+		velocity=v;
+		compressibilityCorrectionFlag=cCF;
+	}
+
+	void FDAdvectionDiffusion::setDistributionFunction(Field f)
+	{
+		if(f->getEContainer().size() != vectorTemplate->vectors.size())
+			errorMessage("FDAdvectionDiffusion::setDistributionFunction: the distrubution function has wrong number of components");
+		distributionFunction=f;
+	}
+
+		SPFDAdvectionDiffusion generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c,
+		                                                    double diffusionCoeff,            
+		                                                    SPAbstractDataWithGhostNodes v, 
+		                                                    const VectorTemplate* vt, 
+		                                                    bool compressibilityCorrection)
+	{
+		auto nm(make_shared<FDAdvectionDiffusion> (c, acl::generateVEConstant(diffusionCoeff), vt));
+		nm->setVelocity(v,compressibilityCorrection);
+		return nm;
+	}
+
+		SPFDAdvectionDiffusion generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c,
+		                                                    double diffusionCoeff, 
+		                                                    const VectorTemplate* vt)
+	{
+		auto nm(make_shared<FDAdvectionDiffusion> (c, acl::generateVEConstant(diffusionCoeff), vt));
+		return nm;
+	}
+		
+		
+} //asl
diff --git a/src/num/aslFDAdvectionDiffusion.h b/src/num/aslFDAdvectionDiffusion.h
new file mode 100644
index 0000000..55bdff8
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusion.h
@@ -0,0 +1,173 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDADVECTIONDIFFUSION_H
+#define ASLFDADVECTIONDIFFUSION_H
+
+#include "aslSingleKernelNM.h"
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multicomponent transport processes
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D_i \Delta c_i - \nabla (\vec v c_i)
+		    					-\nabla\left(\frac{c_i q}{k} \nabla(\phi+f_2)  \right)\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D_i\f$
+		 \param efFactor1 corresponds to \f$k\f$
+		 \param efFactor2 corresponds to \f$f_2\f$
+		 \param efPhi corresponds to \f$\phi\f$
+		 \param efChargeAnd corresponds to \f$q\f$	 
+		 \param velocity corresponds to \f$\vec v\f$	 
+	*/
+	class FDAdvectionDiffusion: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+			
+		private:	
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+
+			bool electricField;
+			Field efPhi;
+			Field efFactor1;
+			Field efFactor2;
+			std::vector<Field> efChargeAnd;
+
+			Field velocity;
+			/// advection process described by distribution function instead of velocity field
+			Field distributionFunction;
+			bool compressibilityCorrectionFlag;
+
+			const VectorTemplate* vectorTemplate;
+
+			int t;
+			std::vector<acl::VectorOfElements> diffusionCoefficient;
+
+			virtual void init0();
+			virtual void postProcessing();
+		public:			
+			FDAdvectionDiffusion();
+			FDAdvectionDiffusion(Data c, 
+			                     const acl::VectorOfElements & dC, 
+			                     const VectorTemplate* vT);
+			void setDiffusionCoefficient(acl::VectorOfElements d, 
+			                             unsigned int i = 0);
+			inline const acl::VectorOfElements & getDiffusionCoefficient(unsigned int i=0) const;
+			void setVectorTemplate(VectorTemplate* vT);
+			inline const VectorTemplate* getVectorTemplate() const;
+			void setElectricFieldParameters(Field phi,
+			                                Field f1,
+			                                Field f2,
+			                                Field qAnd);
+			void setVelocity(Field v, bool compressibilityCorrection=false);
+			void setDistributionFunction(Field f);
+			
+			inline Field getVelocity();
+			inline Field getDistributionFunction();
+			inline std::vector<Data> & getData();
+			void addComponent(Data c, acl::VectorOfElements & dC);
+			void addComponent(Data c, acl::VectorOfElements & dC, Field qAnd);			
+			
+	};
+
+	typedef std::shared_ptr<FDAdvectionDiffusion> SPFDAdvectionDiffusion;
+
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D_i \Delta c_i - \nabla (\vec v c_i)\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D_i\f$
+		 \param velocity corresponds to \f$\vec v\f$	 
+	*/
+	SPFDAdvectionDiffusion generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c, 
+	                                                  double diffustionCoeff,
+	                                                  SPAbstractDataWithGhostNodes v, 
+	                                                  const VectorTemplate* vt,
+	                                                  bool compressibilityCorrection = false);
+	
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D_i \Delta c_i \f]
+		 where
+		 \param cData corresponds to \f$ c_i \f$
+		 \param diffusionCoefficient corresponds to \f$ D_i \f$
+	*/
+	SPFDAdvectionDiffusion generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c, 
+	                                                    double diffustionCoeff,
+	                                                    const VectorTemplate* vt);
+	
+// ------------------------- Implementation ------------------------
+
+	inline FDAdvectionDiffusion::Field FDAdvectionDiffusion::getVelocity()
+	{
+		return velocity;
+	}
+
+	inline FDAdvectionDiffusion::Field FDAdvectionDiffusion::getDistributionFunction()
+	{
+		return distributionFunction;
+	}
+	
+	inline std::vector<FDAdvectionDiffusion::Data> & FDAdvectionDiffusion::getData()
+	{
+		return cData;
+	}
+	
+	inline const VectorTemplate* FDAdvectionDiffusion::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+
+	inline const acl::VectorOfElements & 
+		FDAdvectionDiffusion::getDiffusionCoefficient(unsigned int i) const
+	{
+		return diffusionCoefficient[i];
+	}
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION_H
diff --git a/src/num/aslFDAdvectionDiffusion2.cxx b/src/num/aslFDAdvectionDiffusion2.cxx
new file mode 100644
index 0000000..7df9909
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusion2.cxx
@@ -0,0 +1,146 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDAdvectionDiffusion2.h"
+#include "aslGenerators.h"
+#include <acl/aclGenerators.h>
+#include "acl/acl.h"
+#include "math/aslTemplateVE.h"
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDAdvectionDiffusion2::FDAdvectionDiffusion2():
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(0),
+		cInternalData(0),
+		electricField(false),
+		efChargeAnd(0),
+		vectorTemplate(NULL),		
+		diffusionCoefficient(0)
+	{
+	}
+
+	FDAdvectionDiffusion2::FDAdvectionDiffusion2(Data c, double dC, const VectorTemplate* vT):
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(1u,c),
+		cInternalData(0u),
+		electricField(false),		
+		efChargeAnd(0u),
+		vectorTemplate(vT),
+		diffusionCoefficient(1u,dC)
+	{
+	}
+
+
+	void FDAdvectionDiffusion2::setElectricFieldParameters(ScalarField phi, ScalarField f1, ScalarField f2, ScalarField qAnd)
+	{
+		electricField=true;
+		efPhi=phi;
+		efFactor1=f1;
+		efFactor2=f2;
+		efChargeAnd.resize(1);
+		efChargeAnd[0] =qAnd;
+	}
+	
+	void FDAdvectionDiffusion2::init(){
+		if (electricField)
+		{
+			if (cData.size() != diffusionCoefficient.size() || cData.size() != efChargeAnd.size())
+				errorMessage("FDAdvectionDiffusion2::init: some of compenents are underdefined");
+		}
+		else
+		{
+			if (cData.size() != diffusionCoefficient.size())
+				errorMessage("FDAdvectionDiffusion2::init: some of compenents are underdefined");
+		}
+
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cInternalData[i] =clone(cData[i]);
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(1,type)); 
+		std::unique_ptr<TemplateVE> f1;
+		std::unique_ptr<TemplateVE> f2;
+		std::unique_ptr<TemplateVE> phi;
+		if (electricField)
+		{
+			f1.reset(new TemplateVE(*efFactor1,d2q5()));
+			f2.reset(new TemplateVE(*efFactor2,d2q5()));				
+			phi.reset(new TemplateVE(*efPhi,d2q5()));				
+			(*kernel)<<f1->initValues;
+			(*kernel)<<f2->initValues;
+			(*kernel)<<phi->initValues;
+		}
+		
+		TemplateVE cT;
+		for (unsigned int i(0); i < cData.size(); ++i){
+			cT.init(*cData[i],d2q5());
+			(*kernel)<<cT.initValues;
+			(*kernel)<<(cnew=
+						acl::generateVEVariableR(diffusionCoefficient[i])*laplas(cT));
+			if (electricField)
+			{
+				TemplateVE q(*efChargeAnd[i],d2q5());
+				(*kernel)<<q.initValues;
+				(*kernel)<<(cnew-=divAgradB(cT*q/(*f1),(*phi)/*+(*f2)*/)); 
+			}
+			(*kernel)<<(assignmentSafe (cInternalData[i]->getSubContainer(),cInternalData[i]->getSubContainer()+acl::generateVEConstant(2.)*cnew));
+		}		
+		kernel->setup();
+	}
+
+
+	void FDAdvectionDiffusion2::execute()
+	{
+		kernel->compute();
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(),cInternalData[i]->getDContainer());
+	}
+
+
+	void FDAdvectionDiffusion2::setDiffusionCoefficient (double dC, unsigned int i)
+	{
+		diffusionCoefficient[i] =dC;
+	}
+	
+	void FDAdvectionDiffusion2::addComponent (Data c, double dC)
+	{
+		if (electricField)
+			errorMessage("FDAdvectionDiffusion2::addComponent: \"Electric field\" is swiched on \n therefore \"qAnd\" value should be specified");
+		diffusionCoefficient.push_back (dC);
+		cData.push_back (c);
+	}
+	void FDAdvectionDiffusion2::addComponent (Data c, double dC,ScalarField qAnd)
+	{
+		diffusionCoefficient.push_back (dC);
+		cData.push_back (c);
+		efChargeAnd.push_back (qAnd);
+	}
+} //asl
diff --git a/src/num/aslFDAdvectionDiffusion2.h b/src/num/aslFDAdvectionDiffusion2.h
new file mode 100644
index 0000000..f415711
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusion2.h
@@ -0,0 +1,109 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDADVECTIONDIFFUSION2_H
+#define ASLFDADVECTIONDIFFUSION2_H
+
+#include "aslNumMethod.h"
+
+/**
+ \defgroup TransportProcesses Transport Processes
+ \ingroup Physics
+ */
+
+/**
+ \defgroup NumMethods NumericalMethods
+ \ingroup Numerics
+ */
+
+
+namespace acl{
+	class Kernel;
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multicomponent transport processes; \f$O^2(dt)\f$
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D_i \Delta c_i 
+		    					-\nabla\left(\frac{c_i q}{k} \nabla(\phi+f_2)  \right)\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D_i\f$
+		 \param efFactor1 corresponds to \f$k\f$
+		 \param efFactor2 corresponds to \f$f_2\f$
+		 \param efPhi corresponds to \f$\phi\f$
+		 \param efChargeAnd corresponds to \f$q\f$	 
+	*/
+	class FDAdvectionDiffusion2: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes ScalarField;
+		private:
+			std::unique_ptr<acl::Kernel> kernel; 
+			
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+
+			bool electricField;
+			ScalarField efPhi;
+			ScalarField efFactor1;
+			ScalarField efFactor2;
+			std::vector<ScalarField> efChargeAnd;
+				
+			const VectorTemplate* vectorTemplate;
+
+			int t;
+			std::vector<double> diffusionCoefficient;
+		public:			
+			FDAdvectionDiffusion2();
+			FDAdvectionDiffusion2(Data c, double dC, const VectorTemplate* vT);
+			void setDiffusionCoefficient(double d, unsigned int i=0);
+			double getDiffusionCoefficient(unsigned int i=0);
+			void setVectorTemplate(VectorTemplate* vT);
+			VectorTemplate setVectorTemplate(const VectorTemplate* vT);
+			void setElectricFieldParameters(ScalarField phi, ScalarField f1, ScalarField f2, ScalarField qAnd);
+			virtual void init();
+			virtual void execute();
+			void addComponent(Data c, double dC);
+			void addComponent(Data c, double dC, ScalarField qAnd);			
+			
+	};
+
+	typedef std::shared_ptr<FDAdvectionDiffusion2> SPFDAdvectionDiffusion2;
+
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION2_H
diff --git a/src/num/aslFDAdvectionDiffusionBC.cxx b/src/num/aslFDAdvectionDiffusionBC.cxx
new file mode 100644
index 0000000..aa4729e
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusionBC.cxx
@@ -0,0 +1,142 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDAdvectionDiffusionBC.h"
+#include "aslFDAdvectionDiffusion.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <acl/aclHardware.h>
+#include <math/aslTemplateVE.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+#include <math/aslDistanceFunctionAlg.h>
+
+namespace asl
+{
+
+	BCConstantFluxMap::BCConstantFluxMap(Data d,
+	                                     const acl::VectorOfElements & val, 
+	                                     Data map,
+	                                     const VectorTemplate *const t):
+		BCondWithMap(map, t),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		data(d),
+		value(val)
+	{
+	}
+
+	BCConstantFluxMap::~BCConstantFluxMap()
+	{
+	}
+
+
+	void BCConstantFluxMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		unsigned int nd(nD(data->getBlock())); //< number of dimmentions
+		unsigned int nc(data->getEContainer().size()); // number of components 
+		
+		auto dataX(generateDCFullSafe(data));
+		
+		initMapInfrastructure(kk);
+					
+		acl::TypeID type(getElementType(data->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		TemplateVE dataTVE(*dataX, *templ);
+		kk << dataTVE.initValues;
+		
+		auto normal(generateVEPrivateVariable(nd,type));		
+		auto area(generateVEPrivateVariable(1,type));		
+		auto sw(generateVEPrivateVariable(1,type));
+		auto swc(generateVEPrivateVariable(1,type));
+		auto sna(generateVEPrivateVariable(1,type));		
+		auto sna1mx(generateVEPrivateVariable(1,type));		
+		auto snaxc(generateVEPrivateVariable(nc,type));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+		
+		unsigned int nDir(templ->vectors.size());
+		
+		kk << (sw = acl::generateVEConstant(0.));
+		kk << (swc = acl::generateVEConstant(0.));
+		kk << (gcNormalize(normal));
+//		kk << gcBoundaryAreaPerGhostPoint(*mapTVE, area);
+
+//		TemplateVE mSTVE(mapTVE->values*.5+catN(mapTVE->getValue(0),nDir)*.5 ,
+//		                 *mapTVE->vectorTemplate);
+//		kk << gcBoundaryArea(mSTVE, area); 
+		kk << gcBoundaryArea(*mapTVE, area); 
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i));
+			kk << (sw += select(acl::generateVEConstant(templ->laplasCoefs[i]), 
+			                    isBoundary,type));
+			kk << (swc += select(dataTVE.getValue(i) * templ->laplasCoefs[i], 
+			                    isBoundary,type));
+		}
+		auto vLocal((swc+sw*value)/sw);
+//		auto vLocal((swc+area*value)/sw);
+//		auto vLocal(area*.25);
+//		kk << (acl::assignmentSafe(data->getEContainer(), vLocal));
+		kk << (acl::assignmentSafe(data->getEContainer(), 
+		                           select(dataTVE.getValue(0), vLocal, isGhostNode(0), type)));
+//		
+/*		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((isGhostNode() && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+*/  
+		(*kernel)<<kk;
+		kernel->setup();
+	}
+
+	void BCConstantFluxMap::execute()
+	{
+		kernel->compute();
+	}
+
+
+		
+		
+	SPNumMethod generateBCConstantFlux(SPFDAdvectionDiffusion nm, 
+	                                   double flux,
+	                                   SPAbstractDataWithGhostNodes map)
+	{
+		auto a(make_shared<BCConstantFluxMap>(nm->getData()[0], 
+		                                      flux/nm->getDiffusionCoefficient(),
+		                                      map,
+		                                      nm->getVectorTemplate()));
+		return a;
+		
+	}
+		
+} //asl
diff --git a/src/num/aslFDAdvectionDiffusionBC.h b/src/num/aslFDAdvectionDiffusionBC.h
new file mode 100644
index 0000000..dbaff3e
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusionBC.h
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDADVECTIONDIFFUSIONBC_H
+#define ASLFDADVECTIONDIFFUSIONBC_H
+
+#include "aslBCond.h"
+
+namespace acl
+{
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+
+}
+
+namespace asl
+{
+	class FDAdvectionDiffusion;
+	typedef std::shared_ptr<FDAdvectionDiffusion> SPFDAdvectionDiffusion;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+	
+	/// Bondary condition that makes constant flux for pure diffusion \ingroup BoundaryConditions		 
+	class BCConstantFluxMap:public BCondWithMap
+	{		
+		public:
+			typedef SPAbstractDataWithGhostNodes Data;
+			acl::SPKernel kernel;			
+		protected:
+			Data  data;			
+			acl::VectorOfElements value; 
+		public:
+			BCConstantFluxMap(Data d,
+			                  const acl::VectorOfElements & val, 
+			                  Data map,
+			                  const VectorTemplate *const t);
+			~BCConstantFluxMap();
+			virtual void execute();
+			virtual void init();			
+			void setValue(const acl::VectorOfElements & v);	
+	};
+
+	
+	SPNumMethod generateBCConstantFlux(SPFDAdvectionDiffusion nm, 
+	                                   double flux,
+	                                   SPAbstractDataWithGhostNodes map);
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSIONBC_H
diff --git a/src/num/aslFDAdvectionDiffusionInhomogeneous.cxx b/src/num/aslFDAdvectionDiffusionInhomogeneous.cxx
new file mode 100644
index 0000000..a220dda
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusionInhomogeneous.cxx
@@ -0,0 +1,92 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDAdvectionDiffusionInhomogeneous.h"
+#include "aslGenerators.h"
+#include <acl/aclGenerators.h>
+#include "acl/acl.h"
+#include "math/aslTemplateVE.h"
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDAdvectionDiffusionInhomogeneous::FDAdvectionDiffusionInhomogeneous():
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(0),
+		cInternalData(0),
+		vectorTemplate(NULL),		
+		diffusivity(0)
+	{
+	}
+
+	FDAdvectionDiffusionInhomogeneous::FDAdvectionDiffusionInhomogeneous(Data c, ScalarField dC, const VectorTemplate* vT):
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(1u,c),
+		cInternalData(0u),
+		vectorTemplate(vT),
+		diffusivity(1u,dC)
+	{
+	}
+	
+	void FDAdvectionDiffusionInhomogeneous::init(){
+		if (cData.size() != diffusivity.size())
+			errorMessage("FDAdvectionDiffusion::init: some of compenents are underdefined");
+
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cInternalData[i] =clone(cData[i]);
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(1,type)); 
+		for (unsigned int i(0); i < cData.size(); ++i){
+			TemplateVE cT(*cData[i],d2q5());
+			TemplateVE diffusivityT(*diffusivity[i],d2q5());
+			(*kernel)<<cT.initValues;
+			(*kernel)<<diffusivityT.initValues;
+			(*kernel)<<(cnew=
+						divAgradB(diffusivityT,cT)+
+						cT.getValue(0));
+			(*kernel)<<(assignmentSafe (cInternalData[i]->getSubContainer(),cnew));
+		}		
+		kernel->setup();
+	}
+
+
+	void FDAdvectionDiffusionInhomogeneous::execute()
+	{
+		kernel->compute();
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(),cInternalData[i]->getDContainer());
+	}
+	
+	void FDAdvectionDiffusionInhomogeneous::addComponent (Data c, ScalarField dC)
+	{
+		diffusivity.push_back(dC);
+		cData.push_back (c);
+	}
+} //asl
diff --git a/src/num/aslFDAdvectionDiffusionInhomogeneous.h b/src/num/aslFDAdvectionDiffusionInhomogeneous.h
new file mode 100644
index 0000000..9be6e37
--- /dev/null
+++ b/src/num/aslFDAdvectionDiffusionInhomogeneous.h
@@ -0,0 +1,82 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDADVECTIONDIFFUSIONINHOMOGENEOUS_H
+#define ASLFDADVECTIONDIFFUSIONINHOMOGENEOUS_H
+
+#include "aslNumMethod.h"
+
+/**
+ \defgroup TransportProcesses Transport Processes
+ */
+
+
+namespace acl{
+	class Kernel;
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multicomponent transport processes
+	/**
+		 \ingroup TransportProcesses
+		 \f[ \partial_t [cData]_i= \nabla_\alpha [diffusivity]_i \nabla_\alpha [cData]_i  \f]
+	 */
+	class FDAdvectionDiffusionInhomogeneous: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes ScalarField;
+		private:
+			std::unique_ptr<acl::Kernel> kernel; 
+			
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+				
+			const VectorTemplate* vectorTemplate;
+
+			int t;
+			std::vector<ScalarField> diffusivity;
+		public:			
+			FDAdvectionDiffusionInhomogeneous();
+			FDAdvectionDiffusionInhomogeneous(Data c, ScalarField dC, const VectorTemplate* vT);
+			void setVectorTemplate(VectorTemplate* vT);
+			VectorTemplate setVectorTemplate(const VectorTemplate* vT);
+			virtual void init();
+			virtual void execute();
+			void addComponent(Data c, ScalarField dC);
+	};
+
+	typedef std::shared_ptr<FDAdvectionDiffusionInhomogeneous> SPFDAdvectionDiffusionInhomogeneous;
+
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSIONINHOMOGENEOUS_H
diff --git a/src/num/aslFDElChemKinetics.cxx b/src/num/aslFDElChemKinetics.cxx
new file mode 100644
index 0000000..bd132b3
--- /dev/null
+++ b/src/num/aslFDElChemKinetics.cxx
@@ -0,0 +1,137 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDElChemKinetics.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <math/aslTemplateVE.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+
+	FDBVKinetics::FDBVKinetics(Data a0,
+	                           double n0,
+	                           Data aI,
+	                           double nI,
+	                           Data phiS,
+	                           Field phi,
+	                           const Param & j0,
+	                           const Param & b,
+	                           double n):
+		SingleKernelMapNM(acl::KERNEL_SIMD),
+		kernelJ(make_shared<acl::Kernel>(acl::KERNEL_SIMD)),
+//		SingleKernelMapNM(acl::KERNEL_BASIC),
+//		kernelJ(make_shared<acl::Kernel>(acl::KERNEL_BASIC)),
+		aI({a0,aI}),
+		efSPhi(phiS),
+		phi(phi),
+		nI({n0,nI}),
+		j0(j0),
+		beta(b),
+		n(n)
+	{
+	}
+		
+	void FDBVKinetics::init0()
+	{
+		acl::TypeID type(getElementType(aI[0]->getDContainer()));
+	
+		acl::VectorOfElements j(acl::generateVEPrivateVariable(1, type));
+		auto eta(phi->getEContainer());
+		auto phiSL(efSPhi->getEContainer());
+
+		acl::ExpressionContainer kk;
+		initMapInfrastructure(kk);
+
+		// valid for beta=0.5 only
+		acl::VectorOfElements cProd(aI[0]->getEContainer());
+		for(unsigned int i(1); i<aI.size(); ++i)
+			copy(cProd*aI[i]->getEContainer(),cProd);
+		copy(sqrt(cProd),cProd);
+		
+		acl::VectorOfElements jCoef(acl::generateVEConstant(0.));
+		for(unsigned int i(0); i<aI.size(); ++i)
+		{
+			acl::VectorOfElements jCoefI(acl::generateVEConstant(1.));
+			for(unsigned int j(0); j<aI.size()-1; ++j)
+				copy(jCoefI* aI[j+(j>=i?1:0)]->getEContainer() , jCoefI);
+			copy(jCoef+ nI[i]*jCoefI,jCoef);
+		}
+		
+
+		kk << (j = j0*cProd*(exp((1.-beta)*n*eta) - exp(-beta*n*eta))/
+		           (1./*-j0/cProd*.5*(exp((1.-beta)*n*eta) - exp(-beta*n*eta))/n*jCoef*/ ));
+
+		//no reaction for 0 anount of reactants
+		for(unsigned int i(0); i<aI.size(); ++i)
+			if(nI[i]<0)
+				kk << (j=min(j,-aI[i]->getEContainer()*(n/nI[i]),type));
+
+		kk << (assignmentSafe(phiSL, j));
+
+		(*kernelJ) << kk;
+		(*kernel) << kk;
+		for(unsigned int i(0); i<aI.size(); ++i)
+			(*kernel) << (assignmentSafe(aI[i]->getEContainer(), 
+			                             aI[i]->getEContainer()+nI[i]*j/n));
+		
+	}
+
+	void FDBVKinetics::addAI(Data ai, double ni)
+	{
+		aI.push_back(ai);
+		nI.push_back(ni);
+	}
+
+	void FDBVKinetics::executeJ()
+	{
+		kernelJ->compute();
+	};
+		
+	SPFDBVKinetics generateFDBVKinetics(SPDataWithGhostNodesACLData a0,
+	                                    double n0,
+	                                    SPDataWithGhostNodesACLData aI,
+	                                    double nI,
+	                                    SPDataWithGhostNodesACLData phiS,
+	                                    SPAbstractDataWithGhostNodes phi,
+	                                    double j0,
+	                                    double beta,
+	                                    double n)
+	{
+		auto nm(make_shared<FDBVKinetics> (a0, n0, aI, nI, 
+		                                   phiS, phi, 
+		                                   acl::generateVEConstant(j0),
+		                                   acl::generateVEConstant(beta),
+		                                   n));
+		return nm;
+	}
+				
+} //asl
diff --git a/src/num/aslFDElChemKinetics.h b/src/num/aslFDElChemKinetics.h
new file mode 100644
index 0000000..5481e54
--- /dev/null
+++ b/src/num/aslFDElChemKinetics.h
@@ -0,0 +1,147 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDELCHEMKINETICS_H
+#define ASLFDELCHEMKINETICS_H
+
+#include "aslSingleKernelNM.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	
+	/// Numerical method which computes electrode reactions
+	/** 
+		 !!!!!!!!!!!!need corrections
+
+		 
+		 \ingroup ChemicalReactions
+		 \ingroup NumMethods
+
+		 Description of an electrochemical kinetic reaction on an electrode:
+		 \f[ \ce{A <-> A^{n+} + n e-} \f]
+		 The reaction kinetics is described by the Butler-Volmer equation:
+		 \f[ j = j_0 c_A \cdot \left( e^{\frac { \alpha_a nF \eta} {RT}} - e^{ - { \frac { \alpha_c nF \eta} {RT}} } \right), \f]
+		 where
+			 
+		- \f$ j_0 \f$ is an exchange current density, \f$ A/m^2 \f$, note the algorithm assumes \f$ mol/m^2/s \f$  
+		- \f$ T \f$ is absolute temperature, \f$K\f$ 
+		- \f$ n \f$ is number of electrons involved in the electrode reaction
+		- \f$ F \f$ is the Faraday constant, \f$ 9.64853399 \cdot 10^4 C mol^{-1} \f$
+		- \f$ R \f$ is universal gas constant, \f$ 8.3144621 J K^{-1} mol^{-1} \f$  
+		- \f$\alpha_c\f$ is so-called cathodic charge transfer coefficient
+		- \f$\alpha_a\f$ is so-called anodic charge transfer coefficient, dimensionless
+		- \f$\eta\f$ is activation overpotential defined as: \f$\eta = \phi - \phi_{eq}\f$		 
+		- \f$E\f$ is electrode potential, \f$ V \f$
+		- \f$E_{eq}\f$ equilibrium potential, \f$ V \f$
+		- \f$c_A\f$ concentration of the component \f$\ce{A}\f$
+
+		The equation describes chemical reaction namely it can be used together 
+        with an appropriate transport equations and equation for the elecrostatic potential:
+		\f[ c_A^R = c_A - j \f]
+		\f[ c_{A^{n+}}^R = c_{A^{n+}} + j \f]
+		\f[ \vec\nabla \kappa \vec\nabla\phi + S_\phi = 0 \f]
+
+		class parameters are related to the quation ones as follows 	 
+		 \param a0 molar concentration of the component before reaction
+		 \param aI molar concentration of the ionized component
+		 \param efSPhi source term in the equation for electrostatic potential
+		 \param phi electrostatic potential, \f$ \phi \f$	
+		 \param j0 corresponds to \f$ j_0 \f$, note it should have the same units as concentrations
+		 \param phi0 corresponds to \f$ \phi_{eq} \f$
+		 \param alphaA corresponds to \f$ \frac { \alpha_a F} {RT} \f$ 
+		 \param alphaC corresponds to \f$ \frac { \alpha_c F} {RT} \f$
+		 \param n corresponds to \f$ n \f$
+			
+	*/
+	class FDBVKinetics: public SingleKernelMapNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+			typedef acl::VectorOfElements Param;
+			
+		private:
+			acl::SPKernel kernelJ;
+			std::vector<Data> aI;			
+			Data efSPhi;
+			Field phi;
+
+			vector<double> nI;
+			Param j0;
+			Param beta;
+			double n;
+
+			virtual void init0();
+		public:			
+			FDBVKinetics(Data a0,
+			             double n0,
+			             Data aI,
+			             double nI,
+			             Data phiS,
+			             Field phi,
+			             const Param & j0,
+			             const Param & beta,
+			             double n);
+			void setElectricFieldSource(Field phi);
+			Field getElectricFieldSource() const;
+			inline Data & getAI(unsigned int i=0);
+			void addAI(Data ai, double ni);			
+			void executeJ();
+	};
+
+	typedef std::shared_ptr<FDBVKinetics> SPFDBVKinetics;
+
+
+	SPFDBVKinetics generateFDBVKinetics(SPDataWithGhostNodesACLData a0,
+	                                    double n0,
+	                                    SPDataWithGhostNodesACLData aI,
+	                                    double nI,
+	                                    SPDataWithGhostNodesACLData phiS,
+	                                    SPAbstractDataWithGhostNodes phi,
+	                                    double j0,
+	                                    double beta,
+	                                    double n);
+	
+
+	
+// ------------------------- Implementation ------------------------
+	
+	inline FDBVKinetics::Data & FDBVKinetics::getAI(unsigned int i)
+	{
+		return aI[i];
+	}
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION_H
diff --git a/src/num/aslFDElasticity.cxx b/src/num/aslFDElasticity.cxx
new file mode 100644
index 0000000..c3becd9
--- /dev/null
+++ b/src/num/aslFDElasticity.cxx
@@ -0,0 +1,365 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDElasticity.h"
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+
+	ElasticityCommonA::ElasticityCommonA():
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		displacementData(),
+		displacementInternalData(),
+		vectorTemplate(NULL)
+	{
+	}
+
+ 	ElasticityCommonA::~ElasticityCommonA()
+	{
+	}
+		
+	ElasticityCommonA::ElasticityCommonA(Data d, 
+	                                     Param bM, 
+	                                     Param sM, 
+	                                     const VectorTemplate* vT):
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		displacementData(d),
+		displacementInternalData(),
+		bulkModulus(bM),
+		shearModulus(sM),
+		vectorTemplate(vT)
+	{		
+	}
+
+	void ElasticityCommonA::setForce(FDElasticityIncompressibleStatic::Param f)
+	{
+		acl::copy(f,force);
+	}
+
+	unsigned int nD(const ElasticityCommonA & e)
+	{
+		return nD(e.getDisplacementData()->getBlock());
+	}
+		
+	FDElasticityIncompressibleStatic::FDElasticityIncompressibleStatic():
+		ElasticityCommonA(),
+		pressure(),
+		pressureInternalData()		
+	{
+	}
+
+ 	FDElasticityIncompressibleStatic::~FDElasticityIncompressibleStatic()
+	{
+	}
+		
+	FDElasticityIncompressibleStatic::FDElasticityIncompressibleStatic(Data d, 
+	                                                       Param bM, 
+	                                                       Param sM, 
+	                                                       const VectorTemplate* vT):
+		ElasticityCommonA(d,bM,sM,vT),
+		pressure(),
+		pressureInternalData()
+	{		
+	}
+
+	
+	void FDElasticityIncompressibleStatic::init(){
+		unsigned int nD(displacementData->getDContainer().size());
+		displacementInternalData = clone(displacementData);
+		pressure = clone(displacementData, 1u);
+		pressureInternalData = clone(pressure);
+		acl::initData(displacementInternalData->getDContainer(),
+		              displacementData->getEContainer());
+		asl::initData(pressure, 0.);
+		asl::initData(pressureInternalData, 0.);
+
+		acl::TypeID type(getElementType(displacementData->getDContainer()));
+		         
+		acl::VectorOfElements dnew(acl::generateVEPrivateVariable(3,type)); 
+		acl::VectorOfElements pnew(acl::generateVEPrivateVariable(1,type)); 
+		acl::VectorOfElements coef1(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements coef2(acl::generateVEPrivateVariable(1,type));
+
+		static const double w(.5); 
+		acl::VectorOfElements wC(acl::generateVEConstant(w));
+		acl::VectorOfElements wm1C(acl::generateVEConstant(1.-w));
+		(*kernel)<<(coef1 = shearModulus);
+		(*kernel)<<(coef2 = (bulkModulus+shearModulus/3.));
+
+		TemplateVE du;
+		du.init(*pressure,*vectorTemplate);
+		(*kernel)<< du.initValues << (pnew=du.getValue(0)*wm1C);
+		(*kernel)<<(dnew=displacementData->getSubContainer()-gradient(du));
+		
+		auto lap(acl::generateVEPrivateVariable(nD,type));
+		
+		for (unsigned int i(0); i<nD; ++i)
+		{	
+			du.init(*displacementData,*vectorTemplate,i);
+			(*kernel)<< du.initValues << (subVE(lap,i) = laplas(du));
+			(*kernel)<< (pnew -= coef2*subVE(gradient(du),i)*wC);
+			(*kernel)<< (subVE(dnew,i) += coef1 * subVE(lap,i));
+//			for (unsigned int k(0); k<nD; ++k)
+//				(*kernel)<<(subVE(dnew,k) += coef1 * dIdJ(k,i,du)); //this commment improoves efficiency
+//			kernel->addExpression(acl::elementOperators::barrier());
+		}
+
+		if(force.size()>0)
+			(*kernel)<<(dnew+= force);
+
+		(*kernel)<<(assignmentSafe (displacementInternalData->getSubContainer(),dnew));
+		(*kernel)<<(assignmentSafe (pressureInternalData->getSubContainer(),pnew));
+
+		kernel->setup();
+	}
+
+
+	void FDElasticityIncompressibleStatic::execute()
+	{
+		kernel->compute();
+		swapBuffers(displacementData->getDContainer(),
+		            displacementInternalData->getDContainer());
+		swapBuffers(pressure->getDContainer(),
+		            pressureInternalData->getDContainer());
+	}
+
+	FDElasticityRelaxation::FDElasticityRelaxation():
+		ElasticityCommonA(),
+		pressure(),
+		pressureInternalData()		
+	{
+	}
+
+ 	FDElasticityRelaxation::~FDElasticityRelaxation()
+	{
+	}
+		
+	FDElasticityRelaxation::FDElasticityRelaxation(Data d, 
+	                                               Param bM, 
+	                                               Param sM,
+	                                               Param dt,
+	                                               const VectorTemplate* vT):
+		ElasticityCommonA(d,bM,sM,vT),
+		pressure(),
+		pressureInternalData(),
+		deltat(dt)
+	{		
+	}
+
+	
+	void FDElasticityRelaxation::init(){
+		unsigned int nD(displacementData->getDContainer().size());
+		displacementInternalData = clone(displacementData);
+		pressure = clone(displacementData, 1u);
+		pressureInternalData = clone(pressure);
+		acl::initData(displacementInternalData->getDContainer(),
+		              displacementData->getEContainer());
+		asl::initData(pressure, 0.);
+		asl::initData(pressureInternalData, 0.);
+
+		acl::TypeID type(getElementType(displacementData->getDContainer()));
+		         
+		acl::VectorOfElements dnew(acl::generateVEPrivateVariable(3,type)); 
+		acl::VectorOfElements pnew(acl::generateVEPrivateVariable(1,type)); 
+		acl::VectorOfElements coef1(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements coef2(acl::generateVEPrivateVariable(1,type));
+
+		static const double w(.5); 
+		acl::VectorOfElements wC(acl::generateVEConstant(w));
+		acl::VectorOfElements wm1C(acl::generateVEConstant(1.-w));
+		(*kernel)<<(coef1=deltat*deltat*shearModulus);
+		(*kernel)<<(coef2=(deltat*deltat)*(bulkModulus+shearModulus/3.));
+
+		TemplateVE du;
+		du.init(*pressure,*vectorTemplate);
+		(*kernel)<< du.initValues << (pnew=du.getValue(0)*wm1C);
+		if(dumpingFactor.size()==0)
+			(*kernel)<<(dnew=2. * displacementData->getSubContainer()
+			                 - displacementInternalData->getSubContainer());
+		else
+			(*kernel)<<(dnew=(1.+dumpingFactor) * displacementData->getSubContainer()
+			                 -dumpingFactor*displacementInternalData->getSubContainer());
+//		(*kernel)<<(dnew+=.2* gradient(du)); //!!! should be -
+		
+		auto lap(acl::generateVEPrivateVariable(nD,type));
+		
+		for (unsigned int i(0); i<nD; ++i)
+		{	
+			du.init(*displacementData,*vectorTemplate,i);
+			(*kernel)<< du.initValues << (subVE(lap,i) = laplas(du));
+			(*kernel)<< (pnew -= coef2*subVE(gradient(du),i)*wC);
+			(*kernel)<< (subVE(dnew,i) += coef1 * subVE(lap,i));
+			for (unsigned int k(0); k<nD; ++k)
+				(*kernel)<<(subVE(dnew,k) += coef2 * dIdJ(k,i,du)); //!!!should be commentent
+			kernel->addExpression(acl::elementOperators::barrier());
+		}
+
+		if(force.size()>0)
+			(*kernel)<<(dnew+= force);
+
+		(*kernel)<<(assignmentSafe (displacementInternalData->getSubContainer(),dnew));
+		(*kernel)<<(assignmentSafe (pressureInternalData->getSubContainer(),pnew));
+
+		kernel->setup();
+	}
+
+
+	void FDElasticityRelaxation::execute()
+	{
+		kernel->compute();
+		swapBuffers(displacementData->getDContainer(),
+		            displacementInternalData->getDContainer());
+		swapBuffers(pressure->getDContainer(),
+		            pressureInternalData->getDContainer());
+	}
+
+	void FDElasticityRelaxation::setDumpingFactor(FDElasticity2::Param dumpF)
+	{
+		acl::copy(dumpF,dumpingFactor);
+	}
+
+		
+	FDElasticity2::FDElasticity2():
+		ElasticityCommonA()
+//		velocityData(),
+	{
+	}
+
+	FDElasticity2::FDElasticity2(Data d, Param bM, 
+	                             Param sM, Param dt, 
+	                             const VectorTemplate* vT):
+		ElasticityCommonA(d,bM,sM,vT),
+		deltat(dt)
+	{		
+	}
+
+ 	FDElasticity2::~FDElasticity2()
+	{
+	}
+		
+	void FDElasticity2::init()
+	{
+		unsigned int nD(displacementData->getDContainer().size());
+		displacementInternalData=clone(displacementData);
+		acl::initData(displacementInternalData->getDContainer(),
+		              displacementData->getEContainer());
+
+		acl::TypeID type(getElementType(displacementData->getDContainer()));
+		         
+		acl::VectorOfElements dnew(acl::generateVEPrivateVariable(3,type)); 
+		acl::VectorOfElements coef1(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements coef2(acl::generateVEPrivateVariable(1,type));
+		(*kernel)<<(coef1=deltat*deltat*shearModulus);
+		(*kernel)<<(coef2=(deltat*deltat)*(bulkModulus+shearModulus/3.));
+		if(dumpingFactor.size()==0)
+			(*kernel)<<(dnew=2. * displacementData->getSubContainer()
+			                 - displacementInternalData->getSubContainer());
+		else
+			(*kernel)<<(dnew=(1.+dumpingFactor) * displacementData->getSubContainer()
+			                 -dumpingFactor*displacementInternalData->getSubContainer()
+		               );
+
+		TemplateVE du;
+		auto lap(acl::generateVEPrivateVariable(nD,type));
+
+		for (unsigned int i(0); i<nD; ++i)
+		{	
+			du.init(*displacementData,*vectorTemplate,i);
+			(*kernel)<< du.initValues << (subVE(lap,i) = laplas(du));
+			(*kernel)<< (subVE(dnew,i) += coef1 * subVE(lap,i));
+			for (unsigned int k(0); k<nD; ++k)
+				(*kernel)<<(subVE(dnew,k) += coef2 * dIdJ(k,i,du));
+//			kernel->addExpression(acl::elementOperators::barrier());
+		}
+
+		if(force.size()>0)
+			(*kernel)<<(dnew+= deltat * deltat * force);
+
+		(*kernel)<<(assignmentSafe (displacementInternalData->getSubContainer(),dnew));
+
+		kernel->setup();
+	}
+
+
+	void FDElasticity2::execute()
+	{
+		kernel->compute();
+		swapBuffers(displacementData->getDContainer(),displacementInternalData->getDContainer());
+	}
+	
+	void FDElasticity2::setDumpingFactor(FDElasticity2::Param dumpF)
+	{
+		acl::copy(dumpF,dumpingFactor);
+	}
+
+	SPFDElasticity2 generateFDElasticity(SPDataWithGhostNodesACLData d, 
+	                                     double bM, 
+	                                     double sM, 
+	                                     double dt, 
+	                                     const VectorTemplate* vT)
+	{
+		auto nm(make_shared<FDElasticity2> (d, 
+		                                    acl::generateVEConstant(bM),
+		                                    acl::generateVEConstant(sM),
+		                                    acl::generateVEConstant(dt),
+		                                    vT));
+		return nm;		
+	}
+
+	SPFDElasticityIncompressibleStatic generateFDElasticityStatic(SPDataWithGhostNodesACLData d, 
+	                                                              double bM, 
+	                                                              double sM, 
+	                                                              const VectorTemplate* vT)
+	{
+		auto nm(make_shared<FDElasticityIncompressibleStatic> (d, 
+		                                                       acl::generateVEConstant(bM),
+		                                                       acl::generateVEConstant(sM),
+		                                                       vT));
+		return nm;				
+	}
+
+	SPFDElasticityRelaxation generateFDElasticityRelax(SPDataWithGhostNodesACLData d, 
+	                                                   double bM, 
+	                                                   double sM, 
+	                                                   double dt, 
+	                                                   const VectorTemplate* vT)
+	{
+		auto nm(make_shared<FDElasticityRelaxation> (d, 
+		                                             acl::generateVEConstant(bM),
+		                                             acl::generateVEConstant(sM),
+		                                             acl::generateVEConstant(dt),
+		                                             vT));
+		return nm;		
+	}
+		
+} //asl
diff --git a/src/num/aslFDElasticity.h b/src/num/aslFDElasticity.h
new file mode 100644
index 0000000..cf0273b
--- /dev/null
+++ b/src/num/aslFDElasticity.h
@@ -0,0 +1,261 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDELASTICITY_H
+#define ASLFDELASTICITY_H
+
+#include "aslNumMethod.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl{
+	class Kernel;
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	class TemplateVE;
+
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
+	typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
+
+	namespace elasticity
+	{
+		acl::VectorOfElements strain(vector<TemplateVE> & displacment);
+		acl::VectorOfElements stressLinear(acl::VectorOfElements & strain);
+//		VectorOfElements linearEqLaplasTerm(TemplateVE displacment);
+	}
+
+	/// abstract class for elasticity solver
+	class ElasticityCommonA: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef acl::VectorOfElements Param;
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+
+			Data displacementData;
+			Data displacementInternalData;			
+				
+			Param bulkModulus;
+			Param shearModulus;
+			Param force;
+		public:			
+			const VectorTemplate* vectorTemplate;
+
+			ElasticityCommonA();
+			/**
+			 \param d is a displacement field
+			 \param bM is the bulk modulus
+			 \param sM is the shear modulus
+			 \param vT is a vector template			 
+			 */
+			ElasticityCommonA(Data d, Param bM, Param sM, const VectorTemplate* vT);
+			~ElasticityCommonA();
+			void setVectorTemplate(const VectorTemplate* vT);
+			VectorTemplate getVectorTemplate();
+
+			virtual void init()=0;
+			virtual void execute()=0;			
+
+			void setForce(Param f);
+			inline Data getDisplacementData() const;
+			inline Data getDisplacementInternalData() const;
+			inline const Param getBulkModulus() const;
+			inline const Param getShearModulus() const;
+	};
+	
+	/// Numerical method which computes homogenious isotropic elasticity equation
+	/**
+		 \ingroup Elasticity
+		 \ingroup NumMethods
+	 */
+	class FDElasticityIncompressibleStatic: public ElasticityCommonA
+	{
+		private:
+			Data pressure;
+			Data pressureInternalData;
+		public:			
+			FDElasticityIncompressibleStatic();
+			/**
+			 \param d is a displacement field
+			 \param bM is the bulk modulus
+			 \param sM is the shear modulus
+			 \param vT is a vector template			 
+			 */
+			FDElasticityIncompressibleStatic(Data d, Param bM, Param sM, const VectorTemplate* vT);
+			~FDElasticityIncompressibleStatic();
+
+			virtual void init();
+			virtual void execute();			
+
+			inline Data getPressureData() const;
+	};
+
+	typedef std::shared_ptr<FDElasticityIncompressibleStatic> SPFDElasticityIncompressibleStatic;
+
+	/// Numerical method which computes homogenious isotropic elasticity equation
+	/**
+		 \ingroup Elasticity
+		 \ingroup NumMethods
+	 */
+	class FDElasticityRelaxation: public ElasticityCommonA
+	{
+		private:
+			Data pressure;
+			Data pressureInternalData;
+			Param deltat;
+			Param dumpingFactor;
+		public:			
+			FDElasticityRelaxation();
+			/**
+			 \param d is a displacement field
+			 \param bM is the bulk modulus
+			 \param sM is the shear modulus
+			 \param dt is time step
+			 \param vT is a vector template			 
+			 */
+			FDElasticityRelaxation(Data d, Param bM, Param sM, Param dt, const VectorTemplate* vT);
+			~FDElasticityRelaxation();
+
+			virtual void init();
+			virtual void execute();			
+
+			inline Data getPressureData() const;
+			inline Param getDeltat() const;
+			void setDumpingFactor(Param dumpF);
+	};
+
+	typedef std::shared_ptr<FDElasticityRelaxation> SPFDElasticityRelaxation;
+
+	
+	/// Numerical method which computes homogenious isotropic elasticity equation
+	/**
+		 \ingroup Elasticity
+		 \ingroup NumMethods
+		 
+		 \f[ \rho\ddot u_j =(K+\mu/3)\nabla_j  \nabla_k u_k+ \mu \Delta u_j + \vec F \f]
+		 where \f$K\f$ is the bulk modulus, \f$\mu\f$ is the shear modulus, 
+		 \f$\vec u\f$ is a displacement vector field, \f$ \vec F\f$ external force
+	*/
+	class FDElasticity2: public ElasticityCommonA
+	{
+		private:
+//			VData velocityData;
+			Param deltat;
+			Param dumpingFactor;
+		public:			
+			FDElasticity2();
+			/**
+			 \param d is a displacement field
+			 \param bM is the bulk modulus
+			 \param sM is the shear modulus
+			 \param dt is time step
+			 \param vT is a vector template			 
+			 */
+			FDElasticity2(Data d, Param bM, Param sM, 
+			              Param dt, const VectorTemplate* vT);
+			~FDElasticity2();
+
+			virtual void init();
+			virtual void execute();			
+//			inline VData getVelocityData() const;
+
+			inline Param getDeltat() const;
+			void setDumpingFactor(Param dumpF);
+	};
+
+	typedef std::shared_ptr<FDElasticity2> SPFDElasticity2;
+	
+	/// Number of dimensions
+	/**
+		 \relates FDElasticity
+	 */
+	unsigned int nD(const ElasticityCommonA & e);
+
+	SPFDElasticity2 generateFDElasticity(SPDataWithGhostNodesACLData d, 
+	                                     double bM, 
+	                                     double sM, 
+	                                     double dt, 
+	                                     const VectorTemplate* vT);
+
+	SPFDElasticityIncompressibleStatic generateFDElasticityStatic(SPDataWithGhostNodesACLData d, 
+	                                                              double bM, 
+	                                                              double sM, 
+	                                                              const VectorTemplate* vT);
+
+	SPFDElasticityRelaxation generateFDElasticityRelax(SPDataWithGhostNodesACLData d, 
+	                                                   double bM, 
+	                                                   double sM, 
+	                                                   double dt, 
+	                                                   const VectorTemplate* vT);
+	
+//-------------------------IMPLEMENTATION------------------------
+
+	inline ElasticityCommonA::Data 
+		ElasticityCommonA::getDisplacementData() const
+	{
+		return displacementData;
+	}
+
+	inline ElasticityCommonA::Data ElasticityCommonA::getDisplacementInternalData() const
+	{
+		return displacementInternalData;
+	}
+	
+	inline const ElasticityCommonA::Param 
+		ElasticityCommonA::getBulkModulus() const
+	{
+		return bulkModulus;
+	}
+	
+	inline const ElasticityCommonA::Param 
+		ElasticityCommonA::getShearModulus() const
+	{
+		return shearModulus;
+	}
+
+	inline ElasticityCommonA::Data 
+		FDElasticityIncompressibleStatic::getPressureData() const
+	{
+		return pressure;
+	}
+	
+	inline FDElasticityRelaxation::Data 
+		FDElasticityRelaxation::getPressureData() const
+	{
+		return pressure;
+	}
+	
+	inline FDElasticity2::Param FDElasticity2::getDeltat() const
+	{
+		return deltat;
+	}
+	
+} // asl
+#endif // ASLFDELASTICITY_H
diff --git a/src/num/aslFDElasticityBC.cxx b/src/num/aslFDElasticityBC.cxx
new file mode 100644
index 0000000..b04a37d
--- /dev/null
+++ b/src/num/aslFDElasticityBC.cxx
@@ -0,0 +1,579 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDElasticityBC.h"
+#include "aslFDElasticity.h"
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/aclGenerators.h"
+#include "acl/Kernels/aclExpressionContainer.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplateVEExtras.h>
+#include <aslGenerators.h>
+#include <acl/aclMath/aclMathAlg.h>
+
+#include "aslBasicBC.h"
+
+
+using acl::generateVEConstant;
+using acl::generateVEConstantN;
+
+namespace asl
+{
+	BCRigidWall::BCRigidWall(SPFDElasticityIncompressibleStatic nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm)
+	{
+	}
+
+
+	void BCRigidWall::init()
+	{
+		unsigned int nC(num->getDisplacementData()->getEContainer().size());
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		(*kernel)<<(acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                         *indicesACL) =
+		            acl::generateVEConstantN(nC,0.));
+		(*kernel)<<(acl::excerpt(num->getPressureData()->getEContainer(),
+		                         *indicesACL) =
+		         acl::excerpt(num->getPressureData()->getEContainer(),
+		                      *neighbourIndicesACL));
+		kernel->setup();
+	}
+
+
+	void BCRigidWall::execute()
+	{
+		kernel->compute();
+	}
+
+	SPBCond generateBCRigidWall(SPFDElasticityIncompressibleStatic nm, 
+                                 const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCRigidWall>(nm));
+		addSlices(*bc,sl);	
+		return bc;
+	}
+
+	BCRigidWallRelaxation::BCRigidWallRelaxation(SPFDElasticityRelaxation nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		value(generateVEConstantN(nD(*nm),0.))
+	{
+	}
+
+	BCRigidWallRelaxation::BCRigidWallRelaxation(SPFDElasticityRelaxation nm, acl::VectorOfElements v):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		value(v)
+	{
+	}
+		
+
+	void BCRigidWallRelaxation::init()
+	{
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		(*kernel)<<(acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                         *indicesACL) = value);
+		(*kernel)<<(acl::excerpt(num->getPressureData()->getEContainer(),
+		                         *indicesACL) =
+		         acl::excerpt(num->getPressureData()->getEContainer(),
+		                      *neighbourIndicesACL));
+		kernel->setup();
+	}
+
+
+	void BCRigidWallRelaxation::execute()
+	{
+		kernel->compute();
+	}
+
+	SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm, 
+                                 const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCRigidWallRelaxation>(nm));
+		addSlices(*bc,sl);	
+		return bc;
+	}
+
+	SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm, 
+	                             const AVec<> & u0,
+                                 const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCRigidWallRelaxation>(nm,acl::generateVEConstant(u0)));
+		addSlices(*bc,sl);	
+		return bc;
+	}
+		
+	SPBCond generateBCRigidWall(SPFDElasticity2 nm, 
+                                 const std::vector<SlicesNames> & sl)
+	{
+		auto d(nm->getDisplacementData());
+		return generateBCConstantValue(d, AVec<>(nD(d->getBlock()),0), sl);		
+	}
+
+	SPBCond generateBCRigidWall(SPFDElasticity2 nm, 
+	                             const AVec<> & u0,
+                                 const std::vector<SlicesNames> & sl)
+	{
+		auto d(nm->getDisplacementData());
+		return generateBCConstantValue(d, u0, sl);		
+	}
+		
+	BCFreeSurface::BCFreeSurface(FDElasticityIncompressibleStatic* nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm)
+	{
+	}
+
+
+	void BCFreeSurface::init()
+	{
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		(*kernel)<<(acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                         *indicesACL) =
+		         acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                      *neighbourIndicesACL));
+		kernel->setup();
+	}
+
+
+	void BCFreeSurface::execute()
+	{
+		kernel->compute();
+	}
+
+	BCFreeSurface2::BCFreeSurface2(SPFDElasticity2 nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm)
+	{
+	}
+
+	BCFreeSurface2::~BCFreeSurface2()
+	{
+	}
+
+
+	void BCFreeSurface2::init()
+	{
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		(*kernel)<<(acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                         *indicesACL) =
+		         acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                      *neighbourIndicesACL));
+		kernel->setup();
+	}
+
+
+	void BCFreeSurface2::execute()
+	{
+		kernel->compute();
+	}
+
+		
+	BCImposedDisplacementVelocityValue::
+	BCImposedDisplacementVelocityValue(SPFDElasticityIncompressibleStatic nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		displacement(AVec<double>(nD(*nm),0)),
+		bDisplacement(false),	
+		velocity(AVec<double>(nD(*nm),0)),
+		bVelocity(false),	
+		initialized(false)
+	{
+	}
+
+	void BCImposedDisplacementVelocityValue::setDisplacement(AVec<double> d)
+	{
+		if (initialized && !bDisplacement)
+			errorMessage ("Error (BCImposedDisplacementVelocityValue): An attempt to set displacment value after initialization");
+		displacement=d;
+		bDisplacement=true;
+	}
+
+
+	void BCImposedDisplacementVelocityValue::setVelocity(AVec<double> v)
+	{
+		if (initialized && !bVelocity)
+			errorMessage ("Error (BCImposedDisplacementVelocityValue): An attempt to set velocity value after initialization");
+		velocity=v;
+		bVelocity=true;
+	}
+		
+	void BCImposedDisplacementVelocityValue::init()
+	{
+		loadIndicesToACL();
+		if (bDisplacement)
+			(*kernel)<<(
+			            acl::excerpt(num->getDisplacementData()->getEContainer(),*indicesACL)=
+			            acl::generateVEVariableR(displacement)
+			            );
+		if (bVelocity)
+//			(*kernel)<<(
+//			            acl::excerpt(num->getVelocityData()->getEContainer(),*indicesACL)=
+//			            acl::generateVEVariableR(velocity)
+//			            );
+		kernel->setup();
+		initialized=true;
+	}
+
+
+	void BCImposedDisplacementVelocityValue::execute()
+	{
+		kernel->compute();
+	}
+
+
+	BCAccelerationSource2::BCAccelerationSource2(FDElasticity2* nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		acceleration(nD(*nm)),
+		initialized(false)
+	{
+	}
+
+
+	void BCAccelerationSource2::setAcceleration(AVec<double> a)
+	{
+		copy(acl::generateVEVariableR(a)*(num->getDeltat()*num->getDeltat()),acceleration);
+	}
+		
+	void BCAccelerationSource2::init()
+	{
+		loadIndicesToACL();
+			(*kernel)<<(
+			            acl::excerpt(num->getDisplacementInternalData()->getEContainer(),*indicesACL)-=
+			            acceleration);
+		kernel->setup();
+		initialized=true;
+	}
+
+
+	void BCAccelerationSource2::execute()
+	{
+		kernel->compute();
+	}
+		
+	BCZeroStressMap::BCZeroStressMap(SPAbstractDataWithGhostNodes d, 
+			                         acl::VectorOfElements l,
+			                         acl::VectorOfElements m,
+			                         SPAbstractDataWithGhostNodes map,
+			                         const VectorTemplate *const t):
+		BCondWithMap(map,t),
+		displacement(d),
+		lambda(l),
+		mu(m),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)) //< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)) //< It is important to fix generateDCFullSafe- SIMDUA issue
+	{	
+	}
+
+	BCZeroStressMap::~BCZeroStressMap()
+	{
+	}
+
+
+	void BCZeroStressMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto dispX(generateDCFullSafe(displacement));
+		initMapInfrastructure(kk);
+
+		auto & vto(*mapTVE->vto);
+		unsigned int nd(nD(*templ));		
+        vector<TemplateVE> duTVE(nd);
+		for(unsigned int i(0); i < nd; ++i)
+		{
+			duTVE[i].init(*dispX, *templ, i);
+			kk << duTVE[i].initValues;
+		}
+		
+		unsigned int nCells(mapTVE->vto->elementaryCells.size()); 
+		acl::TypeID type(getElementType(mapTVE->values));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto vNormal(generateVEPrivateVariable(nd,type));
+		auto vE(generateVEConstantN(nd,1.));
+		auto vB(generateVEPrivateVariable(nd,type));
+		auto mA(acl::generateMEPrivateVariable(nd,nd,type));
+		auto mDelta(acl::generateMEUnit(nd));
+		acl::MatrixOfElements mU(nd,nd);
+		acl::VectorOfElements u0(nd);
+		for(unsigned int j(0); j < nd; ++j)
+			u0[j]=duTVE[j].values[0];
+		auto muDlambda(mu/lambda); 
+		auto vU0(generateVEPrivateVariable(nd,type));
+		auto vU0Res(generateVEPrivateVariable(nd,type));
+		auto isMatrixSol(generateVEPrivateVariable(1,typeI));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		kk << (vNormal = generateVEConstantN(nd, 0.));
+		kk << (mA = generateMEDiagonal(generateVEConstantN(nd, 0.)));
+		kk << (vB = generateVEConstantN(nd, 0.));
+		for(unsigned int i(0); i < nCells; ++i)
+		{
+			auto cellVal(cellValues(*mapTVE, i));
+			kk << (isBoundary = (isGhostNode(0))  && 
+			                    (sumOfElements(sign(subVE(cellVal,1,nd))) > 
+			                     ((double)nd - .2)));
+			kk << (vNormal += select(generateVEConstantN(nd,0.),
+			                         gradient(*mapTVE, i),
+			                         isBoundary, 
+			                         type));
+		}
+		kk << (gcNormalize(vNormal));
+		
+		for(unsigned int i(0); i < nCells; ++i)
+		{
+			auto mT(acl::generateMEConstant(vto.cellMatrices[i]));
+
+			for(unsigned int j(0); j < nd; ++j)
+				for(unsigned int k(0); k < nd; ++k)
+					mU.setElement(j,k, subVE(duTVE[j].values, 
+					                         vto.elementaryCells[i][k+1])[0]);
+
+			auto cellVal(cellValues(*mapTVE, i));
+			kk << (isBoundary = (isGhostNode(0))  && 
+			                    (sumOfElements(sign(subVE(cellVal,1,nd))) > 
+			                     ((double)nd - .2)) ); 
+
+			kk << (mA.getInternalVector() += select((elementProduct(vNormal, vE * mT) + 
+			                                         elementProduct(vE * mT,  muDlambda * vNormal) + 
+			                                         mDelta * generateME( vE * mT * (muDlambda * vNormal))).getInternalVector(),
+			                                        isBoundary,
+			                                        type));
+			kk << (vB += select(trace(mU, mT) * vNormal +
+			                    (muDlambda * vNormal * mU) * mT + 
+			                    mU * (mT * vNormal* muDlambda),
+			                    isBoundary,
+			                    type));
+		}
+		kk << gcSolveSystem(mA,vB,vU0);
+		kk << (isMatrixSol = (acl::fabs(det(mA)) > .05));
+		
+		auto counterD(generateVEPrivateVariable(1,type));
+		kk << (vU0 = generateVEConstantN(nd, 0.));
+		kk << (counterD = generateVEConstant(0));
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = (isComputationNode(i)));
+			kk << (counterD += select(generateVEConstant(1.), isBoundary, type));
+			acl::VectorOfElements vv(nd); 
+			for(unsigned int k(0); k < nd; ++k)
+				vv[k] = duTVE[k].values[i];
+			kk << ( vU0 += select(vv, isBoundary, type));			
+		}
+		kk << (vU0 /= max(counterD, generateVEConstant(.1), type));
+		kk << (vU0Res = select(vU0, vU0Res, isMatrixSol, type));
+		kk << (vU0Res = select(u0, vU0Res, isGhostNode(0), type));
+		
+		kk << (acl::assignmentSafe(displacement->getEContainer(), vU0Res));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((isGhostNode() && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+		kernel->setup();
+//		cout<<kernel->getKernelSource()<<endl;
+
+	}
+/*
+	void BCZeroStressMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto dispX(generateDCFullSafe(displacement));
+		initMapInfrastructure(kk);
+
+		auto & vto(*mapTVE->vto);
+		unsigned int nd(nD(*templ));		
+        vector<TemplateVE> duTVE(nd);
+		for(unsigned int i(0); i < nd; ++i)
+		{
+			duTVE[i].init(*dispX, *templ, i);
+			kk << duTVE[i].initValues;
+		}
+		
+		unsigned int nCells(mapTVE->vto->elementaryCells.size()); 
+		acl::TypeID type(getElementType(mapTVE->values));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto vNormal(generateVEPrivateVariable(nd,type));
+		auto vE(generateVEConstantN(nd,1.));
+		auto vB(generateVEPrivateVariable(nd,type));
+		auto mA(acl::generateMEPrivateVariable(nd,nd,type));
+		auto mDelta(acl::generateMEUnit(nd));
+		acl::MatrixOfElements mU(nd,nd);
+		acl::VectorOfElements u0(nd);
+		for(unsigned int j(0); j < nd; ++j)
+			u0[j]=duTVE[j].values[0];
+		auto muDlambda(mu/lambda); 
+		auto vU0(generateVEPrivateVariable(nd,type));
+		auto vU0Res(generateVEPrivateVariable(nd,type));
+		auto counter(generateVEPrivateVariable(1,type));
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		kk << (counter = generateVEConstant(0));
+		kk << (vU0Res = generateVEConstantN(nd, 0.));
+		kk << (vNormal = generateVEConstantN(nd, 0.));
+		for(unsigned int i(0); i < nCells; ++i)
+		{
+			auto cellVal(cellValues(*mapTVE, i));
+			kk << (isBoundary = (isGhostNode(0))  && 
+			                    (sumOfElements(sign(subVE(cellVal,1,nd))) > 
+			                     ((double)nd - .2)));
+			kk << (vNormal += select(generateVEConstantN(nd,0.),
+			                         gradient(*mapTVE, i),
+			                         isBoundary, 
+			                         type));
+		}
+		kk << (gcNormalize(vNormal));
+		
+		for(unsigned int i(0); i < nCells; ++i)
+		{
+			auto mT(acl::generateMEConstant(vto.cellMatrices[i]));
+
+			for(unsigned int j(0); j < nd; ++j)
+				for(unsigned int k(0); k < nd; ++k)
+					mU.setElement(j,k, subVE(duTVE[j].values, 
+					                         vto.elementaryCells[i][k+1])[0]);
+//			kk << (vNormal = gradient(*mapTVE, i));
+//			kk << (gcNormalize(vNormal));
+			kk << (mA = elementProduct(vNormal, vE * mT) + 
+			            elementProduct(vE * mT,  muDlambda * vNormal) + 
+			            mDelta * generateME( vE * mT * (muDlambda * vNormal)));
+			kk << (vB =  trace(mU, mT) * vNormal +
+			             (muDlambda * vNormal * mU) * mT + 
+			            mU * (mT * vNormal* muDlambda));
+			
+			kk << gcSolveSystem(mA,vB,vU0);
+			auto cellVal(cellValues(*mapTVE, i));
+			kk << (isBoundary = (isGhostNode(0))  && 
+			                    (sumOfElements(sign(subVE(cellVal,1,nd))) > 
+			                     ((double)nd - .2)) && (acl::fabs(det(mA)) > .1));
+			kk << (counter += select(generateVEConstant(0.),
+			                        generateVEConstant(1.),
+			                        isBoundary, 
+			                        type));
+			kk << ( vU0Res += select(generateVEConstantN(nd,0.),
+			                         vU0,
+			                         isBoundary, 
+			                         type));
+		}
+		kk << (vU0Res /= max(counter, generateVEConstant(.1), type));
+
+		auto counterD(generateVEPrivateVariable(1,type));
+		kk << (vU0 = generateVEConstantN(nd, 0.));
+		kk << (counterD = generateVEConstant(0));
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = (isComputationNode(i)));
+			kk << (counterD += select(generateVEConstant(0.),
+			                        generateVEConstant(1.),
+			                        isBoundary, 
+			                        type));
+			acl::VectorOfElements vv(nd); 
+			for(unsigned int k(0); k < nd; ++k)
+				vv[k] = duTVE[k].values[i];
+			kk << ( vU0 += select(generateVEConstantN(nd,0.),
+			                      vv,
+			                      isBoundary, 
+			                      type));			
+		}
+		kk << (vU0 /= max(counterD, generateVEConstant(.1), type));
+		kk << (vU0Res = select(vU0, vU0Res, counter > .1, type));
+		kk << (vU0Res = select(u0,
+		                       vU0Res,
+		                       isGhostNode(0),
+		                       type));
+		
+		kk << (acl::assignmentSafe(displacement->getEContainer(), vU0Res));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((isGhostNode() && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+		kernel->setup();
+//		cout<<kernel->getKernelSource()<<endl;
+
+	}
+*/
+
+	void BCZeroStressMap::execute()
+	{
+		kernel->compute();
+	}		
+		
+	SPNumMethod generateBCZeroStress(SPElasticityCommonA nm, 
+                                     SPAbstractDataWithGhostNodes map)
+	{
+		return std::make_shared<BCZeroStressMap>(
+		                       nm->getDisplacementData(),
+		                       nm->getBulkModulus() - nm->getShearModulus()/1.5,
+		                       nm->getShearModulus(),
+		                       map,
+		                       nm->vectorTemplate);
+	}
+
+	SPNumMethod generateBCZeroStressP(SPFDElasticityIncompressibleStatic nm, 
+                                      SPAbstractDataWithGhostNodes map)
+	{
+		return generateBCConstantValueMiddlePoint(nm->getPressureData(), 
+	                                 			  0, 
+	                                  			  map,
+	                                  			  nm->vectorTemplate);
+	}
+
+	SPNumMethod generateBCZeroStressP(SPFDElasticityRelaxation nm, 
+                                      SPAbstractDataWithGhostNodes map)
+	{
+		return generateBCConstantValueMiddlePoint(nm->getPressureData(), 
+	                                 			  0, 
+	                                  			  map,
+	                                  			  nm->vectorTemplate);
+	}
+
+		
+} // asl
+
diff --git a/src/num/aslFDElasticityBC.h b/src/num/aslFDElasticityBC.h
new file mode 100644
index 0000000..ea657a9
--- /dev/null
+++ b/src/num/aslFDElasticityBC.h
@@ -0,0 +1,290 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDELASTICITYBC_H
+#define ASLFDELASTICITYBC_H
+
+#include "aslBCond.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl{
+	class Kernel;
+	typedef std::shared_ptr<Kernel> SPKernel;
+}
+
+namespace asl
+{
+	class ElasticityCommonA;
+	typedef std::shared_ptr<ElasticityCommonA> SPElasticityCommonA;
+	class FDElasticityIncompressibleStatic;
+	typedef std::shared_ptr<FDElasticityIncompressibleStatic> SPFDElasticityIncompressibleStatic;
+	class FDElasticityRelaxation;
+	typedef std::shared_ptr<FDElasticityRelaxation> SPFDElasticityRelaxation;
+	class FDElasticity2;
+	typedef std::shared_ptr<FDElasticity2> SPFDElasticity2;
+		
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCRigidWall:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDElasticityIncompressibleStatic num;
+		public:
+			BCRigidWall(SPFDElasticityIncompressibleStatic nm);
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBS
+	*/
+
+	SPBCond generateBCRigidWall(SPFDElasticityIncompressibleStatic nm, 
+                                 const std::vector<SlicesNames> & sl);
+
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCRigidWallRelaxation:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDElasticityRelaxation num;
+			acl::VectorOfElements value;
+		public:
+			BCRigidWallRelaxation(SPFDElasticityRelaxation nm);
+			BCRigidWallRelaxation(SPFDElasticityRelaxation nm, acl::VectorOfElements v);
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBS
+	*/
+
+	SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm, 
+                                 const std::vector<SlicesNames> & sl);
+	
+	/// Bondary condition corresponding to a rigid wall (\f$ u=0\f$ and \f$\dot u=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+
+	SPBCond generateBCRigidWall(SPFDElasticity2 nm, 
+                                 const std::vector<SlicesNames> & sl);
+	
+	/// Bondary condition corresponding to a rigid wall (\f$ u=u_0\f$ and \f$\dot u=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+
+	SPBCond generateBCRigidWall(SPFDElasticity2 nm, 
+	                             const AVec<> & u0,
+                                 const std::vector<SlicesNames> & sl);
+
+	/// Bondary condition corresponding to a rigid wall (\f$ u=u_0\f$ and \f$\dot u=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+
+	SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm, 
+	                             const AVec<> & u0,
+                                 const std::vector<SlicesNames> & sl);
+	
+	/// Bondary condition corresponding to a free surface (\f$\partial_{\vec n}u=0\f$ and \f$\partial_{\vec n}\dot u=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCFreeSurface:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			FDElasticityIncompressibleStatic* num;
+		public:
+			BCFreeSurface(FDElasticityIncompressibleStatic* nm);
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a free surface (\f$\partial_{\vec n}u=0\f$)
+	/**	 
+		 \note The free boundary conditions have a different mathematical formulation, 
+		 see BCFreeSurface2Real 
+		 
+		 \ingroup ElasticityBC
+	*/
+	class BCFreeSurface2:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDElasticity2 num;
+		public:
+			BCFreeSurface2(SPFDElasticity2 nm);
+			~BCFreeSurface2();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a free surface 
+	/**	 
+		 \ingroup ElasticityBC
+		 
+		The class is a realisation of 1st order explicit free boundary conditions
+		for rectangular grid and arbitrary geometry. The geometry is defined by a levelset
+		The algorithm computes value in a ghost node. This is done by cell subdivision. 
+		The unit cell containing the ghost node in the center. It is splited into 
+		elementary cells the spliting is described by the corresponding VTObjects. 
+
+		 The gradient in the elementary cells is computed by the following expression:
+		 \f[
+		    \nabla_i u_j = (u^k_j - u^0_j E_k) T_{ki},
+		 \f]
+		 where \f$ u^k_j\f$ is the \f$ k^{th}\f$ point of the elementary cell, 
+		 \f$ E_k \f$ is the vector filled by 1 and \f$ T_{ki} \f$ is the baricentric 
+		 coordinates transformation matrix. 
+
+		 The free boundary condition has the following expression:
+		\f[
+			\lambda n_i\nabla_k u_k+\mu n_j \left( \nabla_i u_j + \nabla_j u_i \right) = F_i,
+		\f]
+		where \f$ \lambda \f$ is a Lame first parameter, \f$ \mu \f$  is shear modulus.
+		This expression can be rewriten in terms of the elementary cell expresion:
+		\f[
+			\lambda n_i(u^k_j - u^0_j E_k) T_{kj} + 
+			\mu n_j \left( (u^k_j - u^0_j E_k) T_{ki} + (u^k_i - u^0_i E_k) T_{kj} \right) = F_i,
+		\f]
+		This equation can be rewritten in form of \f$ A_{ij} u^0_j = b_i \f$:
+		\f[
+		   A_{ij}=\lambda n_i E_kT_{kj} + \mu n_j  E_k T_{ki} + \mu n_l E_k T_{kl} \delta_{ij},
+		\f]
+		\f[
+		   b_i = \lambda n_i u^k_j T_{kj} + \mu n_j (u^k_j T_{ki}+ u^k_i T_{kj}) - F_i.
+		\f]		
+		The solution of the system of equations is the seeking boundary condition.
+			
+		The class should obtain list of the ghost points
+
+	*/
+	class BCZeroStressMap: public BCondWithMap
+	{		
+		protected:
+			SPAbstractDataWithGhostNodes displacement; 
+			acl::VectorOfElements lambda;
+			acl::VectorOfElements mu;
+			acl::SPKernel kernel;
+		public:
+			BCZeroStressMap(SPAbstractDataWithGhostNodes displacement, 
+			                acl::VectorOfElements lambda,
+			                acl::VectorOfElements mu,
+			                SPAbstractDataWithGhostNodes map,
+			                const VectorTemplate *const t);
+			~BCZeroStressMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition set given values to displacement/velocity
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	SPNumMethod generateBCZeroStress(SPElasticityCommonA nm, 
+	                                 SPAbstractDataWithGhostNodes map);
+
+
+	/// Bondary condition set given values to displacement/velocity
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+//	SPNumMethod generateBCZeroStress(SPFDElasticityIncompressibleStatic nm, 
+//	                                 SPAbstractDataWithGhostNodes map);
+
+	/// Bondary condition set given values to displacement/velocity
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+//	SPNumMethod generateBCZeroStress(SPFDElasticityRelaxation nm, 
+//	                                 SPAbstractDataWithGhostNodes map);
+	
+	/// Bondary condition set given values to pressure
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	SPNumMethod generateBCZeroStressP(SPFDElasticityIncompressibleStatic nm, 
+	                                  SPAbstractDataWithGhostNodes map);
+
+	/// Bondary condition set given values to displacement/velocity
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	SPNumMethod generateBCZeroStressP(SPFDElasticityRelaxation nm, 
+	                                  SPAbstractDataWithGhostNodes map);
+	
+	/// Bondary condition set given values to displacement/velocity
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCImposedDisplacementVelocityValue:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDElasticityIncompressibleStatic num;
+			AVec<double> displacement;
+			bool bDisplacement;
+			AVec<double> velocity;
+			bool bVelocity;
+			bool initialized;
+		public:
+			BCImposedDisplacementVelocityValue(SPFDElasticityIncompressibleStatic nm);
+			virtual void execute();
+			virtual void init();			
+			void setDisplacement(AVec<double> d);
+			void setVelocity(AVec<double> v);
+	};
+
+	/// Bondary condition local force(acceleration)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCAccelerationSource2: public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			FDElasticity2* num;
+			acl::VectorOfElements acceleration;
+			bool initialized;
+		public:
+			BCAccelerationSource2(FDElasticity2* nm);
+			virtual void execute();
+			virtual void init();			
+			void setAcceleration(AVec<double> a);
+	};
+		 
+} //asl
+
+#endif //ASLFDELASTICITYBC_H
diff --git a/src/num/aslFDMultiPhase.cxx b/src/num/aslFDMultiPhase.cxx
new file mode 100644
index 0000000..e6cd85c
--- /dev/null
+++ b/src/num/aslFDMultiPhase.cxx
@@ -0,0 +1,154 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDMultiPhase.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <math/aslTemplateVE.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDMultiPhase::FDMultiPhase():
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData(0),
+		cInternalData(0),
+		compressibilityCorrectionFlag(false),
+		vectorTemplate(NULL)
+	{
+	}
+
+
+	FDMultiPhase::FDMultiPhase(Data c, 
+	                           const acl::VectorOfElements & dC,
+	                           const acl::VectorOfElements & rC,
+	                           const VectorTemplate* vT):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData(1u, c),
+		cInternalData(0u),
+		compressibilityCorrectionFlag(false),
+		vectorTemplate(vT),
+		diffusionCoefficient(dC),
+		repulsionConstant(rC)
+	{
+	}
+		
+	void FDMultiPhase::init0()
+	{
+
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cInternalData[i] = clone(cData[i]);
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(1, type)); 
+		std::unique_ptr<TemplateVE> f1;
+		std::unique_ptr<TemplateVE> f2;
+		std::unique_ptr<TemplateVE> phi;
+
+		unsigned int nd(nD(*vectorTemplate));
+
+		vector<TemplateVE> velocityT(nd);
+		if(velocity.get() != 0)
+			for(unsigned int i(0); i < nd; ++i)
+			{
+				velocityT[i].init(*velocity, *vectorTemplate, i);
+				*(kernel) << velocityT[i].initValues;
+			}
+		
+		TemplateVE cT;
+		auto vOne(acl::generateVEConstantN(vectorTemplate->vectors.size(),1.));
+		for (unsigned int i(0); i < cData.size(); ++i)
+		{
+			cT.init(*cData[i], *vectorTemplate);
+			(*kernel) << cT.initValues;
+			TemplateVE cTAbove(productOfElements((cT.values-vOne),.5*(sign(cT.values-vOne)+vOne)),*vectorTemplate);
+			TemplateVE cTBelow(productOfElements(cT.values,.5*(vOne-sign(cT.values))),*vectorTemplate);			
+			
+			(*kernel) << (cnew = 
+			              diffusionCoefficient * laplas(cT) +
+			              0.15 * laplas(cTAbove) +
+			              0.15 * laplas(cTBelow) -                            
+			              repulsionConstant* laplas(cT - cT * cT) +			              
+			              cT.getValue(0));
+			if(velocity.get() != 0)
+			{
+				(*kernel) << (cnew -= divProduct(velocityT, cT));
+				if(compressibilityCorrectionFlag)
+				{
+					(*kernel) << (cnew /= (1. - div(velocityT)));
+				}
+			}
+			(*kernel) << (assignmentSafe(cInternalData[i]->getSubContainer(), cnew));
+		}		
+	}
+
+		
+	void FDMultiPhase::postProcessing()
+	{
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(), cInternalData[i]->getDContainer());
+	}
+		
+
+	void FDMultiPhase::setDiffusionCoefficient(acl::VectorOfElements dC)
+	{
+		copy(dC,diffusionCoefficient);
+	}
+
+		
+	void FDMultiPhase::addComponent(Data c)
+	{	
+		cData.push_back(c);
+	}
+
+		
+	void FDMultiPhase::setVelocity(Field v, bool cCF)
+	{
+		velocity=v;
+		compressibilityCorrectionFlag=cCF;
+	}
+
+	SPFDMultiPhase generateFDMultiPhase(SPDataWithGhostNodesACLData c,
+	                                    SPAbstractDataWithGhostNodes v, 
+	                                    const VectorTemplate* vt, 
+	                                    bool compressibilityCorrection)
+	{
+		auto nm(make_shared<FDMultiPhase> (c, 
+		                                   acl::generateVEConstant(0.07),
+		                                   acl::generateVEConstant(0.1),
+		                                   vt));
+		nm->setVelocity(v,compressibilityCorrection);
+		return nm;
+	}
+
+	
+		
+} //asl
diff --git a/src/num/aslFDMultiPhase.h b/src/num/aslFDMultiPhase.h
new file mode 100644
index 0000000..696347c
--- /dev/null
+++ b/src/num/aslFDMultiPhase.h
@@ -0,0 +1,153 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDMULTIPHASE_H
+#define ASLFDMULTIPHASE_H
+
+#include "aslSingleKernelNM.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multiphase transport processes
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D \Delta c_i - \nabla (\vec v c_i)
+		    					-\nabla\left( a c_i \sum_{j\neq i}\nabla  c_j  \right)\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D\f$
+		 \param repulsionconstant is repulsion constant \f$a\f$ 
+		 \param velocity corresponds to \f$\vec v\f$	 
+	*/
+	class FDMultiPhase: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+			
+		private:	
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+
+			Field velocity;
+			bool compressibilityCorrectionFlag;
+
+			const VectorTemplate* vectorTemplate;
+
+			int t;
+			acl::VectorOfElements diffusionCoefficient;
+			acl::VectorOfElements repulsionConstant;
+
+			virtual void init0();
+			virtual void postProcessing();
+		public:			
+			FDMultiPhase();
+			FDMultiPhase(Data c, 
+			             const acl::VectorOfElements & dC,
+			             const acl::VectorOfElements & rC,
+			             const VectorTemplate* vT);
+			void setDiffusionCoefficient(acl::VectorOfElements d);
+			inline const acl::VectorOfElements & getDiffusionCoefficient() const;
+			void setRepulsionConstant(acl::VectorOfElements d);
+			inline const acl::VectorOfElements & getRepulsionConstant() const;
+			void setVectorTemplate(VectorTemplate* vT);
+			inline const VectorTemplate* getVectorTemplate() const;
+			void setVelocity(Field v, bool compressibilityCorrection=false);
+			inline Field getVelocity();
+			inline std::vector<Data> & getData();
+			void addComponent(Data c);
+	};
+
+	typedef std::shared_ptr<FDMultiPhase> SPFDMultiPhase;
+
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D \Delta c_i - \nabla (\vec v c_i) - 
+			                 \nabla\left( a c_i \sum_{j\neq i}\nabla  c_j\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D_i\f$
+		 \param velocity corresponds to \f$\vec v\f$	 
+	*/
+	SPFDMultiPhase generateFDMultiPhase(SPDataWithGhostNodesACLData c, 
+	                                            SPAbstractDataWithGhostNodes v, 
+	                                            const VectorTemplate* vt,
+	                                            bool compressibilityCorrection = false);
+	
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= D_i \Delta c_i \f]
+		 where
+		 \param cData corresponds to \f$ c_i \f$
+			 
+		 \f$ D_i is diffusionCoefficient \f$,  \f$a\f$ is repulsion constant			 
+	*/
+	SPFDMultiPhase generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c, 
+	                                            double diffustionCoeff,
+	                                            const VectorTemplate* vt);
+	
+// ------------------------- Implementation ------------------------
+
+	inline FDMultiPhase::Field FDMultiPhase::getVelocity()
+	{
+		return velocity;
+	}
+	
+	inline std::vector<FDMultiPhase::Data> & FDMultiPhase::getData()
+	{
+		return cData;
+	}
+	
+	inline const VectorTemplate* FDMultiPhase::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+
+	inline const acl::VectorOfElements & 
+		FDMultiPhase::getDiffusionCoefficient() const
+	{
+		return diffusionCoefficient;
+	}
+		
+} // asl
+#endif // ASLFDMULTIPHASE_H
diff --git a/src/num/aslFDPoroElasticity.cxx b/src/num/aslFDPoroElasticity.cxx
new file mode 100644
index 0000000..123e932
--- /dev/null
+++ b/src/num/aslFDPoroElasticity.cxx
@@ -0,0 +1,197 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDPoroElasticity.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslDataInc.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDPoroElasticity::FDPoroElasticity():
+		ElasticityCommonA(),
+		pressureData(),
+		pressureInternalData(),
+		pressureLiquidData(),
+		pressureLiquidInternalData(),		
+		nSubsteps(acl::generateVEConstant(10.))
+	{
+	}
+
+ 	FDPoroElasticity::~FDPoroElasticity()
+	{
+	}
+		
+	FDPoroElasticity::FDPoroElasticity(Data d, Data pl, Param bM, 
+	                                   Param sM, Param k,
+	                                   const VectorTemplate* vT):
+		ElasticityCommonA(d,bM,sM,vT),		
+		pressureData(),
+		pressureInternalData(),
+		pressureLiquidData(pl),
+		pressureLiquidInternalData(),
+		hydraulicCondactivity(k),
+		nSubsteps(acl::generateVEConstant(10.))
+	{		
+	}
+
+	void FDPoroElasticity::setNSubsteps(unsigned int n)
+	{
+		nSubsteps=acl::generateVEConstant(n);
+	}
+	
+	void FDPoroElasticity::init()
+	{
+
+		unsigned int nD(displacementData->getDContainer().size());
+		displacementInternalData=clone(displacementData);
+		pressureData = clone(pressureLiquidData);
+		pressureInternalData = clone(pressureLiquidData);
+		pressureLiquidInternalData = clone(pressureLiquidData);
+
+		initData(displacementInternalData->getEContainer(), 
+		         displacementData->getEContainer());
+		asl::initData(pressureData, 0.);
+		asl::initData(pressureInternalData, 0.);
+		initData(pressureLiquidInternalData->getEContainer(), 
+		         pressureLiquidData->getEContainer());
+
+		acl::TypeID type(getElementType(displacementData->getDContainer()));
+		         
+		acl::VectorOfElements dnew(acl::generateVEPrivateVariable(3,type)); 
+		acl::VectorOfElements pnew(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements plnew(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements coef1(acl::generateVEPrivateVariable(1,type));
+		acl::VectorOfElements coef2(acl::generateVEPrivateVariable(1,type));
+
+		double sFactor(10.);         //< artificial compresibility
+		acl::VectorOfElements coefPlP(acl::generateVEConstant(sFactor));
+
+		static const double w(.5); 
+		
+		acl::VectorOfElements wC(acl::generateVEConstant(w));
+		acl::VectorOfElements wm1C(acl::generateVEConstant(1.-w));
+		
+		(*kernel)<<(coef1 = shearModulus);
+		(*kernel)<<(coef2 = (bulkModulus+shearModulus/3.));
+
+		TemplateVE du;
+		du.init(*pressureData,*vectorTemplate);
+		(*kernel)<< du.initValues << (pnew=du.getValue(0)*wm1C);
+		(*kernel)<<(dnew=-gradient(du));
+		(*kernel)<<(plnew=-coefPlP*du.getValue(0));
+
+		du.init(*pressureLiquidData,*vectorTemplate);
+		(*kernel)<< du.initValues; 
+		(*kernel)<< (plnew+=du.getValue(0) + hydraulicCondactivity/nSubsteps*laplas(du));
+		(*kernel)<<(dnew-=gradient(du));
+				
+		for (unsigned int i(0); i<nD; ++i)
+		{	
+			du.init(*displacementData,*vectorTemplate,i);
+			(*kernel)<< du.initValues;
+			(*kernel)<< (pnew -= coef2*subVE(gradient(du),i)*wC);
+			(*kernel)<< (subVE(dnew,i) += du.getValue(0) + coef1 * laplas(du));
+		}
+		(*kernel)<<(plnew+=coefPlP*pnew);
+
+		if(force.size()>0)
+			(*kernel)<<(dnew+= force);
+
+		(*kernel)<<(assignmentSafe (displacementInternalData->getSubContainer(),dnew));
+		(*kernel)<<(assignmentSafe (pressureInternalData->getSubContainer(),pnew));
+		(*kernel)<<(assignmentSafe (pressureLiquidInternalData->getSubContainer(),plnew));
+
+		kernel->setup();
+
+	}
+
+
+	void FDPoroElasticity::execute()
+	{
+		kernel->compute();
+		swapBuffers(displacementData->getDContainer(),
+		            displacementInternalData->getDContainer());
+		swapBuffers(pressureData->getDContainer(), 
+		            pressureInternalData->getDContainer());
+		swapBuffers(pressureLiquidData->getDContainer(), 
+		            pressureLiquidInternalData->getDContainer());
+	}
+
+		SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+		                                            SPDataWithGhostNodesACLData pl,
+		                                            double bM, 
+		                                            double sM, 
+		                                            double k,
+		                                            const VectorTemplate* vT)
+	{
+		auto nm(make_shared<FDPoroElasticity> (d, 
+		                                       pl,
+		                                       acl::generateVEConstant(bM),
+		                                       acl::generateVEConstant(sM),
+		                                       acl::generateVEConstant(k),		                                       
+		                                       vT));
+		return nm;				
+	}
+		
+	template <typename T> 
+		SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+		                                            SPDataWithGhostNodesACLData pl,
+		                                            UValue<T> bM, 
+		                                            UValue<T> sM,
+		                                            UValue<T> k,
+		                                            const VectorTemplate* vT)
+	{
+		auto nm(make_shared<FDPoroElasticity> (d, 
+		                                       pl,
+		                                       acl::generateVEVariableSP(bM.p),
+		                                       acl::generateVEVariableSP(sM.p),
+		                                       acl::generateVEVariableSP(k.p),		                                       
+		                                       vT));
+		return nm;						
+	}
+
+	template  
+		SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+		                                            SPDataWithGhostNodesACLData pl,
+		                                            UValue<double> bM, 
+		                                            UValue<double> sM,
+		                                            UValue<double> k,
+		                                            const VectorTemplate* vT);
+	template  
+		SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+		                                            SPDataWithGhostNodesACLData pl,
+		                                            UValue<float> bM, 
+		                                            UValue<float> sM,
+		                                            UValue<float> k,
+		                                            const VectorTemplate* vT);			
+		
+} //asl
diff --git a/src/num/aslFDPoroElasticity.h b/src/num/aslFDPoroElasticity.h
new file mode 100644
index 0000000..a537a48
--- /dev/null
+++ b/src/num/aslFDPoroElasticity.h
@@ -0,0 +1,165 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDPOROELASTICITY_H
+#define ASLFDPOROELASTICITY_H
+
+#include "aslNumMethod.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+#include "aslFDElasticity.h"
+#include "utilities/aslUValue.h"
+
+namespace asl
+{
+	
+	/// Numerical method which computes homogenious isotropic poro-elasticity equation
+	/**
+		 \ingroup Elasticity
+		 \ingroup NumMethods
+
+		The classic poroelastic equations were originally developed by Biot (1941) 
+		to represent biphasic soil consolidation. The equations can be written 
+		in the following form:
+		\f[ (K+\mu/3)\nabla_j  \nabla_k u_k+ \mu \Delta u_j - a \nabla_j p = - (\rho_s-\rho_f)g_j  \f]
+		\f[ a\nabla_i\dot u_i+ \frac{1}{S} \dot p = \nabla_i k \nabla_i p, \f]
+		where 
+			-  \f$\vec u\f$ is the displacement vector, 
+			-  \f$ p \f$ the interstitial pressure,  
+			-  \f$ a \f$ the ratio of fluid volume extracted to volume change of the tissue under compression, 
+			-  \f$\rho_s\f$ the solid fraction density, 
+			-  \f$\rho_f\f$ the fluid density, 
+			-  \f$\vec g \f$ the gravitational vector, 
+			-  \f$ 1/S \f$ the amount of fluid which can be forced into the tissue under constant volume, 
+			-  \f$ k \f$ the hydraulic conductivity, 
+			-  \f$K\f$ is the bulk modulus, 
+			-  \f$\mu\f$ is the shear modulus,.
+
+		In order to solve the first equation we will introduce a fictisionus time \f$ \tau \f$:
+		\f[ \partial_\tau u = (K+\mu/3)\nabla_j  \nabla_k u_k+ \mu \Delta u_j - a \nabla_j p + (\rho_s-\rho_f)g_j  \f]
+		\f[ a\partial_t\nabla_i u_i+ \frac{1}{S} \partial_t p = \nabla_i k \nabla_i p, \f]
+			
+			
+		This implementation is aided to improove stability for incompressible materials.
+		Let us reformulate the first eqation by the following way:
+		\f[ \partial_\tau u = \mu \Delta u_j - \nabla_j \tilde p - a\nabla_j p + (\rho_s-\rho_f)g_j,  \f]
+		\f[ \tilde p = -(K+\mu/3) \nabla_k u_k. \f]
+		then the second eqation will turn to:
+		\f[ \partial_t p = \frac{aS}{K+\mu/3}\partial_t\tilde p + S\nabla_i k \nabla_i p, \f]
+			
+		The equation for \f$\tilde p\f$ leads to an instability for low values of the Poisson ration (for nearly incompressible materials).
+		Therefore the last equation we would like to replace by a relaxation one:
+		\f[ \partial_\tau \tilde p = - w\left( (K+\mu/3)\nabla_k u_k + \tilde p\right), \f]
+		where \f$ w \f$ is a relaxation parameter.
+
+		Let's return to single time variable. Two time steps are related as follows 
+			\f$ \delta_t = N \delta_\tau \f$. Than \f$ \partial_\tau = N\partial_t \f$. 
+		The resulting set of equations is:
+		\f[ \partial_\tau u = \mu \Delta u_j - \nabla_j \tilde p - a\nabla_j p + (\rho_s-\rho_f)g_j,  \f]
+		\f[ \partial_\tau \tilde p = - w\left( (K+\mu/3)\nabla_k u_k + \tilde p\right), \f]			
+		\f[ \partial_\tau p = \frac{aS}{K+\mu/3}\partial_\tau\tilde p + \frac{Sk}{N}\Delta p, \f]
+
+	*/                    
+	class FDPoroElasticity: public ElasticityCommonA
+	{
+		private:
+			Data pressureData;
+			Data pressureInternalData;			
+			Data pressureLiquidData;
+			Data pressureLiquidInternalData;
+
+			Param hydraulicCondactivity;
+			Param compresibility;
+			Param nSubsteps;
+				
+		public:			
+			FDPoroElasticity();
+			/**
+			 \param d is a displacement field
+			 \param pl is a pressure of liquid field
+			 \param bM is the bulk modulus
+			 \param sM is the shear modulus
+			 \param k is hydraulic conductivity 
+			 \param vT is a vector template	
+			 */
+			FDPoroElasticity(Data d, Data pl, Param bM, 
+			                 Param sM, Param k, 
+			                 const VectorTemplate* vT);
+			~FDPoroElasticity();
+
+			virtual void init();
+			virtual void execute();			
+
+			inline Data getPressureData() const;
+			inline Data getLiquidPressureData() const;
+
+			/// defaul value 10
+			void setNSubsteps(unsigned int n);
+	};
+
+	typedef std::shared_ptr<FDPoroElasticity> SPFDPoroElasticity;
+
+	/**
+	 \param d is a displacement field
+	 \param pl is a pressure of liquid field
+	 \param bM is the bulk modulus
+	 \param sM is the shear modulus
+	 \param k is hydraulic conductivity 
+	 \param vT is a vector template	
+	 */
+	SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+	                                            SPDataWithGhostNodesACLData pl,
+	                                            double bM, 
+	                                            double sM,
+	                                            double k,
+	                                            const VectorTemplate* vT);
+	
+	/**
+	 \param d is a displacement field
+	 \param pl is a pressure of liquid field
+	 \param bM is the bulk modulus
+	 \param sM is the shear modulus
+	 \param k is hydraulic conductivity 
+	 \param vT is a vector template	
+	 */
+	template <typename T> 
+		SPFDPoroElasticity generateFDPoroElasticity(SPDataWithGhostNodesACLData d,
+		                                            SPDataWithGhostNodesACLData pl,
+		                                            UValue<T> bM, 
+		                                            UValue<T> sM,
+		                                            UValue<T> k,
+		                                            const VectorTemplate* vT);
+	
+//-------------------------IMPLEMENTATION------------------------
+
+	inline ElasticityCommonA::Data FDPoroElasticity::getPressureData() const
+	{
+		return pressureData;
+	}
+
+	inline ElasticityCommonA::Data FDPoroElasticity::getLiquidPressureData() const
+	{
+		return pressureLiquidData;
+	}
+		
+} // asl
+#endif // ASLFDELASTICITY_H
diff --git a/src/num/aslFDPoroElasticityBC.cxx b/src/num/aslFDPoroElasticityBC.cxx
new file mode 100644
index 0000000..695c524
--- /dev/null
+++ b/src/num/aslFDPoroElasticityBC.cxx
@@ -0,0 +1,231 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDPoroElasticityBC.h"
+#include "aslFDPoroElasticity.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "aslFDElasticityBC.h"
+#include "aslBasicBC.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernel.h"
+#include <acl/acl.h>
+#include <acl/aclGenerators.h>
+#include <acl/Kernels/aclExpressionContainer.h>
+#include <math/aslTemplateVE.h>
+#include <aslGenerators.h>
+#include <math/aslIndex2Position.h>
+
+namespace asl
+{
+
+	BCRigidWallPoroElasticity::BCRigidWallPoroElasticity(SPFDPoroElasticity nm):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		value(acl::generateVEConstantN(nD(*nm),0.))
+	{
+	}
+
+	BCRigidWallPoroElasticity::~BCRigidWallPoroElasticity(){}
+
+	BCRigidWallPoroElasticity::BCRigidWallPoroElasticity(SPFDPoroElasticity nm, acl::VectorOfElements v):
+		BCond(nm->getDisplacementData()->getBlock(),nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		value(v)
+	{
+	}
+		
+
+	void BCRigidWallPoroElasticity::init()
+	{
+		loadIndicesToACL();
+		loadNeighbourIndicesToACL();
+		(*kernel)<<(acl::excerpt(num->getDisplacementData()->getEContainer(),
+		                         *indicesACL) = value);
+		(*kernel)<<(acl::excerpt(num->getPressureData()->getEContainer(),
+		                         *indicesACL) =
+		         acl::excerpt(num->getPressureData()->getEContainer(),
+		                      *neighbourIndicesACL));
+		(*kernel)<<(acl::excerpt(num->getLiquidPressureData()->getEContainer(),
+		                         *indicesACL) =
+		            acl::excerpt(num->getLiquidPressureData()->getEContainer(),
+		                         *neighbourIndicesACL));
+		kernel->setup();
+	}
+
+
+	void BCRigidWallPoroElasticity::execute()
+	{
+		kernel->compute();
+	}
+
+	BCRigidWallDF::BCRigidWallDF(SPFDPoroElasticity nm, 
+	                             SPDistanceFunction rw, 
+	                             SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)), //< It is important to fix generateDCFullSafe- SIMDUA issue
+		num(nm),
+		rWall(rw)
+	{	
+	}
+
+	BCRigidWallDF::~BCRigidWallDF()
+	{
+	}
+
+
+	void BCRigidWallDF::init()
+	{		
+		double wallVal(.0);
+		acl::ExpressionContainer kk;
+		initMapInfrastructure(kk);
+
+		auto dispX(generateDCFullSafe(num->getDisplacementData()));
+		auto pressureX(generateDCFullSafe(num->getPressureData()));
+		auto pressureLX(generateDCFullSafe(num->getLiquidPressureData()));
+
+		acl::TypeID type(getElementType(mapTVE->values));
+		
+//		unsigned int nd(nD(*templ));
+		unsigned int nDir(mapTVE->values.size());
+//		double dx(map->getBlock().dx);
+		auto counter(generateVEPrivateVariable(1,type));
+		auto val(generateVEPrivateVariable(1,type));
+		auto inWall(generateVEPrivateVariable(1,type));
+		Index2PositionACL i2p(map->getBlock(), type);
+			
+		kk <<(inWall=rWall->getDistance(i2p.positionWithInit +
+		                                num->getDisplacementData()->getEContainer()));
+		kk << (counter = acl::generateVEConstant(0));
+
+		TemplateVE duTVE;
+		duTVE.init(*pressureX, *templ, 0, false);
+		kk << duTVE.initValues;
+		kk << (val = acl::generateVEConstant(0));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (counter += select(acl::generateVEConstant(1.), isComputationNode(i), type));
+			kk << (val += select(duTVE.getValue(i), isComputationNode(i), type));			
+		}
+		kk << (counter = max(counter, acl::generateVEConstant(.1), type));
+		kk << (acl::assignmentSafe(num->getPressureData()->getEContainer(), 
+		                           select(num->getPressureData()->getEContainer(),
+		                                  val/counter,
+		                                  inWall > wallVal,
+		                                  type)));
+
+		duTVE.init(*pressureLX, *templ, 0, false);
+		kk << duTVE.initValues;
+		kk << (val = acl::generateVEConstant(0));
+		for(unsigned int i(1); i < nDir; ++i)
+			kk << (val += select(duTVE.getValue(i), isComputationNode(i), type));			
+		kk << (acl::assignmentSafe(num->getLiquidPressureData()->getEContainer(), 
+		                           select(num->getLiquidPressureData()->getEContainer(),
+		                                  val/counter,
+		                                  inWall > wallVal,
+		                                  type)));
+/*
+		for(unsigned int i(0); i < nd; ++i)
+		{
+			duTVE.init(*dispX, *templ, i, false);
+			kk << (val = acl::generateVEConstant(0));		
+			kk << duTVE.initValues;
+			for(unsigned int j(1); j < nDir; ++j)
+				kk << (val += select(duTVE.getValue(j)+(.5*dx*templ->vectors[j][i]*(inWall-wallVal)), 
+				                     isComputationNode(j), type));			
+			kk << (acl::assignmentSafe(subVE(num->getDisplacementData()->getEContainer(),i), 
+			                           select(subVE(num->getDisplacementData()->getEContainer(),i),
+			                                  val/counter,
+			                                  inWall > wallVal,
+			                                  type)));
+		}
+*/
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((isGhostNode() && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+		kernel->setup();
+	}
+
+	void BCRigidWallDF::execute()
+	{
+		kernel->compute();
+	}		
+		
+	void addBCRigidWall(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm, 
+	                     const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCRigidWallPoroElasticity>(nm));
+		addSlices(*bc,sl);	
+		bcList.push_back(bc);		
+	}
+
+	void addBCZeroStress(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm, 
+	                     SPAbstractDataWithGhostNodes map)
+	{
+		bcList.push_back(asl::generateBCZeroStress(nm, map));
+		bcList.push_back(generateBCConstantValueMiddlePoint(nm->getPressureData(), 
+		                                                    0, 
+		                                                    map,
+		                                                    nm->vectorTemplate));
+		bcList.push_back(generateBCConstantValueMiddlePoint(nm->getLiquidPressureData(), 
+		                                                    0, 
+		                                                    map,
+		                                                    nm->vectorTemplate));
+	}
+
+	void addBCZeroStress(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm,
+	                     SPPositionFunction p,
+	                     SPAbstractDataWithGhostNodes map)
+	{
+		bcList.push_back(asl::generateBCZeroStress(nm, map));
+		bcList.push_back(generateBCConstantValue(nm->getPressureData(), 0, map));
+		bcList.push_back(generateBCConstantValue(nm->getLiquidPressureData(), p, map));
+	}
+		
+	void addBCRigidWallDF(std::vector<SPNumMethod> & bcList,
+	                      SPFDPoroElasticity nm,
+	                      SPDistanceFunction rw, 
+	                      SPAbstractDataWithGhostNodes map)
+	{
+		auto bc(std::make_shared<BCRigidWallDF>(nm, rw, map)); 
+		bcList.push_back(bc);
+	}
+
+
+	void addBCRigidWallDF(std::vector<SPNumMethod> & bcList,
+	                      SPFDPoroElasticity nm,
+	                      SPAbstractDataWithGhostNodes rw, 
+			              SPAbstractDataWithGhostNodes map)
+	{
+		auto rwX(generateDCFullSafe(rw,-1.));
+		auto rwXX(std::make_shared<DataInterpolation>(rwX));
+		addBCRigidWallDF(bcList, nm, rwXX, map);		
+	}
+} // asl
+
diff --git a/src/num/aslFDPoroElasticityBC.h b/src/num/aslFDPoroElasticityBC.h
new file mode 100644
index 0000000..e401c4b
--- /dev/null
+++ b/src/num/aslFDPoroElasticityBC.h
@@ -0,0 +1,126 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDPOROELASTICITYBC_H
+#define ASLFDPOROELASTICITYBC_H
+
+#include "aslBCond.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl{
+	class Kernel;
+}
+
+namespace asl
+{
+	class FDPoroElasticity;
+	typedef std::shared_ptr<FDPoroElasticity> SPFDPoroElasticity;
+	class DistanceFunction;
+	typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;
+	class PositionFunction;
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+	
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCRigidWallPoroElasticity:public BCond
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDPoroElasticity num;
+			acl::VectorOfElements value;
+		public:
+			BCRigidWallPoroElasticity(SPFDPoroElasticity nm);
+			BCRigidWallPoroElasticity(SPFDPoroElasticity nm, acl::VectorOfElements v);
+			~BCRigidWallPoroElasticity();
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	class BCRigidWallDF: public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;			
+			SPFDPoroElasticity num;
+			SPDistanceFunction rWall;
+		public:
+			BCRigidWallDF(SPFDPoroElasticity nm, 
+			              SPDistanceFunction rw, 
+			              SPAbstractDataWithGhostNodes map);
+			~BCRigidWallDF();
+			virtual void execute();
+			virtual void init();			
+	};
+	
+	void addBCRigidWall(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm, 
+	                     const std::vector<SlicesNames> & sl);
+		
+	/// Bondary condition set given values to pressure
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	void addBCZeroStress(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm, 
+	                     SPAbstractDataWithGhostNodes map);
+
+	/// Bondary condition set given values to pressure
+	/**	 
+		 \ingroup ElasticityBC
+		 \param bcList list of boundary conditions
+		 \param nm corresponding numerical method
+		 \param p pressure field
+		 \param map computation map
+	*/
+	void addBCZeroStress(std::vector<SPNumMethod> & bcList,
+	                     SPFDPoroElasticity nm,
+	                     SPPositionFunction p,
+	                     SPAbstractDataWithGhostNodes map);
+	
+
+	/**	 
+		 \ingroup ElasticityBC
+	*/
+	void addBCRigidWallDF(std::vector<SPNumMethod> & bcList,
+	                      SPFDPoroElasticity nm,
+	                      SPDistanceFunction rw, 
+			              SPAbstractDataWithGhostNodes map);
+
+	/**	 
+		 \ingroup ElasticityBC
+	   considers \p rw as linear interpolation
+	*/
+	void addBCRigidWallDF(std::vector<SPNumMethod> & bcList,
+	                      SPFDPoroElasticity nm,
+	                      SPAbstractDataWithGhostNodes rw, 
+			              SPAbstractDataWithGhostNodes map);
+	
+		 
+} //asl
+
+#endif //ASLFDPOROELASTICITYBC_H
diff --git a/src/num/aslFDStefanMaxwell.cxx b/src/num/aslFDStefanMaxwell.cxx
new file mode 100644
index 0000000..7424cdc
--- /dev/null
+++ b/src/num/aslFDStefanMaxwell.cxx
@@ -0,0 +1,338 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDStefanMaxwell.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include <math/aslTemplateVE.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDStefanMaxwell::FDStefanMaxwell():
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData(0),
+		cInternalData(0),
+		vectorTemplate(NULL)
+	{
+	}
+
+
+	FDStefanMaxwell::FDStefanMaxwell(Data c1,
+	                                 Data c2,
+	                                 const acl::VectorOfElements & dC, 
+	                                 const VectorTemplate* vT):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		cData({c1,c2}),
+		cInternalData(0u),
+		vectorTemplate(vT),
+		diffusionCoefficients({vector<acl::VectorOfElements>({acl::generateVEConstant(0.), dC}),
+			                  vector<acl::VectorOfElements>({dC,acl::generateVEConstant(0.)})})
+	{
+	}
+		
+	void FDStefanMaxwell::init0()
+	{
+		if (cData.size() != diffusionCoefficients.size())
+			errorMessage("FDStefanMaxwell::init - some of compenents are underdefined");
+		
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		unsigned int nC(cData.size());
+		unsigned int nd(nD(*vectorTemplate));
+		unsigned int nDir(vectorTemplate->vectors.size());
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < nC; ++i)
+		{
+			cInternalData[i] = clone(cData[i]);
+			initData(cInternalData[i]->getEContainer(),cData[i]->getEContainer());
+		}
+		
+
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(nC, type));
+		acl::VectorOfElements lambda(acl::generateVEPrivateVariable(nC, type));
+		acl::VectorOfElements cTotal(acl::generateVEPrivateVariable(1, type));
+		acl::MatrixOfElements aM(nC,nC);
+		acl::VectorOfElements flux(acl::generateVEPrivateVariable(nC, type));
+		
+		vector<TemplateVE> velocityT(nd);
+		if(velocity.get() != 0)
+			for(unsigned int i(0); i < nd; ++i)
+			{
+				velocityT[i].init(*velocity, *vectorTemplate, i,false);
+			}
+
+		TemplateVE phiT;
+		if(efPhi.get() != 0)
+			phiT.init(*efPhi, *vectorTemplate, 0, false);
+		
+		vector<TemplateVE> cT(nC);
+		for (unsigned int i(0); i < cData.size(); ++i)
+		{
+			cT[i].init(*cData[i], *vectorTemplate, 0, false);
+			(*kernel)<<(subVE(cnew,i) =cT[i].getValue(0)); 
+		}
+
+		for(unsigned int kk(1); kk<nDir; ++kk)
+		{
+			vector<acl::VectorOfElements> cL;
+			acl::VectorOfElements mNablaC(nC);
+			
+			(*kernel) << (cTotal = acl::generateVEConstant(0));
+			//computation of cTotal and Lambda
+			for (unsigned int i(0); i < nC; ++i)
+			{
+				cL.push_back((cT[i].getValue(0)+cT[i].getValue(kk))*.5);
+				mNablaC[i]=(cT[i].getValue(0)-cT[i].getValue(kk))[0];
+				(*kernel) << (cTotal += cL[i]);
+				(*kernel) << (subVE(lambda,i) =acl::generateVEConstant(0.));
+				for (unsigned int j(0); j < nC; ++j)
+					if(j!=i)
+						(*kernel) << (subVE(lambda,i) += cL[i]/diffusionCoefficients[i][j]); 
+			}
+			(*kernel) << (lambda/=cTotal);
+			// eccounting of the electric field
+			if(efPhi.get() != 0)
+				for (unsigned int i(0); i < nC; ++i)
+					mNablaC[i]=(subVE(mNablaC,i)-cL[i]*efCharge[i]*
+					            (phiT.getValue(kk)-phiT.getValue(0)))[0];
+
+			// compilation of matrix
+			for (unsigned int i(0); i < nC; ++i)
+				for (unsigned int j(0); j < nC; ++j)
+				{
+					if(i==j)
+						aM.setElement(i,i, lambda[i]);
+					else 
+						aM.setElement(i,j, (-cL[i]/cTotal/diffusionCoefficients[i][j])[0]);
+				}
+			if(dustDiffusionCoefficients.size())
+				for (unsigned int i(0); i < nC; ++i)
+					aM.setElement(i,i,(1./dustDiffusionCoefficients[i]+aM.getVE(i,i))[0]);
+			
+			(*kernel) << gcSolveSystem(aM, mNablaC, flux);
+			acl::VectorOfElements advFlux(nC);
+			if(velocity.get() != 0)
+			{
+				acl::VectorOfElements velL((velocityT[0].getValue(kk)+velocityT[0].getValue(0)) * 
+				                      .5 * vectorTemplate->vectors[kk]);
+				for (unsigned int i(1); i < nd; ++i)
+					copy(velL+(velocityT[i].getValue(kk)+velocityT[i].getValue(0)) * 
+					     .5 * vectorTemplate->vectors[kk], velL);
+				for (unsigned int i(0); i < nC; ++i)
+					advFlux[i]=(cL[i]*velL)[0];
+			}
+			else
+				copy(acl::generateVEConstantN(nC,0), advFlux);	
+			
+			(*kernel) << (cnew-=(flux + advFlux)*vectorTemplate->laplasCoefs[kk]);
+		}
+			
+		for (unsigned int i(0); i < nC; ++i)	
+			(*kernel) << (assignmentSafe(cInternalData[i]->getSubContainer(), subVE(cnew,i)));				
+	}
+
+		
+	void FDStefanMaxwell::postProcessing()
+	{
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(), cInternalData[i]->getDContainer());
+	}
+		
+
+	void FDStefanMaxwell::setDiffusionCoefficient(acl::VectorOfElements dC, 
+	                                              unsigned int i,unsigned int j)
+	{
+		if(i==j)
+			errorMessage("FDStefanMaxwell::setDiffusionCoefficient - i and j should have values");
+		copy(dC,diffusionCoefficients[i][j]);
+		copy(dC,diffusionCoefficients[j][i]);
+	}
+		
+	void FDStefanMaxwell::addComponent(Data c, const Param & dC)
+	{
+		unsigned int n(diffusionCoefficients.size());
+		diffusionCoefficients.resize(n+1);
+		for(unsigned int i(0); i<n+1; ++i)
+			diffusionCoefficients[i].resize(n+1);
+		copy(acl::generateVEConstant(0),diffusionCoefficients[n][n]);
+		for(unsigned int i(0); i<n; ++i)
+			setDiffusionCoefficient(subVE(dC,i),n,i);
+		cData.push_back(c);
+	}
+
+	void FDStefanMaxwell::addComponent(Data c, const Param & dC, const Param & q)
+	{
+		addComponent(c, dC);
+		efCharge.push_back(q);
+	}
+
+	void FDStefanMaxwell::setVelocity(Field v)
+	{
+		velocity=v;
+	}
+		
+
+	void FDStefanMaxwell::setElectricField(Field phi)
+	{
+		efPhi=phi;
+	}
+
+	void FDStefanMaxwell::setDustDiffusionCoefficient(unsigned int i, 
+	                                                  const acl::VectorOfElements & dd)
+	{
+		if (i>=cData.size())
+			errorMessage("FDStefanMaxwell::setDustDiffusionCoefficient: i is larger than the number of components");
+		
+		if (i+1>dustDiffusionCoefficients.size() && i<cData.size())
+				dustDiffusionCoefficients.resize(i+1);
+		acl::copy(dd,dustDiffusionCoefficients[i]);
+	}
+
+	void FDStefanMaxwell::setCharge(unsigned int i, const Param & q)
+	{
+		if (i>=cData.size())
+			errorMessage("FDStefanMaxwell::setCharge: i is larger than the number of components");
+
+		if (i+1>efCharge.size() && i<cData.size())
+				efCharge.resize(i+1);
+		acl::copy(q,efCharge[i]);
+	}
+		
+	SPFDStefanMaxwell generateFDStefanMaxwell(SPDataWithGhostNodesACLData c1,
+	                                          SPDataWithGhostNodesACLData c2,
+	                                          double diffusionCoeff,            
+	                                          SPAbstractDataWithGhostNodes v, 
+	                                          const VectorTemplate* vt)
+	{
+		auto nm(make_shared<FDStefanMaxwell> (c1, c2, acl::generateVEConstant(diffusionCoeff), vt));
+		nm->setVelocity(v);
+		return nm;
+	}
+
+	SPFDStefanMaxwell generateFDStefanMaxwell(SPDataWithGhostNodesACLData c1,
+	                                          SPDataWithGhostNodesACLData c2,
+	                                          double diffusionCoeff, 
+	                                          const VectorTemplate* vt)
+	{
+		auto nm(make_shared<FDStefanMaxwell> (c1, c2, acl::generateVEConstant(diffusionCoeff), vt));
+		return nm;
+	}
+
+	FDStefanMaxwellElectricField::FDStefanMaxwellElectricField(SPFDStefanMaxwell sm, Data phi):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		smSolver(sm),
+		phi(phi)			
+	{
+	}
+		
+	void FDStefanMaxwellElectricField::init0()
+	{
+
+		auto & cData(smSolver->getData());
+		auto vt(smSolver->getVectorTemplate());
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		unsigned int nC(cData.size());
+		unsigned int nDir(vt->vectors.size());
+		
+		phiInternalData = clone(phi);
+		initData(phiInternalData->getEContainer(), phi->getEContainer() );
+
+		acl::VectorOfElements phiNew(acl::generateVEPrivateVariable(1, type));
+		acl::VectorOfElements lambda(acl::generateVEPrivateVariable(nC, type));
+		acl::VectorOfElements cTotal(acl::generateVEPrivateVariable(1, type));
+		acl::MatrixOfElements aM(nC,nC);
+		acl::VectorOfElements flux(acl::generateVEPrivateVariable(nC, type));
+		
+		vector<TemplateVE> cT(nC);
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cT[i].init(*cData[i], *vt, 0, false);
+
+		TemplateVE phiT(*phi, *vt, 0, false);
+		(*kernel)<<(phiNew = phiT.getValue(0)+phiS->getSubContainer()*stepFactor); 
+		
+		for(unsigned int kk(1); kk<nDir; ++kk)
+		{
+			vector<acl::VectorOfElements> cL;
+			acl::VectorOfElements cq(nC);
+			acl::VectorOfElements q(nC);
+			(*kernel) << (cTotal = acl::generateVEConstant(0));
+
+			//computation of cTotal and Lambda
+			for (unsigned int i(0); i < nC; ++i)
+			{
+				cL.push_back((cT[i].getValue(0)+cT[i].getValue(kk))*.5);
+				q[i]=smSolver->getCharge(i)[0];
+				cq[i]=(smSolver->getCharge(i)*cL[i])[0];
+				(*kernel) << (cTotal += cL[i]);
+				(*kernel) << (subVE(lambda,i) =acl:: generateVEConstant(0.));
+				for (unsigned int j(0); j < nC; ++j)
+					if(j!=i)
+						(*kernel) << (subVE(lambda,i) += cL[i]/smSolver->getDiffusionCoefficient(i,j)); 
+			}
+			(*kernel) << (lambda/=cTotal);
+
+			// compilation of matrix
+			for (unsigned int i(0); i < nC; ++i)
+				for (unsigned int j(0); j < nC; ++j)
+				{
+					if(i==j)
+						aM.setElement(i,i, lambda[i]);
+					else 
+						aM.setElement(i,j, (-cL[i]/cTotal/smSolver->getDiffusionCoefficient(i,j))[0]);
+				}
+//			if(dustDiffusionCoefficients.size())
+			for (unsigned int i(0); i < nC; ++i)
+				aM.setElement(i,i,(1./smSolver->getDustDiffusionCoefficient(i)+aM.getVE(i,i))[0]);
+
+			(*kernel) << gcSolveSystem(aM, cq, flux);
+
+			(*kernel) << (phiNew+=stepFactor*(q*flux)*
+			              (phiT.getValue(kk)-phiT.getValue(0))*
+			              vt->laplasCoefs[kk]);//!!.... 
+		}
+			
+		(*kernel) << (assignmentSafe(phiInternalData->getSubContainer(), phiNew));
+	}
+
+		
+	void FDStefanMaxwellElectricField::postProcessing()
+	{
+		swapBuffers(phi->getDContainer(), 
+		            phiInternalData->getDContainer());
+	}
+
+	void FDStefanMaxwellElectricField::setPhiS(Field pS)
+	{
+		phiS=pS;
+	}
+
+		
+} //asl
diff --git a/src/num/aslFDStefanMaxwell.h b/src/num/aslFDStefanMaxwell.h
new file mode 100644
index 0000000..ef9b68f
--- /dev/null
+++ b/src/num/aslFDStefanMaxwell.h
@@ -0,0 +1,220 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDSTEFANMAXWELL_H
+#define ASLFDSTEFANMAXWELL_H
+
+#include "aslSingleKernelNM.h"
+
+namespace acl
+{
+	class VectorOfElementsData;
+	class VectorOfElements;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multicomponent transport processes
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= - \vec \nabla \cdot \vec J - \vec \nabla \cdot (\vec v c_i) \f]
+		 \f[ -\nabla c_i = \sum_{j, i\neq j} \frac{c_j\vec J_i-c_i\vec J_j}{c_tD_{ij}} + \frac{\vec J_i}{D_{i,D}}\f]						
+		 where \f$c_i\f$ is a molar concentration, \f$ v \f$ is the flow velocity, 
+		 \f$J_i\f$ is the molar flux, \f$D_{i,D}\f$ is the component-dust diffusion coefficient, 
+         \f$D_{ij}\f$ is the pair diffusion coefficient. 
+
+		 The second equation can be rewritten in the matrix form:
+		 \f[ -\vec \nabla c_i = \sum_k A_{ik} \vec J_k,\;\;\; 
+             A_{ik} \equiv \delta_{ik} \left(\frac{1}{D_{i,D}} + 
+											 \Lambda_i + 
+                                             \frac{c_i}{c_tD_{ik}} \right) - 
+				          \frac{c_i}{c_tD_{ik}},\;\;\;
+             \Lambda_i \equiv \sum_{j, j\neq i} \frac{c_j}{c_tD_{ij}}\f]
+		 
+		class parameters are related to the quation ones as follows 	 
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficients corresponds to \f$D_{ij}\f$
+		 \param velocity corresponds to \f$\vec v\f$	 
+	*/
+	class FDStefanMaxwell: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+			typedef acl::VectorOfElements Param;
+			
+		private:	
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+
+			Field efPhi;
+			std::vector<Param> efCharge;
+
+			Field velocity;
+
+			const VectorTemplate* vectorTemplate;
+
+			std::vector<std::vector<Param>> diffusionCoefficients;
+			std::vector<Param> dustDiffusionCoefficients;
+
+			virtual void init0();
+			virtual void postProcessing();
+		public:			
+			FDStefanMaxwell();
+			FDStefanMaxwell(Data c1,
+			                Data c2,
+			                const acl::VectorOfElements & dC, 
+			                const VectorTemplate* vT);
+			void setDiffusionCoefficient(acl::VectorOfElements d, 
+			                             unsigned int i = 0,unsigned int j = 1);
+			inline const Param & getDiffusionCoefficient(unsigned int i=0, unsigned int j=1) const;
+			inline const Param & getDustDiffusionCoefficient(unsigned int i=0) const;
+			void setDustDiffusionCoefficient(unsigned int i, const Param & dd);
+			void setVectorTemplate(VectorTemplate* vT);
+			inline const VectorTemplate* getVectorTemplate() const;
+			void setElectricField(Field phi);
+			Field getElectricField() const;
+			inline const Param & getCharge(unsigned int i) const;
+			void setCharge(unsigned int i, const Param & q);
+			void setVelocity(Field v);			
+			inline Field getVelocity();
+			inline std::vector<Data> & getData();
+			void addComponent(Data c, const Param & dC);
+			void addComponent(Data c, const Param & dC, const Param & q);			
+	};
+
+	typedef std::shared_ptr<FDStefanMaxwell> SPFDStefanMaxwell;
+
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 \f[ \partial_t c_i= - \vec \nabla \cdot \vec J - \vec \nabla \cdot (\vec v c_i) \f]
+		 \f[ -\nabla c_i = \sum_{j, i\neq j} \frac{c_j\vec J_i-c_i\vec J_j}{c_tD_{ij}} + \frac{\vec J_i}{D_{i,D}}\f]						
+		 where \f$c_i\f$ is a molar concentration, \f$ v \f$ is the flow velocity, 
+		 \f$J_i\f$ is the molar flux, \f$D_{i,D}\f$ is the component-dust diffusion coefficient, 
+         \f$D_{ij}\f$ is the pair diffusion coefficient. 
+		 
+		parameters are related to the quation ones as follows 	 
+		 \param c1 \f$c_1\f$
+		 \param c2 \f$c_2\f$
+		 \param diffusionCoeff corresponds to \f$D_{12}\f$
+		 \param v velocity field
+		 \param vt used VectorTemplate
+
+	 */
+	SPFDStefanMaxwell generateFDStefanMaxwell(SPDataWithGhostNodesACLData c1, 
+	                                          SPDataWithGhostNodesACLData c2,
+	                                          double diffustionCoeff,
+	                                          SPAbstractDataWithGhostNodes v, 
+	                                          const VectorTemplate* vt);
+	
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods
+		 
+		 \f[ \partial_t c_i= - \vec \nabla \cdot \vec J\f]
+		 \f[ -\nabla c_i = \sum_{j, i\neq j} \frac{c_j\vec J_i-c_i\vec J_j}{c_tD_{ij}} + \frac{\vec J_i}{D_{i,D}}\f]						
+		 where \f$c_i\f$ is a molar concentration, \f$ v \f$ is the flow velocity, 
+		 \f$J_i\f$ is the molar flux, \f$D_{i,D}\f$ is the component-dust diffusion coefficient, 
+         \f$D_{ij}\f$ is the pair diffusion coefficient. 
+		 
+		 \param c1 \f$c_1\f$
+		 \param c2 \f$c_2\f$
+		 \param diffusionCoeff corresponds to \f$D_{12}\f$
+		 \param vt used VectorTemplate
+	
+	*/
+	SPFDStefanMaxwell generateFDStefanMaxwell(SPDataWithGhostNodesACLData c1, 
+	                                          SPDataWithGhostNodesACLData c2,
+	                                          double diffustionCoeff,
+	                                          const VectorTemplate* vt);
+
+	class FDStefanMaxwellElectricField: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+			
+		private:
+			SPFDStefanMaxwell smSolver;
+			Data phi;
+			Data phiInternalData;
+			Field phiS;
+			const double stepFactor=1e-3;
+
+			virtual void init0();
+			virtual void postProcessing();
+		public:			
+			FDStefanMaxwellElectricField(SPFDStefanMaxwell sm, Data phi);
+			void setPhiS(Field pS);
+	};
+
+	typedef std::shared_ptr<FDStefanMaxwellElectricField> SPFDStefanMaxwellElectricField;
+	
+// ------------------------- Implementation ------------------------
+
+	inline FDStefanMaxwell::Field FDStefanMaxwell::getVelocity()
+	{
+		return velocity;
+	}
+	
+	inline std::vector<FDStefanMaxwell::Data> & FDStefanMaxwell::getData()
+	{
+		return cData;
+	}
+	
+	inline const VectorTemplate* FDStefanMaxwell::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+
+	inline const acl::VectorOfElements & 
+		FDStefanMaxwell::getDiffusionCoefficient(unsigned int i, unsigned int j) const
+	{
+		return diffusionCoefficients[i][j];
+	}
+
+	inline const acl::VectorOfElements & 
+		FDStefanMaxwell::getDustDiffusionCoefficient(unsigned int i) const
+	{
+		return dustDiffusionCoefficients[i];
+	}
+
+	inline const acl::VectorOfElements & 
+		FDStefanMaxwell::getCharge(unsigned int i) const
+	{
+		return efCharge[i];
+	}
+
+	
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION_H
diff --git a/src/num/aslInterfaceTracking.dox b/src/num/aslInterfaceTracking.dox
new file mode 100644
index 0000000..b80601b
--- /dev/null
+++ b/src/num/aslInterfaceTracking.dox
@@ -0,0 +1,50 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+ \defgroup InterfaceTracking Interface Tracking
+ \ingroup Physics
+
+\section Goals Goals
+
+Create efficient method for interface tracking. The method should fulfill the 
+following requirements:
+	- topological changes
+	- precise boundary restoration
+	- allows OpenCL implementations with and without use of atomic functions
+
+
+\section BasicIdea Basic idea
+
+The method uses underling rectangular grid for storage. The underling grid 
+can be both regular or tree structured. The interface is described by a scalar
+field, namely it corresponds to iso-surface with zero value. The surface
+properties e.g. orientation and curvature are restored by applying the marching
+tetrahedra algorithm.
+
+The information is saved point-wise in corresponding grid node. The
+corresponding points are supposed to be on a grid edges. Thus each node contains 
+information about N (numbed of dimensions) edges. 
+
+
+*/
diff --git a/src/num/aslInterfaceTrackingAlg1.cxx b/src/num/aslInterfaceTrackingAlg1.cxx
new file mode 100644
index 0000000..64f8246
--- /dev/null
+++ b/src/num/aslInterfaceTrackingAlg1.cxx
@@ -0,0 +1,83 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslInterfaceTrackingAlg1.h"
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/acl.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclMath/aclBarycentric.h"
+#include <algorithm>
+#include <math/aslTemplates.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplatesExtras.h>
+#include <math/aslDistanceFunction.h>
+
+namespace asl
+{
+
+	InterfaceTrackingAlg1::~InterfaceTrackingAlg1()
+	{}
+		
+	InterfaceTrackingAlg1::InterfaceTrackingAlg1()
+	{
+	}
+	
+	InterfaceTrackingAlg1::InterfaceTrackingAlg1(Data df, DataGen v):
+		LevelSetLinear(df),
+		velocity(v)
+	{		
+	}	
+
+		
+	void InterfaceTrackingAlg1::initVelocityComputation()
+	{
+		auto & kk(*kernel);
+		unsigned int nv(vectorTemplate->vectors.size());
+		unsigned int nd(nD(*vectorTemplate));
+
+		TemplateVE velocityT[nd];
+		for(unsigned int i(0); i < nd; ++i)
+		{
+			velocityT[i].init(*velocity, *vectorTemplate, i);
+			kk << velocityT[i].initValues;
+		}
+
+		lVelocities.resize(nv);
+		for(unsigned int i(0); i < nv; ++i)
+		{
+			copy(subVE(velocityT[0].values,i,i), lVelocities[i]);
+			for(unsigned int j(1); j < nd; ++j)
+				copy(cat(lVelocities[i],
+				         subVE(velocityT[j].values,i,i)),
+				     lVelocities[i]);
+		}
+
+	}
+		
+} // asl
+
diff --git a/src/num/aslInterfaceTrackingAlg1.h b/src/num/aslInterfaceTrackingAlg1.h
new file mode 100644
index 0000000..d9b6475
--- /dev/null
+++ b/src/num/aslInterfaceTrackingAlg1.h
@@ -0,0 +1,62 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLINTERFACETRACKINGALG1_H
+#define ASLINTERFACETRACKINGALG1_H
+
+#include "aslLevelSetLinear.h"
+
+namespace asl
+{	
+	/// Numerical method which computes evolution of an interface
+	/**
+		 \ingroup InterfaceTracking
+		 \ingroup NumMethods
+		 \ingroup LevelSet		 
+	 */
+	class InterfaceTrackingAlg1: public LevelSetLinear
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPDataWithGhostNodesACL DataGen;
+			
+		protected:
+			DataGen velocity;
+			
+			virtual void initVelocityComputation();
+		public:			
+
+			InterfaceTrackingAlg1();
+			/**
+			 \param d is points position
+			 \param v is velocity field
+			 */
+			InterfaceTrackingAlg1(Data df, DataGen v);
+			~InterfaceTrackingAlg1();
+	};
+
+	typedef std::shared_ptr<InterfaceTrackingAlg1> SPInterfaceTrackingAlg1;
+	
+} //asl
+
+#endif //ASLINTERFACETRACKINGALG1_H
diff --git a/src/num/aslLBGK.cxx b/src/num/aslLBGK.cxx
new file mode 100644
index 0000000..41f7ded
--- /dev/null
+++ b/src/num/aslLBGK.cxx
@@ -0,0 +1,358 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLBGK.h"
+#include "aslGenerators.h"
+#include <acl/aclGenerators.h>
+#include "acl/acl.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "math/aslTemplateVE.h"
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <acl/aclElementBase.h>
+#include <acl/DataTypes/aclMemBlock.h>
+#include <acl/DataTypes/aclIndex.h>
+#include <math/aslTemplates.h>
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/Kernels/aclKernel.h"
+#include <math/aslVectorsDynamicLengthOperations.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+
+	acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate* vt)
+	{
+		return f*acl::generateVEConstant(vt->quasiparticlesCoefs);	
+	}
+
+	acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate* vt)
+	{
+		unsigned int nD(asl::nD(vt->vectors[0]));
+		acl::VectorOfElements a(nD);
+		unsigned int nv(f.size());
+		vector<double> vComponent(nv);
+		for(unsigned int i(0); i<nD; ++i){
+			for(unsigned int j(0); j<nv; ++j)
+				vComponent[j]=double(vt->vectors[j][i])*vt->quasiparticlesCoefs[j];
+			a[i]=(f*acl::generateVEConstant(vComponent))[0];
+		}
+		return a;	
+	}
+
+	acl::VectorOfElements a_i_dot_v(acl::VectorOfElements v, const VectorTemplate* vt)
+	{
+		unsigned int nv(vt->vectors.size());
+		acl::VectorOfElements res(nv);
+		for(unsigned int j(0); j<nv; ++j)
+			res[j]=(v*acl::generateVEConstant(vt->vectors[j]))[0];
+		return res;			
+	}
+
+
+	acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate* vt)
+	{
+		unsigned int nv(vt->vectors.size());
+		acl::VectorOfElements res(nv);
+
+		for(unsigned int i(0); i<nv; ++i)
+			res[i]=f[vt->invertVectors[i]];
+		
+		return res;
+	}
+
+	
+	LBGK::LBGK():
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		vectorTemplate(NULL),
+		flagComputeVelocity(true),
+		flagComputeRho(true),
+		flagCompressible(true)
+	{
+	}
+
+
+	LBGK::LBGK(DataD v, 
+	           Param nu, 
+	           const VectorTemplate* vT):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		vectorTemplate(vT),
+		v(v),
+		viscosity(nu),
+		flagComputeVelocity(true),
+		flagComputeRho(true),
+		flagCompressible(true)
+	{
+		createData(v->getInternalBlock(),
+		           v->getEContainer()[0]->getQueue(),
+		           v->getEContainer()[0]->getTypeID());
+		createCopyKernels();
+	}
+
+	LBGK::LBGK(Block b, Param nu, 
+		       const VectorTemplate* vT,
+	           bool compVel, bool compRho,
+		       acl::CommandQueue queue):
+		SingleKernelNM(acl::KERNEL_SIMDUA),
+		vectorTemplate(vT),
+		viscosity(nu),
+		flagComputeVelocity(compVel),
+		flagComputeRho(compRho),
+		flagCompressible(true)
+	{
+		createData(b,queue,viscosity[0]->getTypeID());
+		createCopyKernels();
+	}
+
+	void LBGK::createData(Block b, acl::CommandQueue queue, acl::TypeID type)
+	{
+		unsigned int nv(vectorTemplate->vectors.size());
+		fShifts.reset(new AVec<int>(nv));
+		fShiftsIncrement.reset(new AVec<int>(nv));
+		asl::AVec<int> transformVector(offset(b).c2iTransformVector);
+		for(unsigned int i(0); i<nv; ++i){
+			(*fShiftsIncrement)[i]=-transformVector*vectorTemplate->vectors[i];
+		}
+
+		unsigned int maxIncrement(maxComponent(*fShiftsIncrement));
+
+		unsigned int length(productOfElements(offset(b).getSize()));
+		unsigned int poolLength(2*length+4*maxIncrement);
+
+		for(unsigned int i(0); i<nv; ++i){
+			(*fShifts)[i]= ((*fShiftsIncrement)[i] >0 ? 0 : poolLength-length);
+		}
+				
+		copy(acl::generateVEData(poolLength, type, nv, queue),fPool);
+
+		acl::VectorOfElements container(generateVESubElements(fPool,
+		                                                 length,
+		                                                 acl::generateVEVariableSP(fShifts)));
+		f=generateDataContainer_SP(b, container, 1u);
+		if (!v) 
+			v=generateDataContainerACL_SP(b, type, nD(b), 1u, queue);
+		if (!rho)
+			rho=generateDataContainerACL_SP(b, type, 1u, 1u, queue);
+	}
+
+	void LBGK::createCopyKernels()
+	{
+		unsigned int nv(fPool.size());
+		unsigned int length(f->getEContainer()[0]->getSize());
+		unsigned int poolLength(fPool[0]->getSize());
+
+		acl::Element ind(new acl::Index(length));
+		acl::Element backShift(new acl::Constant<cl_int>(poolLength-length));
+		
+		copyKernels.resize(nv);
+		for(unsigned int i(0); i<nv; ++i){
+			copyKernels[i].reset(new acl::Kernel(acl::KERNEL_SIMDUA));
+			using namespace acl::elementOperators;
+			using acl::elementOperators::operator+;
+			if((*fShiftsIncrement)[i]>0)
+				copyKernels[i]->addExpression(
+				                operatorAssignmentSafe(excerpt(fPool[i], ind),
+				                                       f->getEContainer()[i]));
+			else
+				copyKernels[i]->addExpression(
+				                operatorAssignmentSafe(excerpt(fPool[i],backShift+ind),
+				                					   f->getEContainer()[i]));
+
+			copyKernels[i]->setup();
+		}		
+	}
+
+	void LBGK::init0()
+	{
+		unsigned int nv(vectorTemplate->vectors.size());
+		acl::TypeID typeID(viscosity[0]->getTypeID());
+
+		unsigned int nd(v->getEContainer().size());
+		
+		acl::VectorOfElements fOld(generateVEPrivateVariable(nv,typeID));
+		acl::VectorOfElements fEq(generateVEPrivateVariable(nv,typeID));
+		acl::VectorOfElements pRho(generateVEPrivateVariable(1u, typeID));
+
+		acl::VectorOfElements momentum(generateVEPrivateVariable(nd,typeID));
+		acl::VectorOfElements aDotMomentum(a_i_dot_v(momentum,vectorTemplate));
+		
+		acl::VectorOfElements w(generateVEPrivateVariable(1u, typeID));
+		(*kernel)<<(fOld=f->getEContainer());
+		(*kernel)<<(w= 1./(3. * viscosity + .5));
+		(*kernel)<<(momentum = computeMomentum(fOld,vectorTemplate));
+		(*kernel)<<(pRho = computeRho(fOld,vectorTemplate));
+		// valid for both compressible and incompresible
+		if(omega.size()>0)
+			(*kernel)<< (momentum += (2./w)* crossProduct(omega, momentum));
+
+		if(flagComputeRho)
+			(*kernel)<<	acl::assignmentSafe(rho->getEContainer(), pRho);
+		if(flagComputeVelocity)
+		{
+			if (flagCompressible)
+				(*kernel)<<	acl::assignmentSafe(v->getEContainer(), momentum/pRho);
+			else
+				(*kernel)<<	acl::assignmentSafe(v->getEContainer(), momentum);
+		}
+		
+		if (flagCompressible)
+			(*kernel)<<(fEq=pRho * acl::generateVEConstantN(nv, 1.) + 
+			                3. * aDotMomentum +
+				            4.5 * acl::productOfElements(aDotMomentum,aDotMomentum)/pRho -
+		    		    	1.5 * momentum*momentum/pRho * acl::generateVEConstantN(nv, 1.)
+		        		);
+		else
+			(*kernel)<<(fEq=pRho * acl::generateVEConstantN(nv, 1.) + 
+			                3. * aDotMomentum +
+				            4.5 * acl::productOfElements(aDotMomentum,aDotMomentum) -
+		    		    	1.5 * momentum*momentum * acl::generateVEConstantN(nv, 1.)
+		        		);
+			
+		auto fNew(fOld*(1.-w)+ w*fEq);
+		(*kernel)<<(assignmentSafe(f->getEContainer(),fNew));		
+	}
+
+	void LBGK:: preProcessing()
+	{
+		unsigned int nv(fShifts->getSize());
+		unsigned int length(f->getEContainer()[0]->getSize());
+		unsigned int poolLength(fPool[0]->getSize());
+		for(unsigned int i(0); i<nv; ++i)
+			if((*fShifts)[i]+length+(*fShiftsIncrement)[i]>poolLength || 
+			   (*fShifts)[i]+(*fShiftsIncrement)[i]<0)
+			{
+				copyKernels[i]->compute();
+				(*fShifts)[i]=(*fShiftsIncrement)[i] >0 ? 0 : poolLength-length;
+			}
+		(*fShifts)+=(*fShiftsIncrement);
+	}
+
+	void LBGK::setOmega(LBGK::Param w)
+	{
+		copy(w,omega);
+	}
+
+	LBGKUtilities::LBGKUtilities(SPLBGK lbgk):
+		num(lbgk)
+	{
+	}
+
+	void LBGKUtilities::initF(Param rho, Param vel)
+	{
+		unsigned int nv(num->getVectorTemplate()->vectors.size());
+		acl::VectorOfElements aDotVel(a_i_dot_v(vel,num->getVectorTemplate()));
+
+		initData(num->getF()->getEContainer(),
+		         rho* (acl::generateVEConstantN(nv, 1.) + 
+		                3. * aDotVel +
+		                4.5 * acl::productOfElements(aDotVel,aDotVel) -
+		            	1.5 * vel * vel * acl::generateVEConstantN(nv, 1.)),
+		         acl::KERNEL_SIMDUA);
+		initData(num->getRho()->getEContainer(),rho);
+		initData(num->getVelocity()->getEContainer(),vel);
+	}
+
+	void LBGKUtilities::initF(Param vel)
+	{
+		initF(acl::generateVEConstant(1),vel);
+	}	
+
+	LBGKTurbulence::LBGKTurbulence(Block b, Param nu, 
+	                               const VectorTemplate* vT,
+	                               bool compVel, bool compRho,
+	                               acl::CommandQueue queue):
+		LBGK(b,nu,vT,compVel, compRho, queue)
+	{
+	}
+
+	LBGKTurbulence::LBGKTurbulence(DataD v, 
+	                               Param nu, 
+	                               const VectorTemplate* vT):
+		LBGK(v,nu,vT)
+	{
+	}
+
+
+	void LBGKTurbulence::init0()
+	{
+		unsigned int nv(vectorTemplate->vectors.size());
+		acl::TypeID typeID(viscosity[0]->getTypeID());
+
+		unsigned int nd(v->getEContainer().size());
+		
+		acl::VectorOfElements fOld(generateVEPrivateVariable(nv,typeID));
+		acl::VectorOfElements fEq(generateVEPrivateVariable(nv,typeID));
+		acl::VectorOfElements pRho(generateVEPrivateVariable(1u, typeID));
+
+		acl::VectorOfElements momentum(generateVEPrivateVariable(nd,typeID));
+		acl::VectorOfElements aDotMomentum(a_i_dot_v(momentum,vectorTemplate));
+		
+		acl::VectorOfElements w(generateVEPrivateVariable(1u, typeID));
+		(*kernel)<<(fOld=f->getEContainer());
+// Turbulence
+		auto fL2(fOld*fOld);
+		auto fmfEqL2((fOld-fEq)*(fOld-fEq));
+		(*kernel)<<(w=4.*(fmfEqL2/fL2));
+		(*kernel)<<(w = select((1./(3. * viscosity + .5)),
+		                       (1./(3. * min(viscosity*w,
+		                                     acl::generateVEConstant(.5)) + .5)), 
+		                       w>1,
+		                       typeID));
+//--------------------------
+//		(*kernel)<<(w= 1./(3. * viscosity + .5));
+		(*kernel)<<(momentum = computeMomentum(fOld,vectorTemplate));
+		(*kernel)<<(pRho = computeRho(fOld,vectorTemplate));
+		// valid for both compressible and incompresible
+		if(omega.size()>0)
+			(*kernel)<< (momentum += (2./w)* crossProduct(omega, momentum));
+
+		if(flagComputeRho)
+			(*kernel)<<	acl::assignmentSafe(rho->getEContainer(), pRho);
+		if(flagComputeVelocity)
+		{
+			if (flagCompressible)
+				(*kernel)<<	acl::assignmentSafe(v->getEContainer(), momentum/pRho);
+			else
+				(*kernel)<<	acl::assignmentSafe(v->getEContainer(), momentum);
+		}
+		
+		if (flagCompressible)
+			(*kernel)<<(fEq=pRho * acl::generateVEConstantN(nv, 1.) + 
+			                3. * aDotMomentum +
+				            4.5 * acl::productOfElements(aDotMomentum,aDotMomentum)/pRho -
+		    		    	1.5 * momentum*momentum/pRho * acl::generateVEConstantN(nv, 1.)
+		        		);
+		else
+			(*kernel)<<(fEq=pRho * acl::generateVEConstantN(nv, 1.) + 
+			                3. * aDotMomentum +
+				            4.5 * acl::productOfElements(aDotMomentum,aDotMomentum) -
+		    		    	1.5 * momentum*momentum * acl::generateVEConstantN(nv, 1.)
+		        		);
+		auto fNew(fOld*(1.-w)+ w*fEq);
+		(*kernel)<<(assignmentSafe(f->getEContainer(),fNew));		
+	}
+		
+} //asl
+
diff --git a/src/num/aslLBGK.dox b/src/num/aslLBGK.dox
new file mode 100644
index 0000000..086c7c0
--- /dev/null
+++ b/src/num/aslLBGK.dox
@@ -0,0 +1,62 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\class asl::LBGK
+
+	The class realizes the Lattice-Boltzmann algorithm for the compressible and incompressible flows.
+	This realization is valid for 2D as well as for 3D cases. The 2D realization
+	uses D2Q9 (asl::d2q9) lattice, and 3D one uses D3Q15 (asl::d3q15) and D3Q19 (asl::d3q19) lattice. The kinetic eqaution is:
+	\f[ f_i(\vec r+\vec a_i,t+1)=(1-\omega)f_i(\vec r,t)+\omega f^{eq}_i, \f]
+
+	In the compressible case the equilibrium distribution functions are difined as follows:
+	\f[ f^{eq}=\rho \left( 1+\frac{\vec a_i\cdot \vec v_i}{a_s^2}+ \frac{(\vec a_i \cdot \vec v)^2}{2a_s^4}-\frac{{\vec v}^2}{2a_s^2} \right),\f]
+	where
+	\f[ \rho=\sum_i w_i f_i,\;\;\; \vec v= \frac{1}{\rho}\left(\sum_i w_i\vec a_i f_i +\frac{1}{\omega}F\delta_t\right),\f]
+	\f[ a_s\equiv\sum_i w_i a_{ix}a_{ix}. \f]
+	The local pressure is defined by the following expression:
+	\f[ p = a_s^2 \rho. \f]
+
+	In the case of incompressible flow the equilibrium distribution function is defined as follows:
+	\f[ f^{eq}=p + p_0\left(\frac{\vec a_i\cdot \vec v_i}{a_s^2}+ \frac{(\vec a_i \cdot \vec v)^2}{2a_s^4}-\frac{{\vec v}^2}{2a_s^2} \right),\f]
+	where
+	\f[ p=\sum_i w_i f_i,\;\;\; \vec v= \frac{1}{p_0}\left(\sum_i w_i\vec a_i f_i +\frac{1}{\omega}F\delta_t\right),\f]
+	\f[ a_s\equiv\sum_i w_i a_{ix}a_{ix}. \f]
+	The local pressure is defined by the following expression:
+	\f[ p_0 = a_s^2 \rho_0. \f] 
+	it is assumed that \f$ p_0 \f$ value is 1.
+
+
+	The expression for the relaxation parameter is same for compressible and incompressible cases:
+	\f[ w=\frac{2}{6\nu+1}, \f] 
+	where \f$\nu\f$ is the kinematic viscosity. 
+	
+	see:X. He and L.S. Luo, "Lattice {B}oltzmann Model for the Incompressible Navier-Stokes Equation", J. Stat. Phys., v.88(1997), p.927-944, doi = {10.1023/B:JOSS.0000015179.12689.e4}
+
+	The class contains a noninertial force defined by the expression:
+	\f[ F = - 2 \left[\vec \Omega, \vec v\right]. \f]
+	
+	 
+*/
+
+
diff --git a/src/num/aslLBGK.h b/src/num/aslLBGK.h
new file mode 100644
index 0000000..65064e9
--- /dev/null
+++ b/src/num/aslLBGK.h
@@ -0,0 +1,209 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLBGK_H
+#define ASLLBGK_H
+
+#include "aslSingleKernelNM.h"
+#include <acl/aclHardware.h>
+#include <math/aslVectors.h>
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+#include "acl/aclMath/aclMatrixOfElements.h"
+
+namespace asl
+{
+	class Block;
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+
+	/// returns VectorOfElements with values of rho  
+	/**	
+		 \relates LBGK
+
+		 \f[ \rho=\sum_i w_i f_i\f]
+		 where \f$ w_i \f$ is defined by \p vt 
+	*/
+	acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate* vt);
+		
+	/// returns VectorOfElements with values of velocity  
+	/**	
+		\relates LBGK
+		 
+		\f[ \vec m= \sum_i w_i\vec a_i f_i \f]
+		where \f$ w_i \f$ is defined by \p vt 
+	*/
+	acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate* vt);
+
+	/// generates Vector Of Elements with inverce components according to \p vt
+	acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate* vt);
+
+	acl::MatrixOfElements generateLBGKMatrix(acl::VectorOfElements nu);
+	acl::MatrixOfElements generateMRTMatrix(acl::VectorOfElements nu);
+		
+	acl::MatrixOfElements generateDifKinMatrix(acl::VectorOfElements nu);
+	
+	/// Numerical method for fluid flow
+	/**
+		 \ingroup TransportProcesses
+		 \ingroup NumMethods		 
+	*/
+	class LBGK: public SingleKernelNM
+	{
+		public:
+			typedef SPDataWithGhostNodesACL Data;
+			typedef SPDataWithGhostNodesACLData DataD;
+			typedef acl::VectorOfElements Param;
+			
+			const VectorTemplate* vectorTemplate;
+		protected:
+			acl::VectorOfElementsData fPool;
+			Data f;
+			DataD v;
+			DataD rho;
+
+			std::shared_ptr<AVec<int>> fShifts;
+			std::shared_ptr<AVec<int>> fShiftsIncrement;
+
+			std::vector<acl::SPKernel> copyKernels;
+
+			Param viscosity;
+			Param deltat;
+			Param force;
+			Param omega;
+
+			bool flagComputeVelocity;
+			bool flagComputeRho;
+			bool flagCompressible;
+			
+			void createData(Block b, acl::CommandQueue queue, acl::TypeID type);
+			void createCopyKernels();
+			/// contains classical moving procedure
+			virtual void preProcessing();
+			virtual void init0();
+			
+		public:			
+			LBGK();
+			LBGK(DataD v, Param nu, const VectorTemplate* vT);
+			LBGK(Block b, Param nu, const VectorTemplate* vT, 
+			     bool compVel=true, bool compRho=true, 
+			     acl::CommandQueue queue = acl::hardware.defaultQueue);
+			void setViscosity(Param nu);
+			double getViscosity(unsigned int i = 0);
+			/// sets angular velocity for Coriolis term in noninertial reference frame
+			void setOmega(Param w);
+			void setVectorTemplate(const VectorTemplate* vT);
+			inline const VectorTemplate* getVectorTemplate() const;
+
+
+			inline Data getF();
+			inline DataD getRho();
+			inline DataD getVelocity();
+
+			inline void setCompressible(bool flag = true);
+			inline const bool & getCompressible() const;
+	};
+
+	typedef std::shared_ptr<LBGK> SPLBGK;	
+
+
+	///contains different kernels for preprocessing and posprocessing of data used by LBGK
+	class LBGKUtilities
+	{
+		private:
+			typedef acl::VectorOfElements Param;
+			
+			SPLBGK num;
+			acl::SPKernel kernelComputeV;
+			acl::SPKernel kernelComputeRho;
+			acl::SPKernel kernelComputeRhoV;
+			acl::SPKernel kernelInitF;
+
+			Param velocity;
+			Param rho;
+			
+		public:
+			LBGKUtilities(SPLBGK lbgk);
+			void computeRho();
+			void computeVelocity();
+			void computeRhoVelocity();
+			void initF(Param rho, Param vel);
+			/// dencity is suposed to be 1
+			void initF(Param vel);
+	};
+
+	typedef std::shared_ptr<LBGKUtilities> SPLBGKUtilities;
+
+	class LBGKTurbulence: public LBGK
+	{
+		public:
+			LBGKTurbulence(DataD v, Param nu, const VectorTemplate* vT);
+			LBGKTurbulence(Block b, Param nu, const VectorTemplate* vT, 
+			               bool compVel=true, bool compRho=true, 
+			               acl::CommandQueue queue = acl::hardware.defaultQueue);
+			virtual void init0();
+	};
+
+	typedef std::shared_ptr<LBGKTurbulence> SPLBGKTurbulence;	
+	
+// ------------------------- Implementation ------------------------
+
+
+	inline LBGK::Data LBGK::getF()
+	{
+		return f;
+	}
+
+	inline LBGK::DataD LBGK::getRho()
+	{
+		return rho;
+	}
+
+	inline LBGK::DataD LBGK::getVelocity()
+	{
+		return v;
+	}
+	
+	inline const VectorTemplate* LBGK::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+	
+	inline void LBGK::setCompressible(bool flag)
+	{
+		flagCompressible=flag;
+	}
+
+	inline const bool & LBGK::getCompressible() const
+	{
+		return flagCompressible;
+	}
+		
+} // asl
+#endif // ASLLBGK_H
diff --git a/src/num/aslLBGKBC.cxx b/src/num/aslLBGKBC.cxx
new file mode 100644
index 0000000..834e458
--- /dev/null
+++ b/src/num/aslLBGKBC.cxx
@@ -0,0 +1,893 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLBGKBC.h"
+
+#include "aslLBGK.h"
+#include "aslBasicBC.h"
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/acl.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include <algorithm>
+#include <math/aslTemplates.h>
+#include <aslGenerators.h>
+#include <math/aslTemplateVE.h>
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslIndex2Position.h>
+#include <math/aslPositionFunction.h>
+
+namespace asl
+{
+	using acl::generateVEConstant;
+	using acl::generateVEConstantN;
+	using acl::generateVEPrivateVariable;
+	
+
+	BCLBGKCommon::BCLBGKCommon(SPLBGK nm):
+		BCond(nm->getF()->getBlock(),nm->getVectorTemplate()),
+		num(nm),
+		kernels(nm->getVectorTemplate()->vectors.size()),
+		km(new acl::KernelMerger()),
+		directionGroupsShifts(nm->getVectorTemplate()->vectors.size()),
+		directionGroupsSizes(nm->getVectorTemplate()->vectors.size())
+	{
+		for(unsigned int i(0); i<kernels.size(); ++i)
+			kernels[i].reset(new acl::Kernel(acl::KERNEL_BASIC));
+	}
+
+	void BCLBGKCommon::sortDirections()
+	{
+		sortTwoVectors(directions, indices);
+
+		unsigned int n(directionGroupsShifts.getSize());
+		for(unsigned int i(0); i<n; ++i){
+			directionGroupsShifts[i]=std::find(directions.begin(), 
+			                                   directions.end(),
+			                                   (int)i)-directions.begin();
+			directionGroupsSizes[i]=directions.rend()-
+				std::find(directions.rbegin(), directions.rend(), (int)i)
+				-directionGroupsShifts[i];
+			directionGroupsSizes[i]=directionGroupsSizes[i]<0 ? 0 : directionGroupsSizes[i];
+		}
+	}
+		
+	void BCLBGKCommon::execute()
+	{
+		km->compute();
+	}
+
+		
+	BCNoSlip::BCNoSlip(SPLBGK nm):
+		BCLBGKCommon(nm)
+	{}
+		
+	void BCNoSlip::init()
+	{
+
+		unsigned int nC(directionGroupsShifts.getSize());		
+		sortDirections();
+		loadIndicesToACL();
+		
+		for(unsigned int i(1); i<nC; ++i ){
+			if(directionGroupsSizes[i]>0)
+			{
+				auto vGhost(subVE(num->getF()->getEContainer(), i));
+				auto vBulk(subVE(num->getF()->getEContainer(), templ->invertVectors[i]));
+				int directionShift(block.c2i(templ->vectors[i]));
+				acl::VectorOfElements internalInd(acl::generateVEIndex(directionGroupsSizes[i])+
+				                                  directionGroupsShifts[i]);
+				(*(kernels[i]))<<(acl::excerpt(acl::excerpt(vGhost,*indicesACL)=
+					                          acl::excerpt(vBulk,*indicesACL+directionShift),
+				                              internalInd));
+				km->addKernel(kernels[i]);                
+			}
+		}
+		km->setup();
+	}
+
+	BCConstantPressure::BCConstantPressure(SPLBGK nm, const acl::VectorOfElements & p):
+		BCLBGKCommon(nm),
+		pressure(p)
+	{}
+		
+	void BCConstantPressure::init()
+	{
+
+		unsigned int nC(directionGroupsShifts.getSize());		
+		sortDirections();
+		loadIndicesToACL();
+		
+		for(unsigned int i(1); i<nC; ++i ){
+			if(directionGroupsSizes[i]>0)
+			{
+				acl::VectorOfElements vGhost(1);
+				vGhost[0]=num->getF()->getEContainer()[i];
+				auto internalInd(acl::generateVEIndex(directionGroupsSizes[i])+
+				                                  directionGroupsShifts[i]);
+				(*(kernels[i]))<<(acl::excerpt(acl::excerpt(vGhost,*indicesACL)=
+					                          pressure,
+				                              internalInd));
+				km->addKernel(kernels[i]);                
+			}
+		}
+		km->setup();
+	}
+
+	BCConstantVelocity::BCConstantVelocity(SPLBGK nm, const acl::VectorOfElements & v):
+		BCLBGKCommon(nm),
+		velocity(v)
+	{}
+		
+	void BCConstantVelocity::init()
+	{
+
+		unsigned int nC(directionGroupsShifts.getSize());		
+		sortDirections();
+		loadIndicesToACL();
+		
+		for(unsigned int i(1); i<nC; ++i ){
+			if(directionGroupsSizes[i]>0)
+			{
+				auto vGhost(subVE(num->getF()->getEContainer(), i));
+				auto vBulk(subVE(num->getF()->getEContainer(), templ->invertVectors[i]));
+				int directionShift(block.c2i(templ->vectors[i]));
+				acl::VectorOfElements internalInd(acl::generateVEIndex(directionGroupsSizes[i])+
+				                                  directionGroupsShifts[i]);
+				(*(kernels[i]))<<(acl::excerpt(acl::excerpt(vGhost,*indicesACL) =
+					                           acl::excerpt(vBulk,*indicesACL+directionShift) +
+				                               6. * (velocity * templ->vectors[i]),
+				                               internalInd));
+				km->addKernel(kernels[i]);                
+			}
+		}
+		km->setup();
+	}
+
+	BCConstantPressureVelocity::BCConstantPressureVelocity(SPLBGK nm,
+	                                                       const acl::VectorOfElements & p,
+	                                                       const acl::VectorOfElements & v):
+		BCLBGKCommon(nm),
+		pressure(p),
+		velocity(v)
+	{}
+		
+	void BCConstantPressureVelocity::init()
+	{
+
+		unsigned int nC(directionGroupsShifts.getSize());		
+		sortDirections();
+		loadIndicesToACL();
+		
+		for(unsigned int i(1); i<nC; ++i ){
+			if(directionGroupsSizes[i]>0)
+			{
+				auto vGhost(subVE(num->getF()->getEContainer(), i));
+				acl::VectorOfElements internalInd(acl::generateVEIndex(directionGroupsSizes[i])+
+				                                  directionGroupsShifts[i]);
+				(*(kernels[i]))<<(acl::excerpt(acl::excerpt(vGhost,*indicesACL) =
+					                           pressure + 3. * (velocity * templ->vectors[i]),
+				                               internalInd));
+				km->addKernel(kernels[i]);                
+			}
+		}
+		km->setup();
+	}
+		
+		
+	BCNoSlipMap::BCNoSlipMap(SPLBGK nm, 
+	                         SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm)
+	{	
+	}
+
+	BCNoSlipMap::~BCNoSlipMap()
+	{
+	}
+
+
+	void BCNoSlipMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);
+
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		auto & block(fX->getBlock());
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isGhostNode(0) && isComputationNode(i));
+
+			auto vGhost(subVE(fX->getEContainer(), i));
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto vBulk(subVE(num->getF()->getEContainer(), 
+			                                             templ->invertVectors[i]));			                                       
+			vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
+			kk << (acl::assignmentSafe(vGhost, select(vGhost, vBulk, isBoundary, type)));
+		}		
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void BCNoSlipMap::execute()
+	{
+		kernel->compute();
+	}		
+
+	BCVelocityMap::BCVelocityMap(SPLBGK nm, 
+	                             SPPositionFunction v,
+	                             SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),	
+		num(nm),
+		velocity(v)
+	{	
+	}
+
+	BCVelocityMap::BCVelocityMap(SPLBGK nm, 
+	                             SPPositionFunction v,
+	                             SPAbstractDataWithGhostNodes map,
+	                             SPAbstractDataWithGhostNodes computationalDomain):
+		BCondWithMap(map,computationalDomain,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		velocity(v)
+	{	
+	}
+		
+	BCVelocityMap::~BCVelocityMap()
+	{
+	}
+
+
+	void BCVelocityMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		auto & block(fX->getBlock());
+		unsigned int nDim(nD(block));
+		asl::Index2PositionACL i2p(block,type);
+		kk << i2p.initPosition;
+
+		auto coef(generateVEPrivateVariable(1,type));
+		auto rho(generateVEPrivateVariable(1,type));		
+		auto mom(generateVEPrivateVariable(nDim,type));
+
+		kk  << (coef = generateVEConstant(0.)) 
+		    << (rho = generateVEConstant(0.))
+			<< (mom = generateVEConstantN(nDim,0.));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i) );
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto vBulk(subVE(num->getF()->getEContainer(), 
+			                 templ->invertVectors[i]));			                                       
+			vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
+			auto w(templ->quasiparticlesCoefs[i]);
+			kk << (coef += select(generateVEConstant(0.), generateVEConstant(w), isBoundary, type));
+			kk << (rho += select(generateVEConstant(0.), vBulk * w, isBoundary, type));
+		}
+		kk << (rho/=coef);
+		kk << (mom = velocity->value(i2p.position)*rho); 
+		
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isGhostNode(0) && isComputationNode(i) );
+
+			auto vGhost(subVE(fX->getEContainer(), i));
+			kk << (acl::assignmentSafe(vGhost, 
+			                           select(vGhost,
+			                                  rho +  mom * templ->vectors[i] * 3., 
+			                                  isBoundary, 
+			                                  type)));
+		}
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void BCVelocityMap::execute()
+	{
+		kernel->compute();
+	}		
+
+	BCConstantPressureVelocityMap::BCConstantPressureVelocityMap(SPLBGK nm, 
+			          	           acl::VectorOfElements p, 
+	                               SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		pressure(p),
+		velocity(generateVEConstantN(nD(map->getBlock()),0.))
+	{	
+	}
+
+	BCConstantPressureVelocityMap::BCConstantPressureVelocityMap(SPLBGK nm, 
+			          	         acl::VectorOfElements p,
+	                             acl::VectorOfElements v,
+	                             SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		pressure(p),
+		velocity(v)
+	{	
+	}
+		
+	BCConstantPressureVelocityMap::~BCConstantPressureVelocityMap()
+	{
+	}
+
+
+	void BCConstantPressureVelocityMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isGhostNode(0) && isComputationNode(i) );
+			acl::VectorOfElements fEq(1);
+			if (num->getCompressible())
+				acl::copy(pressure  + 
+				          3. * pressure * (velocity * templ->vectors[i]) +
+				          4.5 * pressure * (velocity * templ->vectors[i]) * (velocity * templ->vectors[i]) -
+				          1.5 * pressure * (velocity*velocity),
+				          fEq);
+			else
+				acl::copy(pressure + 
+				          3. * velocity * templ->vectors[i]+
+				          4.5 * (velocity * templ->vectors[i]) * (velocity * templ->vectors[i]) -
+				          1.5 * (velocity*velocity),
+				          fEq);
+			
+			auto vGhost(subVE(fX->getEContainer(), i));
+			kk << (acl::assignmentSafe(vGhost, 
+			                           select(vGhost,
+			                                  fEq, 
+			                                  isBoundary, 
+			                                  type)));
+		}
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void BCConstantPressureVelocityMap::execute()
+	{
+		kernel->compute();
+	}		
+
+
+	BCTransportLimitedDepositionMap::
+		BCTransportLimitedDepositionMap(SPLBGK nm, 
+		                                acl::VectorOfElements p,
+		                                acl::VectorOfElements lF,
+		                                SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),	
+		num(nm),
+		p0(p),
+		limitingFactor(lF)
+	{	
+	}
+		
+	BCTransportLimitedDepositionMap::~BCTransportLimitedDepositionMap()
+	{
+	}
+
+
+	void BCTransportLimitedDepositionMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		auto & block(fX->getBlock());
+		asl::Index2PositionACL i2p(block,type);
+		kk << i2p.initPosition;
+
+		auto coef(generateVEPrivateVariable(1,type));
+		auto rho(generateVEPrivateVariable(1,type));		
+
+		kk  << (coef = generateVEConstant(0.)) 
+		    << (rho = generateVEConstant(0.));
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i) );
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto vBulk(subVE(num->getF()->getEContainer(), 
+			                 templ->invertVectors[i]));			                                       
+			vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
+			auto w(templ->quasiparticlesCoefs[i]);
+			kk << (coef += select(generateVEConstant(0.), generateVEConstant(w), isBoundary, type));
+			kk << (rho += select(generateVEConstant(0.), vBulk * w, isBoundary, type));
+		}
+		
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isGhostNode(0) && isComputationNode(i) );
+
+			auto vGhost(subVE(fX->getEContainer(), i));
+			auto jSubl(rho-(rho-coef*p0)/(1.+coef*limitingFactor));
+			kk << (acl::assignmentSafe(vGhost, 
+			                           select(vGhost,
+			                                  jSubl/coef, 
+			                                  isBoundary, 
+			                                  type)));
+		}
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void BCTransportLimitedDepositionMap::execute()
+	{
+		kernel->compute();
+	}		
+
+	BCKineticsLimitedDepositionMap::
+		BCKineticsLimitedDepositionMap(SPLBGK nm, 
+		                               acl::VectorOfElements p,
+		                               acl::VectorOfElements lF,
+		                               acl::VectorOfElements b,
+		                               SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),	
+		num(nm),
+		p0(p),
+		limitingFactor(lF),
+		beta(b)
+	{	
+	}
+		
+	BCKineticsLimitedDepositionMap::~BCKineticsLimitedDepositionMap()
+	{
+	}
+
+
+	void BCKineticsLimitedDepositionMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(mapTVE->vectorTemplate->vectors.size());
+		auto & block(fX->getBlock());
+		asl::Index2PositionACL i2p(block,type);
+		kk << i2p.initPosition;
+
+		auto coef(generateVEPrivateVariable(1,type));
+		auto rho(generateVEPrivateVariable(1,type));		
+
+		kk  << (coef = generateVEConstant(0.)) 
+		    << (rho = generateVEConstant(0.));
+
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isComputationNode(i) );
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto vBulk(subVE(num->getF()->getEContainer(), 
+			                 templ->invertVectors[i]));			                                       
+			vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
+			auto w(templ->quasiparticlesCoefs[i]);
+			kk << (coef += select(generateVEConstant(0.), generateVEConstant(w), isBoundary, type));
+			kk << (rho += select(generateVEConstant(0.), vBulk * w, isBoundary, type));
+		}
+		
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary = isGhostNode(0) && isComputationNode(i) );
+
+			auto vGhost(subVE(fX->getEContainer(), i));
+			auto jSubl(rho-beta*(rho/coef-p0)/(1.+limitingFactor));
+			kk << (acl::assignmentSafe(vGhost, 
+			                           select(vGhost,
+			                                  jSubl/coef, 
+			                                  isBoundary, 
+			                                  type)));
+		}
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((map->getEContainer() <= 0 && 
+		                             map->getEContainer() > -.9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void BCKineticsLimitedDepositionMap::execute()
+	{
+		kernel->compute();
+	}		
+
+	ComputeSurfaceFluxMap::ComputeSurfaceFluxMap(SPLBGK nm,
+	                                                 SPDataWithGhostNodesACLData fF,
+			                                         SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		fluxField(fF)		
+	{	
+	}
+
+	ComputeSurfaceFluxMap::~ComputeSurfaceFluxMap()
+	{
+	}
+
+
+	void ComputeSurfaceFluxMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary0(generateVEPrivateVariable(1,typeI));
+		auto isBoundaryI(generateVEPrivateVariable(1,typeI));
+
+		auto flux(generateVEPrivateVariable(1,type));
+		
+		unsigned int nDir(templ->vectors.size());
+		auto & block(fX->getBlock());
+
+		kk<< (flux = acl::generateVEConstant(0));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary0 = isGhostNode(0) && isComputationNode(i) );
+			kk << (isBoundaryI = isGhostNode(i) && isComputationNode(0) );
+			
+			auto f0(subVE(fX->getEContainer(), i));
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto fI(subVE(num->getF()->getEContainer(), 
+			              templ->invertVectors[i]));
+			fI[0] = acl::generateShiftedElement(fI[0],directionShift);
+			
+			kk << (flux += select((f0-fI)*templ->quasiparticlesCoefs[i], isBoundary0, type));
+			kk << (flux += select((fI-f0)*templ->quasiparticlesCoefs[i], isBoundaryI, type));
+		}
+
+		kk << (acl::assignmentSafe(fluxField->getEContainer(),flux));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((fabs(map->getEContainer()) < .9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void ComputeSurfaceFluxMap::execute()
+	{
+		kernel->compute();
+	}		
+	ComputeSurfaceForceMap::ComputeSurfaceForceMap(SPLBGK nm,
+	                                                 SPDataWithGhostNodesACLData fF,
+			                                         SPAbstractDataWithGhostNodes map):
+		BCondWithMap(map,nm->vectorTemplate),
+//		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+		kernel(new acl::Kernel(acl::KERNEL_BASIC)),
+		num(nm),
+		forceField(fF)		
+	{	
+	}
+
+	ComputeSurfaceForceMap::~ComputeSurfaceForceMap()
+	{
+	}
+
+
+	void ComputeSurfaceForceMap::init()
+	{		
+		acl::ExpressionContainer kk;
+
+		auto fX(generateDCFullSafe(num->getF()));
+
+		initMapInfrastructure(kk);	
+		acl::TypeID type(getElementType(num->getF()->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+
+		auto isBoundary0(generateVEPrivateVariable(1,typeI));
+		auto isBoundaryI(generateVEPrivateVariable(1,typeI));
+
+		unsigned int nDir(templ->vectors.size());
+		auto & block(fX->getBlock());
+		unsigned int nDim(nD(block));
+
+		
+		auto force(generateVEPrivateVariable(nDim,type));
+		
+
+		kk<< (force = acl::generateVEConstantN(nDim,0));
+		for(unsigned int i(1); i < nDir; ++i)
+		{
+			kk << (isBoundary0 = isGhostNode(0) && isComputationNode(i) );
+			kk << (isBoundaryI = isGhostNode(i) && isComputationNode(0) );
+			
+			auto f0(subVE(fX->getEContainer(), i));
+			int directionShift(block.c2i(templ->vectors[i]));
+			auto fI(subVE(num->getF()->getEContainer(), 
+			              templ->invertVectors[i]));
+			fI[0] = acl::generateShiftedElement(fI[0],directionShift);
+			auto wc((templ->quasiparticlesCoefs[i]*AVec<double>(templ->vectors[i])));
+			kk << (force += select(acl::generateVEConstantN(nDim,0),( f0+fI-2.)*wc, isBoundary0, type));
+			kk << (force += select(acl::generateVEConstantN(nDim,0),(-f0-fI+2.)*wc, isBoundaryI, type));
+		}
+
+		kk << (acl::assignmentSafe(forceField->getEContainer(),force));
+
+		kernel->addExpression(acl::elementOperators::
+		                      ifElse(acl::elementOperators::any((fabs(map->getEContainer()) < .9999)[0]),
+		                             kk.expression, 
+		                             {} ));
+
+		kernel->setup();
+	}
+
+
+	void ComputeSurfaceForceMap::execute()
+	{
+		kernel->compute();
+	}		
+		
+
+	SPBCond generateBCNoSlip(SPLBGK nm, 
+	                         const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCNoSlip>(nm));
+		addSlices(*bc, sl);	
+		return bc;
+		
+	}
+
+	SPBCond generateBCConstantVelocity(SPLBGK nm,
+	                                   AVec<> v,
+	                                   const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantVelocity>(nm, generateVEConstant(v)));
+		addSlices(*bc, sl);	
+		return bc;
+		
+	}
+
+	SPBCond generateBCConstantPressure(SPLBGK nm,
+	                                   double p,
+	                                   const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantPressure>(nm, generateVEConstant(p)));
+		addSlices(*bc, sl);	
+		return bc;
+		
+	}
+
+	SPBCond generateBCConstantPressureVelocity(SPLBGK nm,
+	                                   double p,
+	                                   AVec<> v,
+	                                   const std::vector<SlicesNames> & sl)
+	{
+		auto bc(make_shared<BCConstantPressureVelocity>(nm, 
+		                                                generateVEConstant(p),
+		                                                generateVEConstant(v)));
+		addSlices(*bc, sl);	
+		return bc;		
+	}
+		
+	SPNumMethod generateBCNoSlip(SPLBGK nm, 
+	                             SPAbstractDataWithGhostNodes map)
+	{
+		return make_shared<BCNoSlipMap>(nm,map);
+	}
+
+	SPNumMethod generateBCNoSlipVel(SPLBGK nm, 
+	                                SPAbstractDataWithGhostNodes map)
+	{
+		unsigned int nd(nD(nm->getVelocity()->getBlock()));
+		return generateBCConstantValueMiddlePoint(nm->getVelocity(), 
+		                                          AVec<>(nd,0.), 
+		                                          map,
+		                                          nm->vectorTemplate);
+	}
+
+	SPNumMethod generateBCNoSlipRho(SPLBGK nm, 
+	                                SPAbstractDataWithGhostNodes map)
+	{
+		unsigned int nd(nD(nm->getVelocity()->getBlock()));
+		return generateBCConstantGradient(nm->getRho(), 
+		                                  AVec<>(nd,0.), 
+		                                  map,
+		                                  nm->vectorTemplate);
+	}
+		
+	SPNumMethod generateBCVelocity(SPLBGK nm, 
+	                               SPPositionFunction v, 
+	                               SPAbstractDataWithGhostNodes map)
+	{
+		return make_shared<BCVelocityMap>(nm,v,map);
+	}
+
+	SPNumMethod generateBCVelocity(SPLBGK nm, 
+	                               SPPositionFunction v, 
+	                               SPAbstractDataWithGhostNodes map,
+	                               SPAbstractDataWithGhostNodes computationalDomain)
+	{
+		return make_shared<BCVelocityMap>(nm,v,map,computationalDomain);
+	}
+		
+	SPNumMethod generateBCVelocityVel(SPLBGK nm, 
+	                                  SPPositionFunction v, 
+	                                  SPAbstractDataWithGhostNodes map)
+	{
+		return generateBCConstantValue(nm->getVelocity(), v, map);
+	}
+		
+	SPNumMethod generateBCConstantPressure(SPLBGK nm,
+	                                   double p,
+	                                   SPAbstractDataWithGhostNodes map)
+	{
+		auto bc(make_shared<BCConstantPressureVelocityMap>(nm, generateVEConstant(p), map));
+		return bc;
+		
+	}
+
+	SPNumMethod generateBCConstantPressureVelocity(SPLBGK nm,
+	                                   double p,
+	                                   AVec<> v,
+	                                   SPAbstractDataWithGhostNodes map)
+	{
+		auto bc(make_shared<BCConstantPressureVelocityMap>(nm, 
+		                                                   generateVEConstant(p),
+		                                                   generateVEConstant(v),
+		                                                   map));
+		return bc;		
+	}
+
+	SPNumMethod generateBCTransportLimitedDeposition(SPLBGK nm, 
+	                                                 double p0,
+	                                                 double limitingFactor,            
+	                                                 SPAbstractDataWithGhostNodes map)	
+	{
+		auto bc(make_shared<BCTransportLimitedDepositionMap>(nm, 
+		                                                   generateVEConstant(p0),
+		                                                   generateVEConstant(limitingFactor),
+		                                                   map));
+		return bc;		
+	}
+
+	SPNumMethod generateBCKineticsLimitedDeposition(SPLBGK nm, 
+	                                                double p0,
+	                                                double limitingFactor,            
+	                                                double beta,
+	                                                SPAbstractDataWithGhostNodes map)	
+	{
+		auto bc(make_shared<BCKineticsLimitedDepositionMap>(nm,  
+		                                                    generateVEConstant(p0),
+		                                                    generateVEConstant(limitingFactor),
+		                                                    generateVEConstant(beta),
+		                                                    map));
+		return bc;		
+	}
+
+		
+	SPNumMethod generateComputeSurfaceFlux(SPLBGK nm, 
+	                                       SPDataWithGhostNodesACLData fF, 
+	                                       SPAbstractDataWithGhostNodes map)
+	{
+		auto a(make_shared<ComputeSurfaceFluxMap>(nm, fF, map));
+		return a;
+	}
+
+	SPNumMethod generateComputeSurfaceForce(SPLBGK nm, 
+	                                       SPDataWithGhostNodesACLData fF, 
+	                                       SPAbstractDataWithGhostNodes map)
+	{
+		auto a(make_shared<ComputeSurfaceForceMap>(nm, fF, map));
+		return a;
+	}
+		
+		
+} // asl
+
diff --git a/src/num/aslLBGKBC.h b/src/num/aslLBGKBC.h
new file mode 100644
index 0000000..d1c76ac
--- /dev/null
+++ b/src/num/aslLBGKBC.h
@@ -0,0 +1,340 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLBGKBC_H
+#define ASLLBGKBC_H
+
+#include "aslBCond.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+namespace acl{
+	class Kernel;
+	typedef std::shared_ptr<acl::Kernel> SPKernel;
+	class KernelMerger; 
+	typedef std::shared_ptr<acl::KernelMerger> SPKernelMerger;
+}
+
+namespace asl
+{
+	class LBGK;
+	typedef std::shared_ptr<LBGK> SPLBGK;
+	class PositionFunction;
+	typedef std::shared_ptr<PositionFunction> SPPositionFunction;
+
+
+	class BCLBGKCommon:public BCond
+	{
+		protected:
+			SPLBGK num;
+			std::vector<acl::SPKernel> kernels;
+			acl::SPKernelMerger km;
+
+			AVec<int> directionGroupsShifts;
+			AVec<int> directionGroupsSizes;
+
+			void sortDirections();
+		public:
+			BCLBGKCommon(SPLBGK nm);
+			virtual void execute();			
+	};
+	
+	/// Bondary condition corresponding to a rigid wall (\f$ \vec u=0\f$)
+	/**	 
+		 \ingroup TransportProcessesBC
+		 The class realizes simple bounce back boundary conditions  
+		 \f[ \vec v =0,\; \nabla P = 0 \f]
+	*/
+	class BCNoSlip: public BCLBGKCommon
+	{		
+		public:
+			BCNoSlip(SPLBGK nm);
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding an in- or outflow boundary conditions with a given pressure
+	/**	 
+		 \ingroup TransportProcessesBC
+		 \f[ \vec v =0,\; P = Const \f]		 
+	*/
+	class BCConstantPressure: public BCLBGKCommon
+	{		
+		protected:
+			acl::VectorOfElements pressure;
+		public:
+			BCConstantPressure(SPLBGK nm, const acl::VectorOfElements & p);
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding wall with given velocity for uncompressible
+	/**	 
+		 \ingroup TransportProcessesBC
+		 velocity value is valid for both tagential and normal components.
+ 		 \f[ \vec v =\vec v_0,\; \nabla P = 0 \f]		 
+
+		 \f[
+		    f^{ghost}_i = f^{bulk}_{\tilde i} + 2 \frac{\vec v \dot c_i}{c^2_s}
+		 \f]
+
+	*/
+	class BCConstantVelocity: public BCLBGKCommon
+	{	
+		protected:
+			acl::VectorOfElements velocity;
+		public:
+			BCConstantVelocity(SPLBGK nm, const acl::VectorOfElements & v);
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding wall with given velocity for uncompressible
+	/**	 
+		 \ingroup TransportProcessesBC
+
+		 velocity value is valid for both tagential and normal components.
+ 		 \f[ \vec v =\vec v_0,\; \nabla P = P_0 \f]		 
+
+	*/
+	class BCConstantPressureVelocity: public BCLBGKCommon
+	{	
+		protected:
+			acl::VectorOfElements pressure;
+			acl::VectorOfElements velocity;
+		public:
+			BCConstantPressureVelocity(SPLBGK nm,
+			                           const acl::VectorOfElements & p,
+			                           const acl::VectorOfElements & v);
+			virtual void init();			
+	};
+
+	/// Bondary condition corresponding to a rigid wall (\f$ \vec u=0\f$)
+	/**
+		\f[ \vec v =0,\; \nabla P = 0 \f] 
+	*/
+
+	class BCNoSlipMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+		public:
+			BCNoSlipMap(SPLBGK nm, SPAbstractDataWithGhostNodes map);
+			~BCNoSlipMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	///
+	/**
+		 \ingroup TransportProcessesBC
+	 */
+	class BCVelocityMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			SPPositionFunction velocity;
+			
+		public:
+			BCVelocityMap(SPLBGK nm, 
+			              SPPositionFunction v, 
+			              SPAbstractDataWithGhostNodes map);
+			BCVelocityMap(SPLBGK nm, 
+			              SPPositionFunction v, 
+			              SPAbstractDataWithGhostNodes map,
+			              SPAbstractDataWithGhostNodes computationalDomain);
+			~BCVelocityMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/**
+		\ingroup TransportProcessesBC
+	 */	 
+	class BCConstantPressureVelocityMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			acl::VectorOfElements pressure;
+			acl::VectorOfElements velocity;
+		public:
+			BCConstantPressureVelocityMap(SPLBGK nm, 
+			          	          acl::VectorOfElements p, 
+			                      SPAbstractDataWithGhostNodes map);
+			BCConstantPressureVelocityMap(SPLBGK nm, 
+			          	          acl::VectorOfElements p,
+			                      acl::VectorOfElements v,
+			                      SPAbstractDataWithGhostNodes map);
+			~BCConstantPressureVelocityMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Set outflux corresponding to transport limitation of the deposition rate
+	/**
+		 \ingroup TransportProcessesBC
+		 
+		 \f[ J_{dep}−J_{subl}=\frac{J_{dep}−P_0\alpha}{1+\alpha F, \f]
+		 where \f$\alpha \equiv \sum_{i\in \Omega} w_i\f$,  \f$ F \f$ is the limiting factor
+
+	*/
+	class BCTransportLimitedDepositionMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			acl::VectorOfElements p0;
+			acl::VectorOfElements limitingFactor;
+		public:
+			BCTransportLimitedDepositionMap(SPLBGK nm, 
+			                                acl::VectorOfElements p,
+			                                acl::VectorOfElements lF,
+			                                SPAbstractDataWithGhostNodes map);
+			~BCTransportLimitedDepositionMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/// Set outflux corresponding to kinetics and transport limitations of the deposition rate
+	/**
+		 \ingroup TransportProcessesBC
+		 \f[ J_{dep}−J_{subl}=\beta\frac{\rho−\rho_0}{1+ F}, \f]
+		 where \f$\alpha \equiv \sum_{i\in \Omega} w_i\f$,  \f$ F \f$ is the limiting factor
+
+	*/
+	class BCKineticsLimitedDepositionMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			acl::VectorOfElements p0;
+			acl::VectorOfElements limitingFactor;
+			acl::VectorOfElements beta;
+		public:
+			BCKineticsLimitedDepositionMap(SPLBGK nm, 
+			                                acl::VectorOfElements p,
+			                                acl::VectorOfElements lF,
+			                                acl::VectorOfElements b,
+			                                SPAbstractDataWithGhostNodes map);
+			~BCKineticsLimitedDepositionMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+	
+	/**
+	 	 \ingroup TransportProcessesBC
+
+	 */
+	class ComputeSurfaceFluxMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			SPDataWithGhostNodesACLData fluxField;
+		public:
+			ComputeSurfaceFluxMap(SPLBGK nm,
+			                        SPDataWithGhostNodesACLData fF,
+			                        SPAbstractDataWithGhostNodes map);
+			~ComputeSurfaceFluxMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	/**
+		 \ingroup TransportProcessesBC
+	 */
+	class ComputeSurfaceForceMap:public BCondWithMap
+	{		
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+			SPLBGK num;
+			SPDataWithGhostNodesACLData forceField;
+		public:
+			ComputeSurfaceForceMap(SPLBGK nm,
+			                        SPDataWithGhostNodesACLData fF,
+			                        SPAbstractDataWithGhostNodes map);
+			~ComputeSurfaceForceMap();			
+			virtual void execute();
+			virtual void init();			
+	};
+
+	///	\f[ \vec v =0,\; \nabla P = 0 \f] \ingroup TransportProcessesBC  
+	SPBCond generateBCNoSlip(SPLBGK nm, const std::vector<SlicesNames> & sl);	
+	///	\f[ \vec v =\vec v_0,\; \nabla P = 0 \f] \ingroup TransportProcessesBC 
+	SPBCond generateBCConstantVelocity(SPLBGK nm, AVec<> v, const std::vector<SlicesNames> & sl);	
+	///	\f[ \vec v =0,\; P = Const \f] \ingroup TransportProcessesBC 
+	SPBCond generateBCConstantPressure(SPLBGK nm, double p, const std::vector<SlicesNames> & sl);	
+	///	\f[ \vec v =\vec v_0,\; P = P_0 \f] \ingroup TransportProcessesBC
+	SPBCond generateBCConstantPressureVelocity(SPLBGK nm, 
+	                                   double p,
+	                                   AVec<> v,
+	                                   const std::vector<SlicesNames> & sl);	
+	///	\f[ \vec v = 0,\; P = Const \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCConstantPressure(SPLBGK nm, double p, SPAbstractDataWithGhostNodes map);	
+	///	\f[ \vec v =\vec v_0,\; P = P_0 \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCConstantPressureVelocity(SPLBGK nm, 
+	                                               double p,
+	                                               AVec<> v,            
+	                                               SPAbstractDataWithGhostNodes map);	
+	///	\f[ \vec v =0,\; \nabla P = 0 \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCNoSlip(SPLBGK nm, SPAbstractDataWithGhostNodes map);
+	///	\f[ \vec v =0 \f] for velocity field \ingroup TransportProcessesBC 
+	SPNumMethod generateBCNoSlipVel(SPLBGK nmU, SPAbstractDataWithGhostNodes map);
+	///	\f[ \nabla P = 0 \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCNoSlipRho(SPLBGK nmU, SPAbstractDataWithGhostNodes map);
+	///	\f[ \vec v =\vec v_0,\; \nabla P = 0 \f]  \ingroup TransportProcessesBC 
+	SPNumMethod generateBCVelocity(SPLBGK nm, 
+	                               SPPositionFunction v, 
+	                               SPAbstractDataWithGhostNodes map);	
+	///	\f[ \vec v =\vec v_0,\; \nabla P = 0 \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCVelocity(SPLBGK nm, 
+	                               SPPositionFunction v, 
+	                               SPAbstractDataWithGhostNodes map,
+	                               SPAbstractDataWithGhostNodes computationalDomain);	
+	///	\f[ \vec v =\vec v_0,\; \nabla P = 0 \f] \ingroup TransportProcessesBC 
+	SPNumMethod generateBCVelocityVel(SPLBGK nm, 
+	                                  SPPositionFunction v, 
+	                                  SPAbstractDataWithGhostNodes map);
+	///	\ingroup TransportProcessesBC 
+	SPNumMethod generateBCTransportLimitedDeposition(SPLBGK nm, 
+	                                                 double p0,
+	                                                 double limitingFactor,            
+	                                                 SPAbstractDataWithGhostNodes map);	
+	///	\ingroup TransportProcessesBC 
+	SPNumMethod generateBCKineticsLimitedDeposition(SPLBGK nm, 
+	                                                double beta,
+	                                                double p0,
+	                                                double limitingFactor,            
+	                                                SPAbstractDataWithGhostNodes map);	
+	///	\ingroup TransportProcessesBC 
+	SPNumMethod generateComputeSurfaceFlux(SPLBGK nm, 
+	                                       SPDataWithGhostNodesACLData fF, 
+	                                       SPAbstractDataWithGhostNodes map);	
+
+	///	\ingroup TransportProcessesBC 
+	SPNumMethod generateComputeSurfaceForce(SPLBGK nm, 
+	                                       SPDataWithGhostNodesACLData fF, 
+	                                       SPAbstractDataWithGhostNodes map);	
+	
+} //asl
+
+#endif //ASLBGKBC_H
diff --git a/src/num/aslLSFacetedGrowth.cxx b/src/num/aslLSFacetedGrowth.cxx
new file mode 100644
index 0000000..4ba6ef9
--- /dev/null
+++ b/src/num/aslLSFacetedGrowth.cxx
@@ -0,0 +1,284 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLSFacetedGrowth.h"
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclMath/aclBarycentric.h"
+#include "acl/aclMath/aclMathAlg.h"
+#include <algorithm>
+#include <math/aslTemplates.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplatesExtras.h>
+#include <math/aslTemplateVEExtras.h>
+#include <math/aslDistanceFunction.h>
+
+#include <writers/aslWriter.h>
+
+namespace asl
+{
+
+	using acl::VectorOfElements;
+	using acl::generateVEConstant;
+	using acl::generateVEConstantN;
+	
+	inline bool isIn(int i, AVec<int> a)
+	{
+		bool b(false);
+		for(unsigned int j(0); j < a.getSize(); ++j )
+			b|=(a[j]==i);
+		return b;
+	}
+
+	CrystallographicParameters::CrystallographicParameters (const vector<AVec<>> & dir, 
+		                                                  const vector<double> & bSt,
+		                                                  const vector<double> & bDisl,
+		                                                  const double bRough):
+		directions(dir),
+		betaSt(bSt),
+		betaDisl(bDisl),
+		betaRough(bRough)
+	{
+	}
+		
+	CrystallographicParameters::CrystallographicParameters (const double bRough):
+		betaRough(bRough)
+	{
+	}
+		
+	CrystallographicParameters::CrystallographicParameters (){}
+	
+
+	void CrystallographicParameters::directionCode(VectorOfElements normal,
+		                                           VectorOfElements direction,
+	                                               VectorOfElements cosTheta,
+		                                           acl::ExpressionContainer & k)
+	{
+		findNearestDirectionCode(directions, normal, direction, cosTheta, k);
+	}
+
+	void CrystallographicParameters::addFacet(const AVec<> normal, double bSt, double bDisl)
+	{
+		directions.push_back(normal);
+		betaSt.push_back(bSt);
+		betaDisl.push_back(bDisl);		
+	}
+	
+
+	void CrystallographicParameters::init(acl::TypeID type)
+	{
+		copy(acl::generateVEPrivateArray(directions, type), directionsACL);
+		copy(acl::generateVEPrivateArray(betaSt, type), betaStACL);
+		copy(acl::generateVEPrivateArray(betaDisl, type), betaDislACL);	
+	}
+
+	acl::VectorOfElements 
+			CrystallographicParameters::velocity(acl::VectorOfElements supersaturation, 
+		                                         acl::VectorOfElements dir,
+	                                             acl::VectorOfElements sinTheta)
+	{
+		acl::TypeID type(getElementType(supersaturation));
+
+		auto bSt(acl::excerpt(betaStACL,dir));
+		auto bDisl(acl::excerpt(betaDislACL,dir));
+		auto bR(generateVEConstant(betaRough));
+		return supersaturation*acl::min(bR, 
+		                                acl::max(sinTheta * bSt,
+		                                         supersaturation*bDisl,
+		                                         type),
+		                                type);
+	}
+
+	acl::VectorOfElements 
+			CrystallographicParameters::velocity(const acl::VectorOfElements & supersaturation, 
+		                                         const acl::VectorOfElements & dir,
+	                                             const acl::VectorOfElements & sinTheta,
+			                                     const acl::VectorOfElements & stepVelocityLimit)
+	{
+		acl::TypeID type(getElementType(supersaturation));
+
+		auto vSt(supersaturation*acl::excerpt(betaStACL,dir)*sinTheta);
+		auto vDisl(supersaturation*supersaturation*acl::excerpt(betaDislACL,dir));
+		auto vR(supersaturation*generateVEConstant(betaRough));
+		return acl::min(vR, acl::max(min(vSt, sign(stepVelocityLimit), type), vDisl, type), type);
+	}
+
+		
+	VectorOfElements 
+			CrystallographicParameters::stepFactor(const VectorOfElements & dir,
+			                                       const VectorOfElements & position)
+	{
+		auto dirVec(acl::excerpt(directionsACL,dir));
+		return dirVec*position;
+	}
+
+		
+	
+	LSFacetedGrowth::~LSFacetedGrowth()
+	{}
+		
+	LSFacetedGrowth::LSFacetedGrowth()
+	{
+	}
+	
+	LSFacetedGrowth::LSFacetedGrowth(Data df, DataGen c):
+		LevelSetLinear(df),
+		superSaturation(c)
+	{		
+		// this line is necessery since the kernel is initialized in a perent class by KERNEL_SIMDUA 
+		kernel.reset(new acl::Kernel(acl::KERNEL_BASIC)); 
+	}	
+		
+	void LSFacetedGrowth::initVelocityComputation()
+	{
+		acl::ExpressionContainer kk;
+//		auto & kk(*kernel);
+		acl::TypeID type(getElementType(distanceField->getEContainer()));
+		acl::TypeID typeI(acl::TYPE_SELECT[type]);
+		unsigned int nd(nD(*vectorTemplate));		
+		unsigned int nv(vectorTemplate->vectors.size());
+		//number of crystallographyc directions
+		unsigned int ncd(crystallography.directions.size());
+
+		crystallography.init(type);
+		
+		TemplateVE sSatT(*superSaturation, *vectorTemplate);
+		kk << sSatT.initValues;
+
+
+		auto isBoundary(generateVEPrivateVariable(1,typeI));
+		auto normal(generateVEPrivateVariable(nd,type));
+		auto velC(generateVEPrivateVariable(1,type));
+		auto counter(generateVEPrivateVariable(1, type));
+		auto sSatNode(generateVEPrivateVariable(1, type));
+		
+		auto vto(distanceTVE->vto);
+		unsigned int nCells(vto->elementaryCells.size());
+
+		vector<int> vectorInit(ncd,0);
+		auto directionsN(generateVEPrivateArray(vectorInit,typeI));
+		auto velocitiesN(generateVEPrivateArray(vectorInit,type));		
+		
+		vector<acl::VectorOfElements> normalC;
+		kk << gcGradientAllCells(*distanceTVE,  normalC);
+		vector<acl::VectorOfElements> directionC(nCells);
+		vector<acl::VectorOfElements> thetaC(nCells);
+		vector<acl::VectorOfElements> stepFactorC(nCells);
+		for(unsigned int j(0); j < nCells; ++j)
+		{
+			kk << gcNormalize(normalC[j]);
+			copy(generateVEPrivateVariable(1,typeI), directionC[j]);
+			copy(generateVEPrivateVariable(1,type), thetaC[j]);
+			crystallography.directionCode(normalC[j], directionC[j], thetaC[j], kk);
+			kk << (thetaC[j] = sqrt(fabs(1.- thetaC[j]*thetaC[j])));
+
+			copy(generateVEPrivateVariable(1,type), stepFactorC[j]);
+			kk<< (stepFactorC[j] = crystallography.stepFactor(directionC[j],
+			                                                  getBoundaryCenter(j)));
+		}
+
+		kk << (counter = generateVEConstant(0.));
+		lVelocities.resize(nv);
+		copy(generateVEPrivateVariable(nd,type), lVelocities[0]);
+		kk << (lVelocities[0] = generateVEConstantN(nd,0.));
+		
+		for(unsigned int i(1); i < nv; ++i)
+		{
+			copy(generateVEPrivateVariable(nd,type), lVelocities[i]);
+			kk << (normal = generateVEConstantN(nd,0.));
+
+			kk << (sSatNode = getValueOnBoundary(sSatT.values, i));
+			for(unsigned int j(0); j < nCells; ++j)
+				if(isIn(i, vto->elementaryCells[j]))
+				{
+					kk << (velC = crystallography.velocity(sSatNode, 
+					                                       directionC[j], 
+					                                       thetaC[j],
+					                                       stepFactorC[j] - 
+					                                       crystallography.stepFactor(directionC[j], 
+					                                                                  getBoundaryPoint(i))));
+					auto velL(excerpt(velocitiesN,directionC[j]));
+					auto dirL(excerpt(directionsN,directionC[j]));
+					kk << (velL = select(velC, max(velL, velC), dirL));
+					kk << (dirL = generateVEConstant(1));
+				}
+			kk << (normalC[0] =	generateVEConstantN(nd,0));
+			for(unsigned int j(0); j < ncd; ++j)
+			{
+				auto ind(generateVEConstant(j));
+				kk << (normalC[0] += select(generateVEConstantN(nd,0),
+				                         generateVEConstant(crystallography.directions[j]),
+				                         excerpt(directionsN,ind), 
+				                         type)); 
+			}
+			kk << (thetaC[0] = max(sqrt(l2(normalC[0])), 
+			                       generateVEConstant(0.1), 
+			                       type));
+			kk << (normalC[0] = normalC[0] / thetaC[0]);
+			//.5 is a large value
+			kk << (velC = generateVEConstant(.5));
+			for(unsigned int j(0); j < ncd; ++j)
+			{
+				auto ind(generateVEConstant(j));
+				auto dirVec(generateVEConstant(crystallography.directions[j]));
+				auto velL(excerpt(velocitiesN,ind));
+				auto dirL(excerpt(directionsN,ind));
+				kk << (velC = select(velC,
+				                     min (velC, 
+				                          velL /*/ max((normalC[0] * dirVec ),
+				                                     generateVEConstant(0.01),
+				                                     type)*/, 
+				                          type),
+				                     dirL,
+				                     type));
+			}
+
+			kk << (isBoundary = isBoundaryDir(i));
+			
+			kk << (lVelocities[i] = select(acl::generateVEConstantN(nd,0.),
+			                               normalC[0] * velC ,
+			                               isBoundary,
+			                               type));
+			kk << (counter += select(generateVEConstant(0.), 
+			                         generateVEConstant(1.),
+			                         isBoundary,
+			                         type)); 
+			kk << (lVelocities[0] += lVelocities[i]);
+		}   
+		kk << (counter = max(counter, generateVEConstant(1.), type));
+		kk << (lVelocities[0] = lVelocities[0] / counter );
+
+		kernel->addExpression(acl::elementOperators::
+			                      ifElse(acl::differentSign(distanceTVE->values)[0],
+		                                 kk.expression, {} ));
+		Writer::current->addVector("vel", lVelocities[0], *kernel);		
+	}
+} // asl
+
diff --git a/src/num/aslLSFacetedGrowth.h b/src/num/aslLSFacetedGrowth.h
new file mode 100644
index 0000000..e0f3d59
--- /dev/null
+++ b/src/num/aslLSFacetedGrowth.h
@@ -0,0 +1,117 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLSFACETEDGROWTH_H
+#define ASLLSFACETEDGROWTH_H
+
+#include "aslLevelSetLinear.h"
+#include <math/aslVectorsDynamicLength.h>
+
+namespace acl
+{
+	class ExpressionContainer;
+}
+
+namespace asl
+{	
+
+	/// describes crystalographyly specific date
+	/**
+	*/
+	class CrystallographicParameters
+	{
+		public:
+			vector<AVec<>> directions;
+			vector<double> betaSt;
+			vector<double> betaDisl;
+			double betaRough;
+		private:
+			acl::VectorOfElements directionsACL;
+			acl::VectorOfElements betaStACL;
+			acl::VectorOfElements betaDislACL;	
+		public:
+
+			/// generates code which resullts the number corresponds to nearest direction
+			void directionCode(acl::VectorOfElements normal,
+				               acl::VectorOfElements direction,
+			                   acl::VectorOfElements cosTheta,
+				               acl::ExpressionContainer & k);
+			CrystallographicParameters (const vector<AVec<>> & dir, 
+				                       const vector<double> & bSt,
+				                       const vector<double> & bDisl,
+				                       const double bRough);
+			CrystallographicParameters (const double bRough);
+			CrystallographicParameters ();
+			acl::VectorOfElements velocity(acl::VectorOfElements supersaturation, 
+				                           acl::VectorOfElements dir,
+			                               acl::VectorOfElements sinTheta);
+			acl::VectorOfElements velocity(const acl::VectorOfElements & supersaturation, 
+				                           const acl::VectorOfElements & dir,
+			                               const acl::VectorOfElements & sinTheta,
+			                               const acl::VectorOfElements & stepVelocityLimit);
+			acl::VectorOfElements stepFactor(const acl::VectorOfElements & dir,
+			                                 const acl::VectorOfElements & position);
+		
+			/// adds new facet information
+			/**
+				 \param normal should be a unit vector
+			*/
+			void addFacet(const AVec<> normal, double bSt, double bDisl);
+			/// initialize acl data
+			void init(acl::TypeID type);
+	};
+
+	
+	/// Numerical method which computes evolution of an interface with a crystalographic kinetics
+	/**
+		 \ingroup InterfaceTracking
+		 \ingroup NumMethods
+		 \ingroup LevelSet		 
+	 */
+	class LSFacetedGrowth: public LevelSetLinear
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPDataWithGhostNodesACL DataGen;
+
+			CrystallographicParameters crystallography;
+		protected:
+			DataGen superSaturation;
+			
+			virtual void initVelocityComputation();
+		public:			
+
+			LSFacetedGrowth();
+			/**
+			 \param d is points position
+			 \param c is super saturation field
+			 */
+			LSFacetedGrowth(Data df, DataGen c);
+			~LSFacetedGrowth();
+	};
+
+	typedef std::shared_ptr<LSFacetedGrowth> SPLSFacetedGrowth;
+	
+} //asl
+
+#endif //ASLLSFACETEDGROWTH_H
diff --git a/src/num/aslLSNormalGrowth.cxx b/src/num/aslLSNormalGrowth.cxx
new file mode 100644
index 0000000..bc21206
--- /dev/null
+++ b/src/num/aslLSNormalGrowth.cxx
@@ -0,0 +1,127 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLSNormalGrowth.h"
+#include <math/aslTemplates.h>
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/acl.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "acl/aclHardware.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclMath/aclBarycentric.h"
+#include <algorithm>
+#include <math/aslTemplates.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplatesExtras.h>
+#include <math/aslTemplateVEExtras.h>
+#include <math/aslDistanceFunction.h>
+
+
+namespace asl
+{
+	using acl::generateVEConstant;
+	using acl::generateVEConstantN;
+
+	LSNormalGrowth::~LSNormalGrowth()
+	{}
+		
+	LSNormalGrowth::LSNormalGrowth()
+	{
+	}
+	
+	LSNormalGrowth::LSNormalGrowth(Data df, DataGen c):
+		LevelSetLinear(df),
+		superSaturation(c)
+	{		
+	}	
+
+	inline bool isIn(int i, AVec<int> a)
+	{
+		bool b(false);
+		for(unsigned int j(0); j < a.getSize(); ++j )
+			b|=(a[j]==i);
+		return b;
+	}
+		
+	void LSNormalGrowth::initVelocityComputation()
+	{
+		auto & kk(*kernel);
+		acl::TypeID type(getElementType(distanceField->getEContainer()));
+		unsigned int nd(nD(*vectorTemplate));		
+		unsigned int nv(vectorTemplate->vectors.size());
+		auto vto(distanceTVE->vto);
+		unsigned int nCells(vto->elementaryCells.size());
+
+
+		TemplateVE sSatT(*superSaturation, *vectorTemplate);
+		kk << sSatT.initValues;
+
+		lVelocities.resize(nv);
+
+		auto isBoundary(generateVEPrivateVariable(1,acl::TYPE_SELECT[type]));
+		auto normal(generateVEPrivateVariable(nd,type));
+//		auto invlen(generateVEPrivateVariable(1,type));
+		auto counter(generateVEPrivateVariable(1, type));
+
+		kk << (counter = generateVEConstant(0.));
+		
+		for(unsigned int i(0); i < nv; ++i)
+		{
+			copy(generateVEPrivateVariable(nd,type), lVelocities[i]);
+			kk << (lVelocities[i] = generateVEConstantN(nd,0.));
+		}
+
+/*		vector<acl::VectorOfElements> normalC;
+		kk << gcGradientAllCells(*distanceTVE,  normalC);
+		for(unsigned int j(0); j < nCells; ++j)
+			kk << gcNormalize(normalC[j]);
+		
+		for(unsigned int i(1); i < nv; ++i)
+		{
+			kk << (normal = generateVEConstantN(nd,0.));
+			for(unsigned int j(0); j < nCells; ++j)
+				if(isIn(i, vto->elementaryCells[j]))
+					kk << (normal += normalC[j]);
+			kk << gcNormalize(normal);
+			
+			kk << (isBoundary = isBoundaryDir(i));
+			
+			kk << (lVelocities[i] = select(generateVEConstantN(nd,0.), 
+			                               normal * getValueOnBoundary(sSatT.values, i),
+			                               isBoundary,
+			                               type));
+			kk << (counter += select(generateVEConstant(0.), 
+			                         generateVEConstant(1.),
+			                         isBoundary,
+			                         type)); 
+			kk << (lVelocities[0] += lVelocities[i]);
+		}
+		kk << (counter = max(counter, generateVEConstant(1.), type));
+		kk << (lVelocities[0] = lVelocities[0] / counter);*/
+	}
+		
+} // asl
+
diff --git a/src/num/aslLSNormalGrowth.h b/src/num/aslLSNormalGrowth.h
new file mode 100644
index 0000000..1f9ff8a
--- /dev/null
+++ b/src/num/aslLSNormalGrowth.h
@@ -0,0 +1,62 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLSNORMALGROWTH_H
+#define ASLLSNORMALGROWTH_H
+
+#include "aslLevelSetLinear.h"
+
+namespace asl
+{	
+	/// Numerical method which computes evolution of an interface
+	/**
+		 \ingroup InterfaceTracking
+		 \ingroup NumMethods
+		 \ingroup LevelSet		 
+	 */
+	class LSNormalGrowth: public LevelSetLinear
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPDataWithGhostNodesACL DataGen;
+			
+		protected:
+			DataGen superSaturation;
+			
+			virtual void initVelocityComputation();
+		public:			
+
+			LSNormalGrowth();
+			/**
+			 \param d is points position
+			 \param c is super saturation field
+			 */
+			LSNormalGrowth(Data df, DataGen c);
+			~LSNormalGrowth();
+	};
+
+	typedef std::shared_ptr<LSNormalGrowth> SPLSNormalGrowth;
+	
+} //asl
+
+#endif //ASLLSNORMALGROWTH_H
diff --git a/src/num/aslLevelSet.cxx b/src/num/aslLevelSet.cxx
new file mode 100644
index 0000000..6f51aac
--- /dev/null
+++ b/src/num/aslLevelSet.cxx
@@ -0,0 +1,230 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLevelSet.h"
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclMathAlg.h"
+#include <algorithm>
+#include <math/aslTemplatesExtras.h>
+#include <math/aslTemplateVE.h>
+
+namespace asl
+{
+
+	LevelSet::~LevelSet()
+	{}
+		
+	LevelSet::LevelSet():
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		distanceField(),
+		distanceFieldInternalData(),
+		vectorTemplate(NULL),
+		vto(NULL)
+	{
+	}
+	
+	LevelSet::LevelSet(Data df):
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		distanceField(df),
+		distanceFieldInternalData(),
+//		vectorTemplate(nearestNeigboursVT(nD(df->getBlock())))
+		vectorTemplate(nearestNeigboursPVT(nD(df->getBlock()))),
+		vto(vtObject(vectorTemplate))
+	{		
+	}	
+
+	void LevelSet::initKernelPropagation()
+	{
+		distanceTVE.reset(new TemplateVE(*distanceField, *vectorTemplate));
+		(*kernel) << distanceTVE->initValues;
+
+		initVelocityComputation();
+		initDistancesComputation();
+			
+		kernel->setup();
+		cout<<"!!!!!!! "<<acl::getKernelPrivateMemSize(*kernel)<<endl;
+		cout<<"!!!!!!! "<<acl::getKernelLocalMemSize(*kernel)<<endl;
+//		cout<<kernel->getKernelSource()<<endl;
+		
+	}
+
+
+	acl::VectorOfElements LevelSet::isBoundaryEl(unsigned int iEl)
+	{
+		unsigned int n(vto->elementaryCells[iEl].getSize());
+		acl::VectorOfElements v(n);
+		for(unsigned int i(0); i < n; ++i)
+			v[i] = distanceTVE->values[vto->elementaryCells[iEl][i]];
+		return acl::differentSign(v);
+	}
+
+	acl::VectorOfElements LevelSet::isBoundaryDir(unsigned int iDir)
+	{
+		return acl::differentSign(cat(subVE(distanceTVE->values,0), 
+		                              subVE(distanceTVE->values,iDir))); 
+	}
+
+	acl::VectorOfElements LevelSet::getBoundaryCenter(unsigned int iEl)
+	{
+		auto cell(vto->elementaryCells[iEl]);
+		auto &dVal(distanceTVE->values);
+		acl::TypeID type(getElementType(dVal));
+		unsigned int n(cell.getSize());
+		vector<AVec<>> cellPoints;
+		vto->getCellPoints(iEl, cellPoints);
+		unsigned int nd(nD(cellPoints[0]));
+		
+		acl::VectorOfElements v(acl::generateVEConstantN(nd,0));
+		acl::VectorOfElements nP(acl::generateVEConstant(0));
+		for(unsigned int i(0); i < n; ++i)
+			for(unsigned int j(i+1); j < n; ++j)
+			{
+				auto di(subVE(dVal, cell[i]));
+				auto dj(subVE(dVal, cell[j]));
+
+				auto isB(acl::differentSign(cat(di, dj)));
+				auto x(di / (di - dj));
+				auto pi(acl::generateVEConstant(cellPoints[i]));
+				auto pj(acl::generateVEConstant(cellPoints[j]));
+
+				auto p(select(acl::generateVEConstantN(nd,0), 
+				              pi + (pj - pi) * x, 
+				              isB,
+				              type));
+				copy(v + p, v);
+				copy(nP +select(acl::generateVEConstant(0), 
+				               acl::generateVEConstant(1), 
+				               isB,
+				               type),nP);
+				
+			}
+		return v/nP;
+	}
+
+	vector<acl::Element> LevelSet::gcBoundaryArea(unsigned int iEl, 
+	                                              acl::VectorOfElements & center,
+	                                              acl::VectorOfElements & area)
+	{
+		auto cell(vto->elementaryCells[iEl]);
+		auto &dVal(distanceTVE->values);
+		acl::TypeID type(getElementType(dVal));
+		unsigned int n(cell.getSize());
+		vector<AVec<>> cellPoints;
+		vto->getCellPoints(iEl, cellPoints);
+//		unsigned int nd(nD(cellPoints[0]));
+
+		vector<acl::Element> code(0);
+		code.push_back((area = acl::generateVEConstant(0.))[0]);
+		auto aij(acl::generateVEPrivateVariable(1u, type));
+		auto aik(acl::generateVEPrivateVariable(1u, type));
+		auto ajk(acl::generateVEPrivateVariable(1u, type));
+		
+		acl::VectorOfElements nP(acl::generateVEConstant(0));
+		for(unsigned int i(0); i < n-2; ++i)
+			for(unsigned int j(i+1); j < n-1; ++j)
+				for(unsigned int k(j+1); k < n; ++k)
+				{
+					auto di(subVE(dVal, cell[i]));
+					auto dj(subVE(dVal, cell[j]));
+					auto dk(subVE(dVal, cell[k]));
+
+					auto isBij(acl::differentSign(cat(di, dj)));
+					auto isBik(acl::differentSign(cat(di, dk)));
+					auto isBjk(acl::differentSign(cat(dj, dk)));
+					auto xij(di / (di - dj));
+					auto xik(di / (di - dk));
+					auto xjk(dj / (dj - dk));
+					auto pi(acl::generateVEConstant(cellPoints[i]));
+					auto pj(acl::generateVEConstant(cellPoints[j]));
+					auto pk(acl::generateVEConstant(cellPoints[k]));
+
+					auto pij(pi + (pj - pi) * xij);
+					auto pik(pi + (pk - pi) * xik);
+					auto pjk(pj + (pk - pj) * xjk);
+					auto nij(crossProduct(pik-center,pjk-center));
+					auto nik(crossProduct(pij-center,pjk-center));
+					auto njk(crossProduct(pij-center,pik-center));
+
+					auto codeij(gcLength2(nij,aij));
+					auto codeik(gcLength2(nij,aik));
+					auto codejk(gcLength2(nij,ajk));
+					code.reserve(code.size()+codeij.size()+codeik.size()+codejk.size());
+					copy(codeij.begin(),codeij.end(),back_inserter(code));
+					copy(codeik.begin(),codeik.end(),back_inserter(code));
+					copy(codejk.begin(),codejk.end(),back_inserter(code));
+					
+					auto res(select(acl::generateVEConstant(0.),
+					                   fabs(select(select(ajk, aik, !isBik), aij, !isBij)),
+					                   isBij || isBik || isBjk, 
+					                   type));
+					code.push_back((area+=res)[0]);
+				}
+		return code;
+	}
+		
+		
+	acl::VectorOfElements LevelSet::getBoundaryPoint(unsigned int iDir)
+	{
+		auto &dVal(distanceTVE->values);
+		
+		auto d0(subVE(dVal, 0));
+		auto di(subVE(dVal, iDir));
+
+		auto x(d0 / (d0 - di));
+		auto pi(acl::generateVEConstant(vectorTemplate->vectors[iDir]));
+		return pi * x;
+	}
+
+		
+	acl::VectorOfElements LevelSet::getValueOnBoundary(acl::VectorOfElements field,
+	                                                   unsigned int i)
+	{
+		auto d0(subVE(distanceTVE->values, 0));
+		auto di(subVE(distanceTVE->values, i));
+		return subVE(field,0) + 
+			(subVE(field,i) - subVE(field,0)) * d0 / (d0 - di);
+	}
+		
+		
+	void LevelSet::init()
+	{
+		distanceFieldInternalData=clone(distanceField);
+		acl::initData(distanceFieldInternalData->getDContainer(),
+		              distanceField->getEContainer());
+
+		initKernelPropagation();		
+	}
+
+	void LevelSet::execute()
+	{
+		kernel->compute();
+		swapBuffers(distanceField->getDContainer(),
+		            distanceFieldInternalData->getDContainer());
+	}
+		
+} // asl
+
diff --git a/src/num/aslLevelSet.h b/src/num/aslLevelSet.h
new file mode 100644
index 0000000..aeaa82d
--- /dev/null
+++ b/src/num/aslLevelSet.h
@@ -0,0 +1,153 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLEVELSET_H
+#define ASLLEVELSET_H
+
+#include "aslNumMethod.h"
+#include "acl/aclMath/aclVectorOfElementsDef.h"
+
+
+namespace acl{
+	class Kernel;
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	class VTObjects;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> 
+		DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> 
+		SPDataWithGhostNodesACLData;
+	typedef DataWithGhostNodes<acl::VectorOfElements> 
+		DataWithGhostNodesACL;
+	typedef std::shared_ptr<DataWithGhostNodesACL> 
+		SPDataWithGhostNodesACL;
+	class TemplateVE;
+	
+	/// Numerical method which computes evolution of an interface
+	/**
+		 \ingroup InterfaceTracking
+		 \ingroup NumMethods
+		 \ingroup LevelSet		 
+	 */
+	class LevelSet: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPDataWithGhostNodesACL DataGen;
+			/// generates expression resulting true if there is a boundary within the element
+			/**
+				 \param iEl element number 
+			*/
+			acl::VectorOfElements isBoundaryEl(unsigned int iEl);
+
+			/// generates expression resulting true if there is a boundary in this direction
+			/**
+				 \param iDir direction number 
+			*/
+			acl::VectorOfElements isBoundaryDir(unsigned int iDir);
+			
+			/// generates expression resulting the value of the \p field  
+			/**
+				 \param field vector contains values in each direction
+				 \param iDir is the direction
+			*/			
+			acl::VectorOfElements getValueOnBoundary(acl::VectorOfElements field,
+			                                         unsigned int iDir);
+
+			/// generates expression for center of a boundary element
+			/**
+				 \param iEl the element number
+				 computes avarage point of corners of the boundary poligon within the element 
+
+			*/
+			acl::VectorOfElements getBoundaryCenter(unsigned int iEl);
+
+			/// generates expression for area of a boundary element
+			/**
+				 \param iEl the element number
+				 computes area of the corresponding boundary within cell iEl
+			*/
+			vector<acl::Element> gcBoundaryArea(unsigned int iEl, 
+			                                    acl::VectorOfElements & center, 
+			                                    acl::VectorOfElements & area);
+
+			/// generates expression for area of a boundary element
+			/**
+				 computes area of the corresponding boundary within cell iEl
+			*/
+			vector<acl::Element> gcBoundaryArea(acl::VectorOfElements & center, 
+			                                    acl::VectorOfElements & area);			
+			/// computes coordinates of the surface point on the \p iDir vector
+			/**
+				 \param iDir the element number
+
+			*/
+			acl::VectorOfElements getBoundaryPoint(unsigned int iDir);
+			
+		protected:
+			std::unique_ptr<acl::Kernel> kernel;
+
+			Data distanceField;
+			Data distanceFieldInternalData;			
+			
+			const VectorTemplate* vectorTemplate;
+			const VTObjects* vto;
+
+			unique_ptr<TemplateVE> distanceTVE;
+			vector<acl::VectorOfElements> lVelocities;
+			
+			void initKernelPropagation();
+			virtual void initVelocityComputation()=0;
+			virtual void initDistancesComputation()=0;
+
+		public:			
+			LevelSet();
+			/**
+			 \param df is distance field
+			 */
+			LevelSet(Data df);
+			~LevelSet();
+
+			inline const VectorTemplate* getVectorTemplate() const;
+
+			virtual void init();
+			virtual void execute();
+	};
+
+	typedef std::shared_ptr<LevelSet> SPLevelSet;
+
+// --------------------------- Implementation --------------------
+	
+	inline const VectorTemplate* LevelSet::getVectorTemplate() const
+	{
+		return vectorTemplate;
+	}
+	
+} //asl
+
+#endif //ASLLEVELSET_H
diff --git a/src/num/aslLevelSetLinear.cxx b/src/num/aslLevelSetLinear.cxx
new file mode 100644
index 0000000..a483a3f
--- /dev/null
+++ b/src/num/aslLevelSetLinear.cxx
@@ -0,0 +1,202 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslLevelSetLinear.h"
+#include <data/aslDataWithGhostNodes.h>
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclMath/aclBarycentric.h"
+#include "acl/aclMath/aclMathAlg.h"
+#include <math/aslTemplates.h>
+#include <math/aslTemplateVE.h>
+#include <math/aslTemplatesExtras.h>
+#include <math/aslDistanceFunction.h>
+
+
+namespace asl
+{
+
+	LevelSetLinear::~LevelSetLinear()
+	{}
+		
+	LevelSetLinear::LevelSetLinear()
+	{
+	}
+	
+	LevelSetLinear::LevelSetLinear(Data df):
+		LevelSet(df)
+	{		
+	}	
+
+	/// computes gradient and distance for a cell i.
+	/// val is the corresponding template with values
+	/// vel is velocity templates each element contains velocity vector for corresponding node		
+	/// k is kernel working with the data
+	/// grad is the private variable where the corresponding value is stored
+	/// d is the distance (constant of the corresponding lenear function)
+	/// isBoundary set of booleans corresponding to noundary existence in the current cell
+	void computeLinearFunction(unsigned int i, 
+	                           TemplateVE & val, 
+	                           vector<acl::VectorOfElements> & vel,
+                               acl::Kernel & k,
+	                           const acl::VectorOfElements & grad,
+	                           const acl::VectorOfElements & d,
+	                           const acl::VectorOfElements & isBoundary)
+	{
+		typedef acl::VectorOfElements VE;
+		auto vt(val.vectorTemplate);
+		auto vto(vtObject(vt));
+		unsigned int nv(vto->elementaryCells[0].getSize());
+		VE lval(nv);
+		vector<VE> lpoints(nv);
+		static acl::Barycentric bac;
+		                
+		for(unsigned int ii(0); ii < nv; ++ii)
+		{
+			unsigned int j(vto->elementaryCells[i][ii]);
+			lval[ii]=val.values[j];
+			copy(vel[j]+vt->vectors[j], lpoints[ii]);
+		}
+
+		bac.init(lpoints);
+		k<<bac.initTInv;	
+		k<<(grad = bac.gradient(lval));
+		k<<(d = bac.interpolate(acl::generateVEConstant(vt->vectors[0]), lval));
+		k<<(isBoundary = 
+		    acl::differentSign(lval) &&
+		    bac.in(-d*grad/l2(grad)));
+		k<<(d = select(10.*sign(subVE(val.values,0)),
+		               d*rsqrt(l2(grad)),
+		               isBoundary,
+		               getElementType(val.values)));
+	}
+
+	/// This function compute new value of the distance function for the zerow node of the template
+	/// i is the number of vector (direction)
+	/// val i is the corresponding template with values
+	/// vel is the corresponding velocity vector template x y and z components
+			
+	void computeLinearDistance(unsigned int i, 
+	                           TemplateVE & val, 
+	                           vector<acl::VectorOfElements> & vel,
+                               acl::Kernel & k,
+	                           const acl::VectorOfElements & pd,
+	                           const acl::VectorOfElements & d,
+	                           const acl::VectorOfElements & isBoundary)
+	{
+		typedef acl::VectorOfElements VE;
+		auto vt(val.vectorTemplate);
+		vector<VE> lval(2);
+		vector<VE> lpoints(2);
+		                
+		copy(subVE(val.values, 0), lval[0]);
+		copy(vel[0], lpoints[0]);
+		copy(subVE(val.values, i), lval[1]);
+		copy(vel[i]+vt->vectors[i], lpoints[1]);
+
+		k<<(pd = lval[0]/(lval[0]-lval[1])*(lpoints[1]-lpoints[0])+lpoints[0]);
+		k<<(isBoundary = acl::differentSign(acl::cat(lval[0], lval[1])));
+		k<<(d = select(10.*sign(lval[0]),
+		               sqrt(l2(pd))*sign(lval[0])*sign(pd*vt->vectors[i]),
+		               isBoundary,
+		               getElementType(val.values)));
+		
+	}
+		
+	void LevelSetLinear::initDistancesComputation()
+	{
+		auto & kk(*kernel);
+		acl::TypeID type(getElementType(distanceField->getEContainer()));
+		unsigned int nd(nD(*vectorTemplate));
+		auto vto(vtObject(vectorTemplate));
+
+		auto newDistance(generateVEPrivateVariable(1,type));
+		auto newDistanceCounter(generateVEPrivateVariable(1,type));
+		auto newDistanceD(generateVEPrivateVariable(1,type));
+		auto newDistanceDCounter(generateVEPrivateVariable(1,type));
+		auto grad(generateVEPrivateVariable(nd,type));
+		auto d(generateVEPrivateVariable(1,type));
+		auto isBoundary(generateVEPrivateVariable(1,acl::TYPE_SELECT[type]));
+		
+		kk << (newDistance = acl::generateVEConstant(0.));//large number
+		kk << (newDistanceCounter = acl::generateVEConstant(0.));//large number
+
+/*		for(unsigned int i(0); i < vto->elementaryCells.size(); ++i)
+		{
+			computeLinearFunction(i, *distanceTVE, lVelocities, kk, grad, d, isBoundary);
+//			kk << (newDistance = minAbs(newDistance, d));
+			kk << (newDistance += select(acl::generateVEConstant(0.),
+			                             d, 
+			                             fabs(d) < 5.,
+			                             type));
+			kk << (newDistanceCounter += select(acl::generateVEConstant(0.), 
+			                                    acl::generateVEConstant(1.), 
+			                                    fabs(d) < 5.,
+			                                    type));
+		}*/
+		kk << (newDistanceD = acl::generateVEConstant(0.));//large number
+		kk << (newDistanceDCounter = acl::generateVEConstant(0.));//large number
+
+		for(unsigned int i(1); i < vectorTemplate->vectors.size(); ++i)
+		{
+			computeLinearDistance(i, *distanceTVE, lVelocities, kk, grad, d, isBoundary);
+			kk << (newDistanceD = select(acl::generateVEConstant(0.),
+			                             d, 
+			                             fabs(d) < 5.,
+			                             type));
+			kk << (newDistanceDCounter += select(acl::generateVEConstant(0.), 
+			                                    acl::generateVEConstant(1.), 
+			                                    fabs(d) < 5.,
+			                                    type));
+		}
+		kk << (newDistance = select(newDistanceD/max(newDistanceDCounter,
+		                                             acl::generateVEConstant(.1),
+		                                             type),
+		                            newDistance/newDistanceCounter,
+		                            newDistanceCounter > .1,
+		                            type));// / 
+		                     //DistFNormalization::scaleFactor);
+		kk << (newDistance = select(newDistance/DistFNormalization::scaleFactor,
+		                          newDistance/(1. - newDistance),
+		                          newDistance*subVE(distanceTVE->values, 0) < 0));
+		
+//		kk << assignmentSafe (distanceFieldInternalData->getSubContainer(),  
+//	               		                         select( newDistance, 
+//			                                               sign(newDistance), 
+//			                                               fabs(newDistance) > 1., 
+//			                                               type));
+		kk << assignmentSafe (distanceFieldInternalData->getSubContainer(),  
+	               		                         select( newDistance, 
+			                                             sign(subVE(distanceTVE->values,0)), 
+			                                             newDistanceCounter + newDistanceDCounter < .1, 
+			                                             type));
+		
+	}
+				
+} // asl
+
diff --git a/src/num/aslLevelSetLinear.h b/src/num/aslLevelSetLinear.h
new file mode 100644
index 0000000..3821ff8
--- /dev/null
+++ b/src/num/aslLevelSetLinear.h
@@ -0,0 +1,62 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLLEVELSETLINEAR_H
+#define ASLLEVELSETLINEAR_H
+
+#include "aslLevelSet.h"
+
+
+namespace asl
+{
+	
+	/// Numerical method which computes evolution of an interface
+	/**
+		 \ingroup InterfaceTracking
+		 \ingroup NumMethods
+		 \ingroup LevelSet
+		 		 
+	 */
+	class LevelSetLinear: public LevelSet
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPDataWithGhostNodesACL DataGen;
+			
+		protected:
+			virtual void initDistancesComputation();
+		public:			
+
+			LevelSetLinear();
+			/**
+			 \param df is distance field
+			 */
+			LevelSetLinear(Data df);
+			~LevelSetLinear();
+	};
+
+	typedef std::shared_ptr<LevelSetLinear> SPLevelSetLinear;
+
+} //asl
+
+#endif //ASLLEVELSETLINEAR_H
diff --git a/src/num/aslNumMethod.cxx b/src/num/aslNumMethod.cxx
new file mode 100644
index 0000000..4d494ff
--- /dev/null
+++ b/src/num/aslNumMethod.cxx
@@ -0,0 +1,34 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslNumMethod.h"
+
+namespace asl
+{
+
+	NumMethod::~NumMethod()
+	{
+	}
+
+} // asl
+
diff --git a/src/num/aslNumMethod.h b/src/num/aslNumMethod.h
new file mode 100644
index 0000000..b935158
--- /dev/null
+++ b/src/num/aslNumMethod.h
@@ -0,0 +1,82 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLNUMMETHOD_H
+#define ASLNUMMETHOD_H
+
+#include <acl/aclStdIncludes.h>
+#include <memory>
+
+namespace asl
+{
+	/// Virtual class describes general interface for Numerical methods;
+	/// \ingroup Numerics
+	class NumMethod
+	{
+		public:
+			/// Executes the numerical procedure
+			virtual void execute() = 0;
+			/// Builds the necesery internal data and kernels
+			virtual void init() = 0;
+			virtual ~NumMethod();
+	};
+
+	typedef std::shared_ptr<NumMethod> SPNumMethod;
+
+
+	template <class T> inline void initAll(std::vector<T*> &v);
+	template <class T> inline void initAll(std::vector<std::shared_ptr<T> > & v);
+	
+	template <class T> inline void executeAll(std::vector<T*> &v);
+	template <class T> inline void executeAll(std::vector<std::shared_ptr<T> > & v);
+
+//---------------------------- Implementation ---------------------------
+
+	template <class T> void executeAll(std::vector<T*> &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->execute();
+	}
+
+	template <class T> void executeAll(std::vector<std::shared_ptr<T> > &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->execute();
+	}
+
+	template <class T> void initAll(std::vector<T*> &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->init();
+	}
+
+	template <class T> void initAll(std::vector<std::shared_ptr<T> > &v)
+	{
+		for (unsigned int i(0); i < v.size(); ++i)
+			v[i]->init();
+	}
+
+	
+}	//asl
+
+#endif //ASLNUMMETHOD_H
diff --git a/src/num/aslNumMethodsMerger.cxx b/src/num/aslNumMethodsMerger.cxx
new file mode 100644
index 0000000..2dffc8d
--- /dev/null
+++ b/src/num/aslNumMethodsMerger.cxx
@@ -0,0 +1,66 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslNumMethodsMerger.h"
+#include "aslSingleKernelNM.h"
+#include <acl/Kernels/aclKernelMerger.h>
+
+using namespace std;
+
+namespace asl
+{
+
+	NumMethodsMerger::NumMethodsMerger():
+		km(new acl::KernelMerger)
+	{
+	}
+
+	void NumMethodsMerger::init(bool buildKernels)
+	{
+		for(unsigned int i(0); i<nmList.size();++i){
+			if(buildKernels)
+				nmList[i]->init0();
+			km->addKernel(nmList[i]->kernel);
+		}
+		km->setup();
+	}
+
+	void NumMethodsMerger::execute()
+	{
+		km->compute();
+		for(unsigned int i(0); i<nmList.size();++i){
+			nmList[i]->postProcessing();
+		}
+	}
+
+	void NumMethodsMerger::addNM(const vector<SPSingleKernelNM> &nm)
+	{
+		unsigned int s(nmList.size());
+		nmList.resize(s+nm.size());
+		for(unsigned int i(0);i<nm.size();++i)
+			nmList[i+s]=nm[i];
+	}
+		
+
+} // asl
+
diff --git a/src/num/aslNumMethodsMerger.h b/src/num/aslNumMethodsMerger.h
new file mode 100644
index 0000000..6f33f3b
--- /dev/null
+++ b/src/num/aslNumMethodsMerger.h
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLNUMMETHODSMERGER_H
+#define ASLNUMMETHODSMERGER_H
+
+#include <memory>
+#include <vector>
+
+namespace acl
+{
+	class KernelMerger;
+	typedef std::shared_ptr<KernelMerger> SPKernelMerger;
+}
+
+namespace asl
+{
+	class SingleKernelNM;
+	typedef std::shared_ptr<SingleKernelNM> SPSingleKernelNM;
+	/// Mergers several methods into single kernel
+	/// \ingroup Numerics
+	class NumMethodsMerger
+	{
+		public:
+			acl::SPKernelMerger km;
+		private:
+			std::vector<SPSingleKernelNM> nmList;
+		public:
+			NumMethodsMerger();
+			
+			/// Executes the numerical procedures
+			void execute();
+			/// Builds the necesery internal data and kernels
+			/** \param buildKernels defines whether to call init0 or not*/
+			void init(bool buildKernels);
+			
+			inline void addNM(SPSingleKernelNM nm);
+			void addNM(const std::vector<SPSingleKernelNM> & nm);
+	};
+
+//---------------------------- Implementation ---------------------------
+
+	inline void NumMethodsMerger::addNM(SPSingleKernelNM nm)
+	{
+		nmList.push_back(nm);
+	}
+	
+}	//asl
+
+#endif //ASLNUMMETHODSMERGER_H
diff --git a/src/num/aslSingleKernelNM.cxx b/src/num/aslSingleKernelNM.cxx
new file mode 100644
index 0000000..ed17a58
--- /dev/null
+++ b/src/num/aslSingleKernelNM.cxx
@@ -0,0 +1,95 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslSingleKernelNM.h"
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/Kernels/aclKernel.h>
+#include <acl/acl.h>
+
+
+namespace asl
+{
+	SingleKernelNM::SingleKernelNM(const acl::KernelConfiguration & kernelConfig):
+		kernel(new acl::Kernel(kernelConfig))
+	{
+	}
+	
+	SingleKernelNM::~SingleKernelNM()
+	{
+	}
+
+	void SingleKernelNM::init()
+	{
+		init0();
+		kernel->setup();
+	}
+
+	void SingleKernelNM::execute()
+	{
+		preProcessing();
+		kernel->compute();
+		postProcessing();
+	}
+
+	void SingleKernelNM::preProcessing()
+	{
+	}
+
+	void SingleKernelNM::postProcessing()
+	{
+	}
+
+	SingleKernelMapNM::SingleKernelMapNM(const acl::KernelConfiguration & kernelCongig):
+		SingleKernelNM(kernelCongig)
+	{
+	}
+
+	SingleKernelMapNM::SingleKernelMapNM(Field map, const acl::KernelConfiguration & kernelCongig):
+		SingleKernelNM(kernelCongig),
+		map(map)			
+	{
+	}
+
+	void SingleKernelMapNM::setMap(Field m)
+	{
+		map=m;
+	}
+
+	void SingleKernelMapNM::initMapInfrastructure(acl::ExpressionContainer & k)
+	{
+		if (map.get()!=0)
+		{
+			k.addExpression(acl::elementOperators::
+				                ifElse(acl::elementOperators::any((map->getEContainer() <= 0.)[0]),
+				                       {acl::elementOperators::returnStatement()}, 
+				                       {} ));
+		}
+	}
+
+	SingleKernelMapNM::~SingleKernelMapNM()
+	{
+	}
+
+} // asl
+
diff --git a/src/num/aslSingleKernelNM.h b/src/num/aslSingleKernelNM.h
new file mode 100644
index 0000000..6588747
--- /dev/null
+++ b/src/num/aslSingleKernelNM.h
@@ -0,0 +1,90 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLSINGLEKERNELNM_H
+#define ASLSINGLEKERNELNM_H
+
+#include "aslNumMethod.h"
+
+namespace acl
+{
+	class ExpressionContainer;
+	class Kernel;
+	class KernelConfiguration;
+	typedef std::shared_ptr<Kernel> SPKernel;
+}
+
+
+namespace asl
+{
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+	
+	/// Virtual class describes general interface for Numerical methods whith single Kernel;
+	/// \ingroup Numerics
+	class SingleKernelNM:public NumMethod
+	{
+		protected: 
+			acl::SPKernel kernel;
+			/// the function executed before kernel->compute()
+			virtual void preProcessing();
+			/// the function executed after kernel->compute()
+			virtual void postProcessing();
+			/// full initialisation but without kernel->setup()
+			virtual void init0()=0;
+
+			SingleKernelNM(const acl::KernelConfiguration & kernelCongig);
+		public:
+			virtual void execute();
+			/// Builds the necesery internal data and kernels
+			virtual void init();
+			virtual ~SingleKernelNM();
+
+			friend class NumMethodsMerger;
+	};
+
+	class SingleKernelMapNM:public SingleKernelNM
+	{
+		public:
+			typedef SPAbstractDataWithGhostNodes Field;
+		private:
+			Field map;
+		protected:
+			SingleKernelMapNM(const acl::KernelConfiguration & kernelCongig);
+			SingleKernelMapNM(Field map, const acl::KernelConfiguration & kernelCongig);
+			void initMapInfrastructure(acl::ExpressionContainer & k);	
+		public:
+			void setMap(Field map);
+			~SingleKernelMapNM();
+	};
+	
+
+
+//---------------------------- Implementation ---------------------------
+
+
+	
+}	//asl
+
+#endif //ASLSINGLEKERNELNM_H
diff --git a/src/num/aslTimeContinuations.cxx b/src/num/aslTimeContinuations.cxx
new file mode 100644
index 0000000..0308849
--- /dev/null
+++ b/src/num/aslTimeContinuations.cxx
@@ -0,0 +1,206 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTimeContinuations.h"
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <acl/acl.h>
+#include "aslUtilities.h"
+#include <acl/aclMath/aclVectorOfElements.h>
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+
+	TimeContinuations::TimeContinuations(Data inD, double f):
+		inData(inD->getDContainer()),
+		factor(f),
+		nStorages(0)		
+	{
+	}
+
+	TimeContinuations::TimeContinuations(acl::VectorOfElementsData & inD, double f):
+		inData(inD),
+		factor(f),
+		nStorages(0)		
+	{
+	}
+
+	void TimeContinuations::addData(acl::VectorOfElementsData & inD)
+	{
+		copy(cat(inData,inD),inData);
+	}	
+
+	void TimeContinuations::addData(Data inD)
+	{
+		copy(cat(inData,inD->getDContainer()),inData);
+	}	
+
+	void TimeContinuations::reset()
+	{
+		nStorages=0;
+	}			
+		
+	double polynomRootsLag(double x, int pOrder, int iCoef)
+	{
+		double res(1);
+		for(int i(0); i<pOrder; ++i)
+		{
+			int a= (i>=iCoef) ? 1 : 0;
+			res*=x+(pOrder-i-a);
+		}					
+		return res; 
+	}
+	
+	double polynomCoefsLag(double f, int pOrder, int iCoef)
+	{
+		return polynomRootsLag(f,pOrder,iCoef)/polynomRootsLag(iCoef-pOrder,pOrder,iCoef);		
+	}
+	
+
+	TimeContinPLagrange::TimeContinPLagrange(Data inD, double f, unsigned int o):
+		TimeContinuations(inD,f),
+		kernels(o+1),
+		order(o),
+		coefs(o+1)
+	{
+	}
+
+	TimeContinPLagrange::TimeContinPLagrange(acl::VectorOfElementsData & inD, 
+	                                         double f, unsigned int o):
+		TimeContinuations(inD,f),
+		kernels(o+1),
+		order(o),
+		coefs(o+1)
+	{
+	}
+		
+	void TimeContinPLagrange::init()
+	{
+		unsigned int nC(inData.size());
+		copy(clone(inData),storedData);
+		acl::initData(storedData, acl::generateVEConstantN(nC,0.));
+
+		acl::VectorOfElements inDataV(inData);
+
+		for(unsigned int i(0); i<=order; ++i)
+			coefs[i]=polynomCoefsLag(factor, order, i);
+
+//		cout<<factor<<endl;
+//		cout<<coefs<<endl;
+
+		for(unsigned int i(0); i<=order; ++i)
+			kernels[i].reset(new acl::Kernel(acl::KERNEL_SIMD));
+
+		(*kernels[0]) << (assignmentSafe(storedData,coefs[0]*inDataV));
+		for(unsigned int i(1); i<order; ++i)
+			(*kernels[i]) << (assignmentSafe(storedData,storedData+coefs[i]*inDataV));
+		
+		(*kernels[order])<< (assignmentSafe (inDataV, storedData+coefs[order]*inDataV));
+
+		setupAll(kernels);
+	}
+			
+	void TimeContinPLagrange::execute()
+	{
+		kernels[nStorages]->compute();
+		nStorages++;
+		nStorages=nStorages % (order+1);
+	}	
+
+	double polynomRootsLagFr(double x, double offset, int pOrder, int iCoef)
+	{
+		double res(1);
+		for(int i(0); i<pOrder; ++i)
+		{
+			int a= (i>=iCoef) ? 1 : 0;
+			res*=1./(offset+x)-1./(offset-pOrder+i+a);
+		}					
+		return res; 
+	}
+	
+	double polynomCoefsLagFr(double f,double offset, int pOrder, int iCoef)
+	{
+		return polynomRootsLagFr(f,offset,pOrder,iCoef)/
+			   polynomRootsLagFr(iCoef-pOrder,offset,pOrder,iCoef);		
+	}
+	
+
+	TimeContinPLagrangeFraction::TimeContinPLagrangeFraction(Data inD, double f, unsigned int o):
+		TimeContinuations(inD,f),
+		kernels(o+1),
+		order(o),
+//		offset(.5*factor+o*2),
+		offset(1.+o*2),
+		coefs(o+1)
+	{
+	}
+
+	TimeContinPLagrangeFraction::TimeContinPLagrangeFraction(acl::VectorOfElementsData & inD, 
+	                                                         double f, unsigned int o):
+		TimeContinuations(inD,f),
+		kernels(o+1),
+		order(o),
+//		offset(.5*factor+o*2),
+		offset(1.+o*2),
+		coefs(o+1)
+	{
+	}
+		
+	void TimeContinPLagrangeFraction::init()
+	{
+		unsigned int nC(inData.size());
+		copy(clone(inData),storedData);
+		acl::initData(storedData, acl::generateVEConstantN(nC,0.));
+		acl::VectorOfElements inDataV(inData);
+
+		for(unsigned int i(0); i<=order; ++i)
+			coefs[i]=polynomCoefsLagFr(factor, offset, order, i);
+
+//		cout<<factor<<endl;
+//		cout<<coefs<<endl;
+
+		for(unsigned int i(0); i<=order; ++i)
+			kernels[i].reset(new acl::Kernel(acl::KERNEL_SIMD));
+
+		(*kernels[0]) << (assignmentSafe(storedData,coefs[0]*inDataV));
+		for(unsigned int i(1); i<order; ++i)
+			(*kernels[i]) << (assignmentSafe(storedData,storedData+coefs[i]*inDataV));
+		
+		(*kernels[order])<< (assignmentSafe (inDataV, storedData+coefs[order]*inDataV));
+
+		setupAll(kernels);
+	}
+			
+	void TimeContinPLagrangeFraction::execute()
+	{
+		kernels[nStorages]->compute();
+		nStorages++;
+		nStorages=nStorages % (order+1);
+	}	
+		
+} //asl
diff --git a/src/num/aslTimeContinuations.h b/src/num/aslTimeContinuations.h
new file mode 100644
index 0000000..75ea2aa
--- /dev/null
+++ b/src/num/aslTimeContinuations.h
@@ -0,0 +1,138 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLTIMECONTINUATIONS_H
+#define ASLTIMECONTINUATIONS_H
+
+#include "aslNumMethod.h"
+#include <acl/aclMath/aclVectorOfElementsDef.h>
+
+namespace acl
+{
+	class Kernel;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+
+	/// Numerical method that generates temporal extrapolation of the data, Abstract class.
+	/**
+		 \ingroup NumMethods
+
+	*/
+	class TimeContinuations: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+		protected:	
+			acl::VectorOfElementsData inData;
+			double factor;
+			unsigned int nStorages;			
+			TimeContinuations(Data inD, double factor);
+			TimeContinuations(acl::VectorOfElementsData & inD, double factor);
+		public:			
+			void addData(Data inD);
+			void addData(acl::VectorOfElementsData & inD);
+			virtual void execute()=0;
+			virtual void init()=0;
+			/// makes reset of the contiuation (storage) cicle 
+			void reset();
+	};
+
+	
+	/// Numerical method that generates temporal extrapolation of the data with Lagrangian polynoms 
+	/**
+		 \ingroup NumMethods
+
+		 The method computes Lagrange polinomial extrapolation of order \f$k\f$ in time. \p factor 
+		 defines extrapolation length:
+		 \f[ u(t+dt*factor) = \sum_{i=0}^n y_i  l_i \f]
+		 where 
+		 \f[ l_i(x) = \prod_{j=0, j\neq i}^k \frac{x-x_j}{x_i-x_j}\f]
+		 The first avalible point has \f$ t_0 = -k$. The last avalible point has \f$ t_k = 0$.
+	*/
+	class TimeContinPLagrange: public TimeContinuations
+	{
+		private:	
+			acl::VectorOfElements storedData;
+			std::vector<std::shared_ptr<acl::Kernel>> kernels;
+			unsigned int order;
+			std::vector<double> coefs; 
+
+		public:			
+			TimeContinPLagrange(Data inD, double f, unsigned int order);
+			TimeContinPLagrange(acl::VectorOfElementsData & inD, double f, unsigned int order);
+			virtual void execute();
+			virtual void init();
+	};
+
+	typedef std::shared_ptr<TimeContinPLagrange> SPTimeContinPLagrange;
+
+	/// Numerical method that generates temporal extrapolation of the data with Lagrangian polynoms of fractional argument  
+	/**
+		 \ingroup NumMethods
+
+		 The method computes Lagrange polinomial extrapolation of order \f$k\f$ in time. 
+		 The time is taken in the form \f$ (t+t_s)^{-1}\f$. \p factor  
+		 defines extrapolation length. \f$ t_s\f$ is defined as: 
+	     \f[ t_s = 2 k+ factor \f]
+		 The interpolation polinoms are nothing else but the Lagrange one with
+		 \f$ x \f$ defined as \f$ x=(t+t_s)^{-1} \f$
+		 \f[ u(t+dt*factor) = \sum_{i=0}^n y_i  l_i \f]
+		 where 
+		 \f[ l_i(x) = \prod_{j=0, j\neq i}^k \frac{x-x_j}{x_i-x_j}\f]
+
+		 The first avalible point has \f$ t_0 = -k$. The last avalible point has \f$ t_k = 0$. 
+		 
+	*/	
+	class TimeContinPLagrangeFraction: public TimeContinuations
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes Field;
+		private:	
+			acl::VectorOfElements storedData;
+			std::vector<std::shared_ptr<acl::Kernel>> kernels;
+			unsigned int order;
+			double offset;
+			std::vector<double> coefs; 
+
+		public:			
+			TimeContinPLagrangeFraction(Data inD, double f, unsigned int order);
+			TimeContinPLagrangeFraction(acl::VectorOfElementsData & inD, 
+			                            double f, unsigned int order);
+			void execute();
+			virtual void init();
+	};
+
+	typedef std::shared_ptr<TimeContinPLagrangeFraction> SPTimeContinPLagrangeFraction;
+	
+	
+} // asl
+#endif // ASLTIMECONTINUATIONS_H
diff --git a/src/numExtend/CMakeLists.txt b/src/numExtend/CMakeLists.txt
new file mode 100644
index 0000000..e766041
--- /dev/null
+++ b/src/numExtend/CMakeLists.txt
@@ -0,0 +1,16 @@
+include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/acl)
+
+
+# aslExt
+
+set(aslExt_PUBLIC_HEADERS
+	aslFDAdvectionDiffusionExtended.h
+)
+
+set(aslExt_SOURCES
+	${aslExt_PUBLIC_HEADERS}
+	aslFDAdvectionDiffusionExtended.cxx
+)
+
+add_library(aslExt ${aslExt_SOURCES})
+INSTALL_SUBLIB(aslExt aslExt_PUBLIC_HEADERS)
diff --git a/src/numExtend/aslFDAdvectionDiffusionExtended.cxx b/src/numExtend/aslFDAdvectionDiffusionExtended.cxx
new file mode 100644
index 0000000..55225a5
--- /dev/null
+++ b/src/numExtend/aslFDAdvectionDiffusionExtended.cxx
@@ -0,0 +1,145 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslFDAdvectionDiffusionExtended.h"
+#include "aslGenerators.h"
+#include "acl/aclGenerators.h"
+#include "acl/acl.h"
+#include "math/aslTemplateVE.h"
+
+#include <data/aslDataWithGhostNodes.h>
+#include <acl/Kernels/aclKernel.h>
+#include <math/aslTemplates.h>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+namespace asl
+{
+	FDAdvectionDiffusionExtended::FDAdvectionDiffusionExtended():
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(0),
+		cInternalData(0),
+		electricField(false),
+		efChargeAnd(0),
+		vectorTemplate(NULL),		
+		diffusionCoefficient(0)
+	{
+	}
+
+	FDAdvectionDiffusionExtended::FDAdvectionDiffusionExtended(Data c, double dC, const VectorTemplate* vT):
+		kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),
+		cData(1u,c),
+		cInternalData(0u),
+		electricField(false),		
+		efChargeAnd(0u),
+		vectorTemplate(vT),
+		diffusionCoefficient(1u,dC)
+	{
+	}
+
+
+	void FDAdvectionDiffusionExtended::setElectricFieldParameters(ScalarField phi, ScalarField f1, ScalarField f2, ScalarField qAnd)
+	{
+		electricField=true;
+		efPhi=phi;
+		efFactor1=f1;
+		efFactor2=f2;
+		efChargeAnd.resize(1);
+		efChargeAnd[0] =qAnd;
+	}
+	
+	void FDAdvectionDiffusionExtended::init(){
+		if (electricField)
+		{
+			if (cData.size() != diffusionCoefficient.size() || cData.size() != efChargeAnd.size())
+				errorMessage("FDAdvectionDiffusion::init: some of compenents are underdefined");
+		}
+		else
+		{
+			if (cData.size() != diffusionCoefficient.size())
+				errorMessage("FDAdvectionDiffusion::init: some of compenents are underdefined");
+		}
+
+		acl::TypeID type(getElementType(cData[0]->getDContainer()));
+		
+		cInternalData.resize(cData.size());
+		for (unsigned int i(0); i < cData.size(); ++i)
+			cInternalData[i] =clone(cData[i]);
+		acl::VectorOfElements cnew(acl::generateVEPrivateVariable(1,type)); 
+		std::unique_ptr<TemplateVE> f1;
+		std::unique_ptr<TemplateVE> f2;
+		std::unique_ptr<TemplateVE> phi;
+		if (electricField)
+		{
+			f1.reset(new TemplateVE(*efFactor1,d2q5()));
+			f2.reset(new TemplateVE(*efFactor2,d2q5()));				
+			phi.reset(new TemplateVE(*efPhi,d2q5()));				
+			(*kernel)<<f1->initValues;
+			(*kernel)<<f2->initValues;
+			(*kernel)<<phi->initValues;
+		}
+		for (unsigned int i(0); i < cData.size(); ++i){
+			TemplateVE cT(*cData[i],d2q5());
+			(*kernel)<<cT.initValues;
+			(*kernel)<<(cnew=
+						acl::generateVEVariableR(diffusionCoefficient[i])*laplas(cT)+
+						cT.getValue(0));
+			if (electricField)
+			{
+				TemplateVE q(*efChargeAnd[i],d2q5());
+				(*kernel)<<q.initValues;
+				(*kernel)<<(cnew-=divAgradB(cT*q/(*f1),(*phi)/*+(*f2)*/)); 
+			}
+			(*kernel)<<(assignmentSafe (cInternalData[i]->getSubContainer(),cnew));
+		}		
+		kernel->setup();
+	}
+
+
+	void FDAdvectionDiffusionExtended::execute()
+	{
+		kernel->compute();
+		for (unsigned int i(0); i < cData.size(); ++i)
+			swapBuffers(cData[i]->getDContainer(),cInternalData[i]->getDContainer());
+	}
+
+
+	void FDAdvectionDiffusionExtended::setDiffusionCoefficient (double dC, unsigned int i)
+	{
+		diffusionCoefficient[i] =dC;
+	}
+	
+	void FDAdvectionDiffusionExtended::addComponent (Data c, double dC)
+	{
+		if (electricField)
+			errorMessage("FDAdvectionDiffusion::addComponent: \"Electric field\" is swiched on \n therefore \"qAnd\" value should be specified");
+		diffusionCoefficient.push_back (dC);
+		cData.push_back (c);
+	}
+	void FDAdvectionDiffusionExtended::addComponent (Data c, double dC,ScalarField qAnd)
+	{
+		diffusionCoefficient.push_back (dC);
+		cData.push_back (c);
+		efChargeAnd.push_back (qAnd);
+	}
+} //asl
diff --git a/src/numExtend/aslFDAdvectionDiffusionExtended.h b/src/numExtend/aslFDAdvectionDiffusionExtended.h
new file mode 100644
index 0000000..900667c
--- /dev/null
+++ b/src/numExtend/aslFDAdvectionDiffusionExtended.h
@@ -0,0 +1,104 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLFDADVECTIONDIFFUSION_H
+#define ASLFDADVECTIONDIFFUSION_H
+
+#include "../num/aslNumMethod.h"
+
+/**
+ \defgroup TransportProcesses Transport Processes
+ */
+
+
+namespace acl{
+	class Kernel;
+	class VectorOfElementsData;
+}
+
+namespace asl
+{
+	class VectorTemplate;
+	template <typename V> class DataWithGhostNodes;
+	typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
+	typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+	class AbstractDataWithGhostNodes;
+	typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
+	
+	/// Numerical method which computes multicomponent transport processes
+	/**
+		 \ingroup TransportProcesses
+		 \f[ \partial_t c_i= D_i \Delta c_i 
+		    					-\nabla\left(\frac{c_i q}{k} \nabla(\phi+f_2)  \right)\f]
+		 where
+		 \param cData corresponds to \f$c_i\f$
+		 \param diffusionCoefficient corresponds to \f$D_i\f$
+		 \param efFactor1 corresponds to \f$k\f$
+		 \param efFactor2 corresponds to \f$f_2\f$
+		 \param efPhi corresponds to \f$\phi\f$
+		 \param efChargeAnd corresponds to \f$q\f$
+
+		 This class contains filtering which forbits the local value of 
+		 \f$ \frac{q}{k} \nabla(\phi+f_2) \f$ to be larger than \f$0.2\f$
+	 */
+	class FDAdvectionDiffusionExtended: public NumMethod
+	{
+		public:
+			typedef SPDataWithGhostNodesACLData Data;
+			typedef SPAbstractDataWithGhostNodes ScalarField;
+		private:
+			std::unique_ptr<acl::Kernel> kernel; 
+			
+			std::vector<Data> cData;
+			std::vector<Data> cInternalData;			
+
+			bool electricField;
+			ScalarField efPhi;
+			ScalarField efFactor1;
+			ScalarField efFactor2;
+			std::vector<ScalarField> efChargeAnd;
+				
+			const VectorTemplate* vectorTemplate;
+
+			int t;
+			std::vector<double> diffusionCoefficient;
+		public:			
+			FDAdvectionDiffusionExtended();
+			FDAdvectionDiffusionExtended(Data c, double dC,const VectorTemplate* vT);
+			void setDiffusionCoefficient(double d, unsigned int i=0);
+			double getDiffusionCoefficient(unsigned int i=0);
+			void setVectorTemplate(VectorTemplate* vT);
+			VectorTemplate setVectorTemplate(const VectorTemplate* vT);
+			void setElectricFieldParameters(ScalarField phi, ScalarField f1, ScalarField f2, ScalarField qAnd);
+			virtual void init();
+			virtual void execute();
+			void addComponent(Data c, double dC);
+			void addComponent(Data c, double dC, ScalarField qAnd);			
+			
+	};
+
+	typedef std::shared_ptr<FDAdvectionDiffusionExtended> SPFDAdvectionDiffusionExtended;
+
+		
+} // asl
+#endif // ASLFDADVECTIONDIFFUSION_H
diff --git a/src/pics/grids/2Dconcatination-crop.pdf b/src/pics/grids/2Dconcatination-crop.pdf
new file mode 100644
index 0000000..0d3ebe3
Binary files /dev/null and b/src/pics/grids/2Dconcatination-crop.pdf differ
diff --git a/src/pics/grids/2Dconcatination.tex b/src/pics/grids/2Dconcatination.tex
new file mode 100644
index 0000000..7d3b8bd
--- /dev/null
+++ b/src/pics/grids/2Dconcatination.tex
@@ -0,0 +1,18 @@
+\documentclass{article} % say
+\usepackage{tikz}
+\pagestyle{empty}
+\begin{document}
+\begin{tikzpicture}
+\draw[black, dashed,very thick](0,4)--(0,-4) (-4,0)--(7,0) (-4,-2)--(7,-2);
+\draw[gray!50, step=4cm, xshift=-2cm, yshift=-2cm] (0,0) grid (9,6);
+\draw[gray!50, step=2cm, xshift=-1cm, yshift=-1cm] (0,-3) grid (7.5,0);
+
+\foreach \x/\y/\z in {0/0/00,1/0/10,2/0/20,3/0/30,0/-1/01,1/-1/11,2/-1/21,3/-1/31} \filldraw[fill=yellow] (-1,-1)+(\x*2,\y*2)circle (.3cm) node[blue]{$u_{\z}$};
+
+\foreach \x/\y/\z in {0/0/00,1/0/10,2/0/20,0/1/01,1/1/11,2/1/21} \filldraw[fill=green!20!yellow] (-2,-2)+(\x*4,\y*4)circle (.4cm) node[blue]{$U_{\z}$};
+
+
+\end{tikzpicture}
+
+\end{document}
+ 
diff --git a/src/pics/grids/t15.png b/src/pics/grids/t15.png
new file mode 100644
index 0000000..117597b
Binary files /dev/null and b/src/pics/grids/t15.png differ
diff --git a/src/pics/grids/t15.svg b/src/pics/grids/t15.svg
new file mode 100644
index 0000000..dfea5e8
--- /dev/null
+++ b/src/pics/grids/t15.svg
@@ -0,0 +1,1063 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t15.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel0\include\pic\grid"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2193"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2201"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2209"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2217"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2220"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3270"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3272"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3274"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3276"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3278"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3280"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3282"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3284"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3286"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3288"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3450"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3452"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3454"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3456"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3458"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3460"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3462"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3464"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3466"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3468"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2407"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2409"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2411"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2413"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2415"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2417"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2419"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2421"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2423"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2425"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.5"
+     inkscape:cx="578.32614"
+     inkscape:cy="560.09515"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="true"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g2519"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t15.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3326"
+         d="M 244.87992,55.149605 L 595.93831,55.149605"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3328"
+         d="M 244.87992,407.48219 L 595.93831,407.48219"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3330"
+         d="M 244.87879,57.238813 L 244.87879,407.48334"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.7577455;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3332"
+         d="M 596.87882,57.215141 L 596.87882,407.48325"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75780475;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3334"
+         d="M 244.42804,231.93406 L 595.48643,231.93406"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3336"
+         d="M 420.42815,56.790409 L 420.42815,407.93398"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,286.2399,86.47095)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3348"
+         style="opacity:0.81666667;fill:url(#radialGradient3460);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3350"
+         y="240.73253"
+         x="419.53586"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="240.73253"
+           x="419.53586"
+           id="tspan3352"
+           sodipodi:role="line">4</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,462.2398,-89.52905)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3370"
+         style="opacity:0.81666667;fill:url(#radialGradient3462);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3372"
+         y="61.422157"
+         x="596.2027"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="61.422157"
+           x="596.2027"
+           id="tspan3374"
+           sodipodi:role="line">11</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,110.2399,-89.52905)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3376"
+         style="opacity:0.81666667;fill:url(#radialGradient3464);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3378"
+         y="61.422157"
+         x="240.68268"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="61.422157"
+           x="240.68268"
+           id="tspan3380"
+           sodipodi:role="line">13</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,110.2399,262.471)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3382"
+         style="opacity:0.81666667;fill:url(#radialGradient3466);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3384"
+         y="420.46216"
+         x="243.32268"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="420.46216"
+           x="248.20393"
+           id="tspan3386"
+           sodipodi:role="line">14 </tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,462.2399,262.471)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3388"
+         style="opacity:0.81666667;fill:url(#radialGradient3468);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3390"
+         y="417.82214"
+         x="596.2027"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="417.82214"
+           x="596.2027"
+           id="tspan3392"
+           sodipodi:role="line">12</tspan></text>
+    </g>
+    <g
+       id="g2461"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t15.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2228"
+         d="M 151,100.98425 L 549.92999,100.98425"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2226"
+         d="M 151,501.36218 L 549.92999,501.36218"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2224"
+         d="M 150.99872,103.35835 L 150.99872,501.36346"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99743807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2222"
+         d="M 550.99875,103.33145 L 550.99875,501.36343"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99750543;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path3080"
+         d="M 150.4865,301.87568 L 549.41649,301.87568"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path3078"
+         d="M 350.48662,102.8488 L 350.48662,501.87556"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2160"
+         style="opacity:0.81666667;fill:url(#radialGradient2407);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient2409);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3200"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         inkscape:export-xdpi="36"
+         inkscape:export-ydpi="36" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,336.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3062"
+         style="opacity:0.81666667;fill:url(#radialGradient2411);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3066"
+         style="opacity:0.81666667;fill:url(#radialGradient2413);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3070"
+         style="opacity:0.81666667;fill:url(#radialGradient2415);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3074"
+         style="opacity:0.81666667;fill:url(#radialGradient2417);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3967"
+         y="311.8739"
+         x="349.47266"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.8739"
+           x="349.47266"
+           id="tspan3969"
+           sodipodi:role="line">0</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3971"
+         y="311.11218"
+         x="546.23047"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.11218"
+           x="546.23047"
+           id="tspan3973"
+           sodipodi:role="line">2</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3975"
+         y="112.36218"
+         x="350.50464"
+         style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="112.36218"
+           x="350.50464"
+           id="tspan3977"
+           sodipodi:role="line">3</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3979"
+         y="311.11218"
+         x="139.57031"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.11218"
+           x="139.57031"
+           id="tspan3981"
+           sodipodi:role="line">5</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3983"
+         y="510.995"
+         x="350.82031"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="510.995"
+           x="350.82031"
+           id="tspan3985"
+           sodipodi:role="line">6</tspan></text>
+    </g>
+    <g
+       id="g2384"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t15.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3202"
+         d="M 57.119942,146.81889 L 503.92114,146.81889"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3204"
+         d="M 57.119942,595.24173 L 503.92114,595.24173"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3206"
+         d="M 57.118509,149.47788 L 57.118509,595.24318"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.23712873;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3208"
+         d="M 505.11815,149.44775 L 505.11815,595.24318"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.23720407;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3210"
+         d="M 56.544823,371.81709 L 503.34602,371.81709"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3212"
+         d="M 280.54476,148.90719 L 280.54476,595.81674"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,109.7599,186.6824)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3224"
+         style="opacity:0.81666667;fill:url(#radialGradient3280);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3226"
+         y="383.01511"
+         x="279.40912"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="383.01511"
+           x="279.40912"
+           id="tspan3228"
+           sodipodi:role="line">1</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,333.7596,-37.31747)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3246"
+         style="opacity:0.81666667;fill:url(#radialGradient3282);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3248"
+         y="154.80217"
+         x="504.2576"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="154.80217"
+           x="504.2576"
+           id="tspan3250"
+           sodipodi:role="line">7</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,-114.24,-37.31747)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3252"
+         style="opacity:0.81666667;fill:url(#radialGradient3284);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3254"
+         y="154.80217"
+         x="51.777985"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="154.80217"
+           x="51.777985"
+           id="tspan3256"
+           sodipodi:role="line">9</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,-114.24,410.6822)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3258"
+         style="opacity:0.81666667;fill:url(#radialGradient3286);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3260"
+         y="611.76172"
+         x="55.137981"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="611.76172"
+           x="61.350476"
+           id="tspan3262"
+           sodipodi:role="line">10 </tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,333.7597,410.6822)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3264"
+         style="opacity:0.81666667;fill:url(#radialGradient3288);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3266"
+         y="608.40173"
+         x="504.2576"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="608.40173"
+           x="504.2576"
+           id="tspan3268"
+           sodipodi:role="line">8</tspan></text>
+    </g>
+  </g>
+</svg>
diff --git a/src/pics/grids/t19.png b/src/pics/grids/t19.png
new file mode 100644
index 0000000..54f5fcb
Binary files /dev/null and b/src/pics/grids/t19.png differ
diff --git a/src/pics/grids/t19.svg b/src/pics/grids/t19.svg
new file mode 100644
index 0000000..5c3a930
--- /dev/null
+++ b/src/pics/grids/t19.svg
@@ -0,0 +1,1083 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t19.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel0\include\pic\grid"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2193"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2201"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2209"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2217"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2220"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3270"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3272"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3274"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3276"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3278"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3280"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3282"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3284"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3286"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3288"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3450"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3452"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3454"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3456"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3458"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3460"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3462"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3464"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3466"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3468"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.5"
+     inkscape:cx="372.04724"
+     inkscape:cy="526.18109"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="true"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g2423"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t19.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3326"
+         d="M 244.87992,55.149605 L 595.93831,55.149605"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3328"
+         d="M 244.87992,407.48219 L 595.93831,407.48219"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3330"
+         d="M 244.87879,57.238813 L 244.87879,407.48334"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.7577455;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3332"
+         d="M 596.87882,57.215141 L 596.87882,407.48325"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75780475;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3334"
+         d="M 244.42804,231.93406 L 595.48643,231.93406"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3336"
+         d="M 420.42815,56.790409 L 420.42815,407.93398"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.75999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,286.2399,-89.52905)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3338"
+         style="opacity:0.81666667;fill:url(#radialGradient3450);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient3452);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3340"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(0.871156,0,0,0.871156,286.2399,-89.52905)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         inkscape:export-xdpi="90"
+         inkscape:export-ydpi="90" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,286.2399,262.471)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3342"
+         style="opacity:0.81666667;fill:url(#radialGradient3454);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,110.2399,86.47095)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3344"
+         style="opacity:0.81666667;fill:url(#radialGradient3456);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,462.2399,86.47095)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3346"
+         style="opacity:0.81666667;fill:url(#radialGradient3458);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.871156,0,0,0.871156,286.2399,86.47095)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3348"
+         style="opacity:0.81666667;fill:url(#radialGradient3460);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3350"
+         y="240.73253"
+         x="419.53586"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="240.73253"
+           x="419.53586"
+           id="tspan3352"
+           sodipodi:role="line">4</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3354"
+         y="240.06221"
+         x="592.68274"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="240.06221"
+           x="592.68274"
+           id="tspan3356"
+           sodipodi:role="line">10</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3358"
+         y="65.162209"
+         x="420.444"
+         style="font-size:37.12131882px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="65.162209"
+           x="420.444"
+           id="tspan3360"
+           sodipodi:role="line">18</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3362"
+         y="240.06221"
+         x="234.82179"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="240.06221"
+           x="234.82179"
+           id="tspan3364"
+           sodipodi:role="line">9</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3366"
+         y="415.95905"
+         x="420.7218"
+         style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="415.95905"
+           x="420.7218"
+           id="tspan3368"
+           sodipodi:role="line">17</tspan></text>
+    </g>
+    <g
+       id="g2295"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t19.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2228"
+         d="M 151,100.98425 L 549.92999,100.98425"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2226"
+         d="M 151,501.36218 L 549.92999,501.36218"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2224"
+         d="M 150.99872,103.35835 L 150.99872,501.36346"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99743807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path2222"
+         d="M 550.99875,103.33145 L 550.99875,501.36343"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99750543;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path3080"
+         d="M 150.4865,301.87568 L 549.41649,301.87568"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="path3078"
+         d="M 350.48662,102.8488 L 350.48662,501.87556"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2160"
+         style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3200"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         inkscape:export-xdpi="36"
+         inkscape:export-ydpi="36" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,336.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3062"
+         style="opacity:0.81666667;fill:url(#radialGradient3064);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3066"
+         style="opacity:0.81666667;fill:url(#radialGradient3068);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3070"
+         style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3074"
+         style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3967"
+         y="311.8739"
+         x="349.47266"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.8739"
+           x="349.47266"
+           id="tspan3969"
+           sodipodi:role="line">0</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3971"
+         y="311.11218"
+         x="546.23047"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.11218"
+           x="546.23047"
+           id="tspan3973"
+           sodipodi:role="line">2</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3975"
+         y="112.36218"
+         x="350.50464"
+         style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="112.36218"
+           x="350.50464"
+           id="tspan3977"
+           sodipodi:role="line">3</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3979"
+         y="311.11218"
+         x="139.57031"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="311.11218"
+           x="139.57031"
+           id="tspan3981"
+           sodipodi:role="line">5</tspan></text>
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text3983"
+         y="510.995"
+         x="350.82031"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="510.995"
+           x="350.82031"
+           id="tspan3985"
+           sodipodi:role="line">6</tspan></text>
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,397.9999,-63.42333)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2187"
+         style="opacity:0.81666667;fill:url(#radialGradient2193);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text2189"
+         y="108.11217"
+         x="550.23041"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="108.11217"
+           x="550.23041"
+           id="tspan2191"
+           sodipodi:role="line">11</tspan></text>
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,-2.000049,-63.42333)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2195"
+         style="opacity:0.81666667;fill:url(#radialGradient2201);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text2197"
+         y="108.11217"
+         x="146.23039"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="108.11217"
+           x="146.23039"
+           id="tspan2199"
+           sodipodi:role="line">14</tspan></text>
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,-2.000049,336.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2203"
+         style="opacity:0.81666667;fill:url(#radialGradient2209);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text2205"
+         y="516.11218"
+         x="149.23039"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="516.11218"
+           x="154.77727"
+           id="tspan2207"
+           sodipodi:role="line">13 </tspan></text>
+      <path
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         transform="matrix(0.98995,0,0,0.98995,398,336.5767)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path2211"
+         style="opacity:0.81666667;fill:url(#radialGradient2220);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="36"
+         inkscape:export-xdpi="36"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+         id="text2213"
+         y="513.11218"
+         x="550.23041"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="513.11218"
+           x="550.23041"
+           id="tspan2215"
+           sodipodi:role="line">12</tspan></text>
+    </g>
+    <g
+       id="g2365"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t19.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3202"
+         d="M 57.119942,146.81889 L 503.92114,146.81889"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3204"
+         d="M 57.119942,595.24173 L 503.92114,595.24173"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3206"
+         d="M 57.118509,149.47788 L 57.118509,595.24318"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.23712873;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3208"
+         d="M 505.11815,149.44775 L 505.11815,595.24318"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.23720407;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3210"
+         d="M 56.544823,371.81709 L 503.34602,371.81709"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3212"
+         d="M 280.54476,148.90719 L 280.54476,595.81674"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2.2399981;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,109.7599,-37.31747)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3214"
+         style="opacity:0.81666667;fill:url(#radialGradient3270);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient3272);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3216"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(1.108743,0,0,1.108743,109.7599,-37.31747)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         inkscape:export-xdpi="90"
+         inkscape:export-ydpi="90" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,109.7599,410.6822)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3218"
+         style="opacity:0.81666667;fill:url(#radialGradient3274);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,-114.24,186.6824)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3220"
+         style="opacity:0.81666667;fill:url(#radialGradient3276);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,333.7597,186.6824)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3222"
+         style="opacity:0.81666667;fill:url(#radialGradient3278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(1.108743,0,0,1.108743,109.7599,186.6824)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3224"
+         style="opacity:0.81666667;fill:url(#radialGradient3280);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3226"
+         y="383.01511"
+         x="279.40912"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="383.01511"
+           x="279.40912"
+           id="tspan3228"
+           sodipodi:role="line">1</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3230"
+         y="382.16199"
+         x="499.77768"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="382.16199"
+           x="499.77768"
+           id="tspan3232"
+           sodipodi:role="line">7</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3234"
+         y="159.56218"
+         x="280.56494"
+         style="font-size:47.24526978px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="159.56218"
+           x="280.56494"
+           id="tspan3236"
+           sodipodi:role="line">15</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3238"
+         y="382.16199"
+         x="44.318703"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="382.16199"
+           x="44.318703"
+           id="tspan3240"
+           sodipodi:role="line">8</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3242"
+         y="606.03046"
+         x="280.91849"
+         style="font-size:44.79996109px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="606.03046"
+           x="280.91849"
+           id="tspan3244"
+           sodipodi:role="line">16</tspan></text>
+    </g>
+  </g>
+</svg>
diff --git a/src/pics/grids/t27.png b/src/pics/grids/t27.png
new file mode 100644
index 0000000..67f10ab
Binary files /dev/null and b/src/pics/grids/t27.png differ
diff --git a/src/pics/grids/t27.svg b/src/pics/grids/t27.svg
new file mode 100644
index 0000000..d14cdaf
--- /dev/null
+++ b/src/pics/grids/t27.svg
@@ -0,0 +1,1290 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t27.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel0\include\pic\grid"
+   inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+   inkscape:export-xdpi="36"
+   inkscape:export-ydpi="36"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2193"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2201"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2209"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2217"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2220"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3270"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3272"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3274"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3276"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3278"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3280"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3282"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3284"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3286"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3288"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3450"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3452"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3454"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3456"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3458"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3460"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3462"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3464"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3466"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3468"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.61875035"
+     inkscape:cx="-65.310144"
+     inkscape:cy="573.74699"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="true"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g3414"
+       transform="matrix(0.88,0,0,0.88,496.0039,-551.063)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3326"
+         d="M -285.36816,688.87796 L 113.56183,688.87796"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3328"
+         d="M -285.36816,1089.2559 L 113.56183,1089.2559"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3330"
+         d="M -285.36944,691.25206 L -285.36944,1089.2572"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99743807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3332"
+         d="M 114.63059,691.22516 L 114.63059,1089.2571"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99750543;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3334"
+         d="M -285.88166,889.76939 L 113.04833,889.76939"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3336"
+         d="M -85.881537,690.74251 L -85.881537,1089.7693"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-238.3682,524.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3338"
+         style="opacity:0.81666667;fill:url(#radialGradient3450);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient3452);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3340"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(0.98995,0,0,0.98995,-238.3682,524.4704)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         inkscape:export-xdpi="90"
+         inkscape:export-ydpi="90" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-238.3682,924.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3342"
+         style="opacity:0.81666667;fill:url(#radialGradient3454);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-438.3682,724.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3344"
+         style="opacity:0.81666667;fill:url(#radialGradient3456);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-38.36816,724.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3346"
+         style="opacity:0.81666667;fill:url(#radialGradient3458);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-238.3682,724.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3348"
+         style="opacity:0.81666667;fill:url(#radialGradient3460);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3350"
+         y="899.76764"
+         x="-86.8955"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="899.76764"
+           x="-86.8955"
+           id="tspan3352"
+           sodipodi:role="line">4</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3354"
+         y="899.00592"
+         x="109.86231"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="899.00592"
+           x="109.86231"
+           id="tspan3356"
+           sodipodi:role="line">10</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3358"
+         y="700.25592"
+         x="-85.863518"
+         style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="700.25592"
+           x="-85.863517"
+           id="tspan3360"
+           sodipodi:role="line">18</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3362"
+         y="899.00592"
+         x="-296.79785"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="899.00592"
+           x="-296.79785"
+           id="tspan3364"
+           sodipodi:role="line">9</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3366"
+         y="1098.8887"
+         x="-85.547844"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1098.8887"
+           x="-85.547844"
+           id="tspan3368"
+           sodipodi:role="line">17</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-38.36826,524.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3370"
+         style="opacity:0.81666667;fill:url(#radialGradient3462);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3372"
+         y="696.00586"
+         x="113.86225"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="696.00586"
+           x="113.86225"
+           id="tspan3374"
+           sodipodi:role="line">23</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-438.3682,524.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3376"
+         style="opacity:0.81666667;fill:url(#radialGradient3464);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3378"
+         y="696.00586"
+         x="-290.13776"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="696.00586"
+           x="-290.13776"
+           id="tspan3380"
+           sodipodi:role="line">25</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-438.3682,924.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3382"
+         style="opacity:0.81666667;fill:url(#radialGradient3466);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3384"
+         y="1104.0059"
+         x="-287.13776"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1104.0059"
+           x="-281.59088"
+           id="tspan3386"
+           sodipodi:role="line">26 </tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-38.36816,924.4704)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3388"
+         style="opacity:0.81666667;fill:url(#radialGradient3468);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3390"
+         y="1101.0059"
+         x="113.86225"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1101.0059"
+           x="113.86225"
+           id="tspan3392"
+           sodipodi:role="line">24</tspan></text>
+    </g>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 151,100.98425 L 549.92999,100.98425"
+       id="path2228"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 151,501.36218 L 549.92999,501.36218"
+       id="path2226"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99743807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 150.99872,103.35835 L 150.99872,501.36346"
+       id="path2224"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99750543;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 550.99875,103.33145 L 550.99875,501.36343"
+       id="path2222"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 150.4865,301.87568 L 549.41649,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 350.48662,102.8488 L 350.48662,501.87556"
+       id="path3078"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2160"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       inkscape:export-ydpi="36"
+       inkscape:export-xdpi="36"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       sodipodi:ry="50.507626"
+       sodipodi:rx="50.507626"
+       sodipodi:cy="167.46855"
+       sodipodi:cx="153.54318"
+       id="path3200"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       sodipodi:type="arc" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3064);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3062"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,336.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3068);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3066"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">2</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.50464"
+       y="112.36218"
+       id="text3975"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3977"
+         x="350.50464"
+         y="112.36218">3</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="139.57031"
+       y="311.11218"
+       id="text3979"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3981"
+         x="139.57031"
+         y="311.11218">5</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.82031"
+       y="510.995"
+       id="text3983"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3985"
+         x="350.82031"
+         y="510.995">6</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2193);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2187"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,397.9999,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="550.23041"
+       y="108.11217"
+       id="text2189"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan2191"
+         x="550.23041"
+         y="108.11217">11</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2201);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2195"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="146.23039"
+       y="108.11217"
+       id="text2197"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan2199"
+         x="146.23039"
+         y="108.11217">14</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2209);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2203"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,336.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="149.23039"
+       y="516.11218"
+       id="text2205"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan2207"
+         x="154.77727"
+         y="516.11218">13 </tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2220);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2211"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,336.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="550.23041"
+       y="513.11218"
+       id="text2213"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan2215"
+         x="550.23041"
+         y="513.11218">12</tspan></text>
+    <g
+       id="g3290"
+       transform="matrix(1.119999,0,0,1.119999,-20.6141,-556.2671)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3202"
+         d="M 69.405457,627.75591 L 468.33545,627.75591"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3204"
+         d="M 69.405457,1028.1338 L 468.33545,1028.1338"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3206"
+         d="M 69.404177,630.13001 L 69.404177,1028.1351"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99743807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3208"
+         d="M 469.40421,630.10311 L 469.40421,1028.1351"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.99750543;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3210"
+         d="M 68.891957,828.64734 L 467.82195,828.64734"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="path3212"
+         d="M 268.89208,629.62046 L 268.89208,1028.6472"
+         style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,116.4055,463.3483)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3214"
+         style="opacity:0.81666667;fill:url(#radialGradient3270);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.81666667;fill:url(#radialGradient3272);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="path3216"
+         sodipodi:cx="153.54318"
+         sodipodi:cy="167.46855"
+         sodipodi:rx="50.507626"
+         sodipodi:ry="50.507626"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         transform="matrix(0.98995,0,0,0.98995,116.4055,463.3483)"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         inkscape:export-xdpi="90"
+         inkscape:export-ydpi="90" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,116.4055,863.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3218"
+         style="opacity:0.81666667;fill:url(#radialGradient3274);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-83.59459,663.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3220"
+         style="opacity:0.81666667;fill:url(#radialGradient3276);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,316.4055,663.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3222"
+         style="opacity:0.81666667;fill:url(#radialGradient3278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,116.4055,663.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3224"
+         style="opacity:0.81666667;fill:url(#radialGradient3280);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3226"
+         y="838.64557"
+         x="267.87811"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="838.64557"
+           x="267.87811"
+           id="tspan3228"
+           sodipodi:role="line">1</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3230"
+         y="837.88385"
+         x="464.63593"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="837.88385"
+           x="464.63593"
+           id="tspan3232"
+           sodipodi:role="line">7</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3234"
+         y="639.13385"
+         x="268.9101"
+         style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="639.13385"
+           x="268.9101"
+           id="tspan3236"
+           sodipodi:role="line">15</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3238"
+         y="837.88385"
+         x="57.975769"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="837.88385"
+           x="57.975769"
+           id="tspan3240"
+           sodipodi:role="line">8</tspan></text>
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3242"
+         y="1037.7666"
+         x="269.22577"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1037.7666"
+           x="269.22577"
+           id="tspan3244"
+           sodipodi:role="line">16</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,316.4054,463.3483)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3246"
+         style="opacity:0.81666667;fill:url(#radialGradient3282);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3248"
+         y="634.88385"
+         x="468.63586"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="634.88385"
+           x="468.63586"
+           id="tspan3250"
+           sodipodi:role="line">19</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-83.59459,463.3483)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3252"
+         style="opacity:0.81666667;fill:url(#radialGradient3284);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3254"
+         y="634.88385"
+         x="64.635849"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="634.88385"
+           x="64.635849"
+           id="tspan3256"
+           sodipodi:role="line">21</tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,-83.59459,863.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3258"
+         style="opacity:0.81666667;fill:url(#radialGradient3286);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3260"
+         y="1042.8838"
+         x="67.635849"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1042.8838"
+           x="73.182724"
+           id="tspan3262"
+           sodipodi:role="line">22 </tspan></text>
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         transform="matrix(0.98995,0,0,0.98995,316.4055,863.3484)"
+         d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+         sodipodi:ry="50.507626"
+         sodipodi:rx="50.507626"
+         sodipodi:cy="167.46855"
+         sodipodi:cx="153.54318"
+         id="path3264"
+         style="opacity:0.81666667;fill:url(#radialGradient3288);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+      <text
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t9.png"
+         id="text3266"
+         y="1039.8838"
+         x="468.63586"
+         style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           y="1039.8838"
+           x="468.63586"
+           id="tspan3268"
+           sodipodi:role="line">20</tspan></text>
+    </g>
+  </g>
+</svg>
diff --git a/src/pics/grids/t2ec.png b/src/pics/grids/t2ec.png
new file mode 100644
index 0000000..b280bdc
Binary files /dev/null and b/src/pics/grids/t2ec.png differ
diff --git a/src/pics/grids/t2ec.svg b/src/pics/grids/t2ec.svg
new file mode 100644
index 0000000..d0681db
--- /dev/null
+++ b/src/pics/grids/t2ec.svg
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t2ec.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel1\include\pic\grid"
+   sodipodi:modified="true">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="356.62112"
+     inkscape:cy="672.21723"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41404247;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.49988,301.87568 L 549.91661,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t2ec.png"
+       inkscape:export-xdpi="35.999977"
+       inkscape:export-ydpi="35.999977" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t2ec.png"
+       inkscape:export-xdpi="35.999977"
+       inkscape:export-ydpi="35.999977" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t2ec.png"
+       inkscape:export-xdpi="35.999977"
+       inkscape:export-ydpi="35.999977" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t2ec.png"
+       inkscape:export-xdpi="35.999977"
+       inkscape:export-ydpi="35.999977"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t2ec.png"
+       inkscape:export-xdpi="35.999977"
+       inkscape:export-ydpi="35.999977"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">1</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/grids/t3.png b/src/pics/grids/t3.png
new file mode 100644
index 0000000..c3baa8c
Binary files /dev/null and b/src/pics/grids/t3.png differ
diff --git a/src/pics/grids/t3.svg b/src/pics/grids/t3.svg
new file mode 100644
index 0000000..253dfa8
--- /dev/null
+++ b/src/pics/grids/t3.svg
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t3.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel0\include\pic\grid"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="356.62112"
+     inkscape:cy="672.21723"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 150.4865,301.87568 L 549.41649,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3068);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3066"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">1</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="139.57031"
+       y="311.11218"
+       id="text3979"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t3.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3981"
+         x="139.57031"
+         y="311.11218">2</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/grids/t4ec.png b/src/pics/grids/t4ec.png
new file mode 100644
index 0000000..9551564
Binary files /dev/null and b/src/pics/grids/t4ec.png differ
diff --git a/src/pics/grids/t4ec.svg b/src/pics/grids/t4ec.svg
new file mode 100644
index 0000000..7c2b4d6
--- /dev/null
+++ b/src/pics/grids/t4ec.svg
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t4ec.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel1\include\pic\grid"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2432"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="356.62112"
+     inkscape:cy="672.21723"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41421354;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 550.70711,102.1417 L 550.70711,301.65508"
+       id="path2436"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41404247;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.70702,101.65516 L 550.12375,101.65516"
+       id="path2434"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41404247;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.49988,301.87568 L 549.91661,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41421354;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.48662,102.3488 L 350.48662,301.86218"
+       id="path3078"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2160"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">1</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.50464"
+       y="112.36218"
+       id="text3975"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3977"
+         x="350.50464"
+         y="112.36218">2</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2432);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3066"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,397.9999,-63.42331)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="539.57031"
+       y="111.11217"
+       id="text3979"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t4ec.png"
+       inkscape:export-xdpi="36"
+       inkscape:export-ydpi="36"><tspan
+         sodipodi:role="line"
+         id="tspan3981"
+         x="539.57031"
+         y="111.11217">3</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/grids/t5.png b/src/pics/grids/t5.png
new file mode 100644
index 0000000..c6a6a3b
Binary files /dev/null and b/src/pics/grids/t5.png differ
diff --git a/src/pics/grids/t5.svg b/src/pics/grids/t5.svg
new file mode 100644
index 0000000..f78ccdc
--- /dev/null
+++ b/src/pics/grids/t5.svg
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:modified="true">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="356.62112"
+     inkscape:cy="672.21723"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 150.4865,301.87568 L 549.41649,301.87568"
+       id="path3080" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 350.48662,102.8488 L 350.48662,501.87556"
+       id="path3078" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2160"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3064);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3062"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,336.5767)" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3068);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3066"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">1</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.50464"
+       y="112.36218"
+       id="text3975"><tspan
+         sodipodi:role="line"
+         id="tspan3977"
+         x="350.50464"
+         y="112.36218">2</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="139.57031"
+       y="311.11218"
+       id="text3979"><tspan
+         sodipodi:role="line"
+         id="tspan3981"
+         x="139.57031"
+         y="311.11218">3</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.82031"
+       y="510.995"
+       id="text3983"><tspan
+         sodipodi:role="line"
+         id="tspan3985"
+         x="350.82031"
+         y="510.995">4</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/grids/t7.png b/src/pics/grids/t7.png
new file mode 100644
index 0000000..5fc4f1f
Binary files /dev/null and b/src/pics/grids/t7.png differ
diff --git a/src/pics/grids/t7.svg b/src/pics/grids/t7.svg
new file mode 100644
index 0000000..188eb6f
--- /dev/null
+++ b/src/pics/grids/t7.svg
@@ -0,0 +1,436 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel0\include\pic\grid"
+   sodipodi:docname="t7.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Lend"
+       style="overflow:visible;">
+      <path
+         id="path5959"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+         transform="scale(0.8) rotate(180) translate(12.5,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Lstart"
+       style="overflow:visible">
+      <path
+         id="path5962"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+         transform="scale(0.8) translate(12.5,0)" />
+    </marker>
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient4007"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient4011"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="356.62112"
+     inkscape:cy="712.21723"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 420,232.36218 L 280,372.36218"
+       id="path4013"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 150.4865,301.87568 L 549.41649,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 350.48662,102.8488 L 350.48662,501.87556"
+       id="path3078"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2160"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3064);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3062"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,336.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3068);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3066"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,-2.000049,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">0</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient4011);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4009"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(1.207738,0,0,1.207738,93.56013,171.104)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="276.77734"
+       y="382.36218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="276.77734"
+         y="382.36218"
+         style="font-size:50">1</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="550.50464"
+       y="312.36218"
+       id="text3975"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan3977"
+         x="550.50464"
+         y="312.36218">2</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="338.32031"
+       y="111.85437"
+       id="text3979"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan3981"
+         x="338.32031"
+         y="111.85437">3</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient4007);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4005"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.772159,0,0,0.772159,302.4403,102.0498)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <text
+       xml:space="preserve"
+       style="font-size:35px"
+       x="410.625"
+       y="242.36218"
+       id="text3983"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan3985"
+         x="410.625"
+         y="242.36218">4</tspan></text>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart);marker-end:url(#Arrow1Lend)"
+       d="M 510,152.36218 L 510,212.36218 L 570,212.36218"
+       id="path4900"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow1Lend)"
+       d="M 510,212.36218 L 490,232.36218"
+       id="path4902"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="136.94531"
+       y="313.48328"
+       id="text5971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan5973"
+         x="136.94531"
+         y="313.48328">5</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="340.94531"
+       y="515.48328"
+       id="text5975"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan5977"
+         x="340.94531"
+         y="515.48328">6</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="573"
+       y="215.36218"
+       id="text5979"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan5981"
+         x="573"
+         y="215.36218">y</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="504"
+       y="142.36218"
+       id="text5983"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan5985"
+         x="504"
+         y="142.36218">z</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="481"
+       y="245.36218"
+       id="text5987"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t7.png"
+       inkscape:export-xdpi="35.999992"
+       inkscape:export-ydpi="35.999992"><tspan
+         sodipodi:role="line"
+         id="tspan5989"
+         x="481"
+         y="245.36218">x</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/grids/t8ec.png b/src/pics/grids/t8ec.png
new file mode 100644
index 0000000..e28da69
Binary files /dev/null and b/src/pics/grids/t8ec.png differ
diff --git a/src/pics/grids/t8ec.svg b/src/pics/grids/t8ec.svg
new file mode 100644
index 0000000..f0e8e26
--- /dev/null
+++ b/src/pics/grids/t8ec.svg
@@ -0,0 +1,699 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44+devel"
+   sodipodi:docname="t8ec.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="D:\My Documents\igorwork\lel\lel1\include\pic\grid"
+   inkscape:export-filename="D:\My Documents\igorwork\lel\lel0\include\pic\grid\t27.png"
+   inkscape:export-xdpi="36"
+   inkscape:export-ydpi="36"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3048">
+      <stop
+         style="stop-color:white;stop-opacity:1;"
+         offset="0"
+         id="stop3050" />
+      <stop
+         id="stop3060"
+         offset="1"
+         style="stop-color:#fae800;stop-opacity:1;" />
+      <stop
+         style="stop-color:#f3e712;stop-opacity:0;"
+         offset="1"
+         id="stop3052" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3058"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3064"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3068"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3072"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3076"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2193"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2201"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2209"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2217"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient2220"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3270"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3272"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3274"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3276"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3278"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3280"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3282"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3284"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3286"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3288"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3450"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3452"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3454"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3456"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3458"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3460"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3462"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3464"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3466"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3048"
+       id="radialGradient3468"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="reflect"
+       cx="173.74623"
+       cy="147.2655"
+       fx="173.74623"
+       fy="147.2655"
+       r="52.380627" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.61875035"
+     inkscape:cx="-65.310144"
+     inkscape:cy="573.74699"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     showguides="true"
+     inkscape:window-width="1280"
+     inkscape:window-height="975"
+     inkscape:window-x="-4"
+     inkscape:window-y="-4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.24595022;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 420.44102,55.149605 L 596.37729,55.149605"
+       id="path3326"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.24300146;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 596.87882,56.775722 L 596.87882,231.9227"
+       id="path3332"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.24435711;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 420.43989,231.93406 L 595.92654,231.93406"
+       id="path3334"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.24450791;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 420.42815,56.350409 L 420.42815,231.92218"
+       id="path3336"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3450);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3338"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.871156,0,0,0.871156,286.2399,-89.52905)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       inkscape:export-ydpi="36.000008"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       transform="matrix(0.871156,0,0,0.871156,286.2399,-89.52905)"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       sodipodi:ry="50.507626"
+       sodipodi:rx="50.507626"
+       sodipodi:cy="167.46855"
+       sodipodi:cx="153.54318"
+       id="path3340"
+       style="opacity:0.81666667;fill:url(#radialGradient3452);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       sodipodi:type="arc" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3458);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3346"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.871156,0,0,0.871156,462.2399,86.47095)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3460);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3348"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.871156,0,0,0.871156,286.2399,86.47095)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <text
+       xml:space="preserve"
+       style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="419.53586"
+       y="240.73253"
+       id="text3350"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3352"
+         x="419.53586"
+         y="240.73253">0</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="592.68274"
+       y="240.06221"
+       id="text3354"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3356"
+         x="592.68274"
+         y="240.06221">2</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:37.12131882px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="420.444"
+       y="65.162209"
+       id="text3358"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3360"
+         x="420.444"
+         y="65.162209">4</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3462);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3370"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.871156,0,0,0.871156,462.2398,-89.52905)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <text
+       xml:space="preserve"
+       style="font-size:35.20000076px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="596.2027"
+       y="61.422157"
+       id="text3372"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3374"
+         x="596.2027"
+         y="61.422157">6</tspan></text>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41257238;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.70629,100.9839 L 549.70861,100.9839"
+       id="path2228"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41080809;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 550.99875,103.10311 L 550.99875,301.65678"
+       id="path2222"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41257238;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.70629,301.87568 L 549.70861,301.87568"
+       id="path3080"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.41240203;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 350.48662,102.65342 L 350.48662,301.65598"
+       id="path3078"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2160"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       inkscape:export-ydpi="36.000008"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       transform="matrix(0.98995,0,0,0.98995,198,-63.42333)"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       sodipodi:ry="50.507626"
+       sodipodi:rx="50.507626"
+       sodipodi:cy="167.46855"
+       sodipodi:cx="153.54318"
+       id="path3200"
+       style="opacity:0.81666667;fill:url(#radialGradient3058);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       sodipodi:type="arc" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3072);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3070"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,398,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient3076);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path3074"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,198,136.5767)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="349.47266"
+       y="311.8739"
+       id="text3967"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3969"
+         x="349.47266"
+         y="311.8739">1</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="546.23047"
+       y="311.11218"
+       id="text3971"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3973"
+         x="546.23047"
+         y="311.11218">3</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:42.18331528px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="350.50464"
+       y="112.36218"
+       id="text3975"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan3977"
+         x="350.50464"
+         y="112.36218">5</tspan></text>
+    <path
+       sodipodi:type="arc"
+       style="opacity:0.81666667;fill:url(#radialGradient2193);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.74600005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path2187"
+       sodipodi:cx="153.54318"
+       sodipodi:cy="167.46855"
+       sodipodi:rx="50.507626"
+       sodipodi:ry="50.507626"
+       d="M 204.05081 167.46855 A 50.507626 50.507626 0 1 1  103.03556,167.46855 A 50.507626 50.507626 0 1 1  204.05081 167.46855 z"
+       transform="matrix(0.98995,0,0,0.98995,397.9999,-63.42333)"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="550.23041"
+       y="108.11217"
+       id="text2189"
+       inkscape:export-filename="D:\My Documents\igorwork\lel\lel1\include\pic\grid\t8ec.png"
+       inkscape:export-xdpi="36.000008"
+       inkscape:export-ydpi="36.000008"><tspan
+         sodipodi:role="line"
+         id="tspan2191"
+         x="550.23041"
+         y="108.11217">7</tspan></text>
+  </g>
+</svg>
diff --git a/src/pics/mainDiagram.dot b/src/pics/mainDiagram.dot
new file mode 100644
index 0000000..45761b1
--- /dev/null
+++ b/src/pics/mainDiagram.dot
@@ -0,0 +1,42 @@
+digraph asl {
+	bgcolor=white;
+	node[fontsize=10, fontname="FreeSans.ttf"];
+	compound=true;
+	concentrate=true;
+	subgraph clusterASL 
+	{
+		node [style=filled,color=white];
+		style=filled;
+		color=lightblue;
+		label = "ASL";
+		Utilities
+		DataObjects
+		DataProcessingModule
+		NumericalModule
+		GeometryModule
+		IOModule
+	}
+	subgraph clusterProg 
+	{
+		node [style=filled,color=lightgrey];
+		color=black;
+		label = "Typical ASL program";
+		
+		InputFileDefinitions
+		InputFileDefinitions->DataStructure
+		InputFileDefinitions->DataInitialization
+		InputFileDefinitions->NumericalAlgorithm
+		DataStructure->DataOutput
+		InputFileDefinitions->DataOutput
+		
+	
+	}
+	Utilities->InputFileDefinitions;
+	DataObjects->DataStructure;
+	NumericalModule->NumericalAlgorithm;
+	DataProcessingModule->NumericalAlgorithm;
+	IOModule->DataOutput;
+	DataProcessingModule->DataOutput;
+}
+
+
diff --git a/src/readers/aslVTKFormatReaders.cxx b/src/readers/aslVTKFormatReaders.cxx
new file mode 100644
index 0000000..b45ed7e
--- /dev/null
+++ b/src/readers/aslVTKFormatReaders.cxx
@@ -0,0 +1,388 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslVTKFormatReaders.h"
+#include <acl/acl.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <utilities/aslVTKCasters.h>
+#include <vtkMINCImageReader.h>
+#include <vtkXMLImageDataReader.h>
+#include <vtkStructuredPointsReader.h>
+#include <vtkStructuredPoints.h>
+#include <vtkDICOMImageReader.h>
+#include <vtkImageData.h>
+#include <vtkXMLPolyDataReader.h>
+#include <vtkSTLReader.h>
+#include <vtkImplicitModeller.h>
+#include <boost/filesystem.hpp>
+#include <data/aslDataWithGhostNodes.h>
+
+using namespace boost::filesystem;
+
+namespace asl
+{
+	using namespace asl;
+	
+	SPDataWithGhostNodesACLData readMINC(const string & fileName,
+	                                     unsigned int arrayNum,
+	                                     acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkMINCImageReader> reader(vtkSmartPointer<vtkMINCImageReader>::New());
+		reader->RescaleRealValuesOn();
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("MINC reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		auto data(makeData(reader->GetOutput(), arrayNum, queue));
+		return data;
+	}
+
+
+	SPDataWithGhostNodesACLData readVTKXML(const string & fileName,
+	                                       unsigned int arrayNum,
+	                                       acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkXMLImageDataReader> reader(vtkSmartPointer<vtkXMLImageDataReader>::New());
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("VTKXML reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		auto data(makeData(reader->GetOutput(), arrayNum, queue));
+		return data;
+	}
+
+
+	SPDataWithGhostNodesACLData readVTK(const string & fileName,
+	                                    unsigned int arrayNum,
+	                                    acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkStructuredPointsReader> reader(vtkSmartPointer<vtkStructuredPointsReader>::New());
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		if (!reader->IsFileStructuredPoints())
+			errorMessage("VTK reader: The input file is corrupted or file name is wrong: " + fileName);
+
+		auto data(makeData(vtkSmartPointer<vtkStructuredPoints>(reader->GetOutput()), arrayNum, queue));
+		return data;
+	}
+
+
+	SPDataWithGhostNodesACLData readDICOM(const string & fileName,
+	                                      unsigned int arrayNum,
+	                                      acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkDICOMImageReader> reader(vtkSmartPointer<vtkDICOMImageReader>::New());
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("DICOM reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		auto data(makeData(reader->GetOutput(), arrayNum, queue));
+		return data;
+	}
+
+
+	SPDataWithGhostNodesACLData read(const string & fileName,
+	                                 unsigned int arrayNum,
+	                                 acl::CommandQueue queue)
+	{
+		string fileExtension;
+		path pathToFile(fileName);
+		fileExtension = pathToFile.extension().string();
+
+		SPDataWithGhostNodesACLData data;
+
+		if (fileExtension == ".vtk")
+			data = readVTK(fileName, arrayNum, queue);
+
+		if (fileExtension == ".vti")
+			data = readVTKXML(fileName, arrayNum, queue);
+
+		if (fileExtension == ".mnc")
+			data = readMINC(fileName, arrayNum, queue);
+
+		if (fileExtension == ".dcm")
+			data = readDICOM(fileName, arrayNum, queue);
+
+		if (data.get() == 0)
+			errorMessage("Reader: file format not supported");
+
+		return data;
+	}
+
+	SPDataWithGhostNodesACLData surfToData(vtkDataSet* surf, 
+	                                       double dx, 
+	                                       acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkImplicitModeller> modeller(vtkSmartPointer<vtkImplicitModeller>::New());
+		modeller->SetOutputScalarTypeToFloat();
+		modeller->CappingOff();
+		modeller->SetCapValue(dx*3.6);
+		modeller->SetInput(surf);
+		modeller->ComputeModelBounds(surf);
+		modeller->SetMaximumDistance(dx*1.8*2.);
+		double b[6];
+		modeller->GetModelBounds (b);
+		modeller->SetSampleDimensions((b[1]-b[0]) / dx, (b[3]-b[2]) / dx, (b[5]-b[4]) / dx);
+		modeller->SetProcessModeToPerVoxel();
+		modeller->Update();
+
+		auto data(makeData(modeller->GetOutput(), 0, queue));
+		acl::initData(data->getEContainer(), (data->getEContainer() - dx*1.8)/dx/1.8);
+
+		return data;
+	}
+
+	SPDataWithGhostNodesACLData surfToData(vtkDataSet* surf, 
+	                                       Block & b,
+	                                       acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkImplicitModeller> modeller(vtkSmartPointer<vtkImplicitModeller>::New());
+		modeller->SetOutputScalarTypeToFloat();
+		modeller->CappingOff();
+		modeller->SetCapValue(b.dx*3.6);
+		modeller->SetInput(surf);
+		modeller->SetMaximumDistance(b.dx*1.8*2.);
+		double bound[6];
+		auto bp(b.getBPosition()); 
+		bound[0]=b.position[2]; bound[1]=bp[2];
+		bound[2]=b.position[1]; bound[3]=bp[1];
+		bound[4]=b.position[0]; bound[5]=bp[0];		
+		modeller->SetModelBounds (bound);
+		int s[3];
+		s[0] = b.getSize()[2];
+		s[1] = b.getSize()[1];
+		s[2] = b.getSize()[0];
+		modeller->SetSampleDimensions(s);
+		modeller->SetProcessModeToPerVoxel();
+		modeller->Update();
+
+		auto data(makeData(modeller->GetOutput(), 0, queue));
+		acl::initData(data->getEContainer(), (data->getEContainer() - b.dx*1.2)/b.dx/1.8);
+
+		return data;
+	}
+
+	SPDataWithGhostNodesACLData surfToData(vtkDataSet* surf, 
+	                                       double dx,
+	                                       double offset_X0, double offset_XE, 
+	                              		   double offset_Y0, double offset_YE, 
+	                                	   double offset_Z0, double offset_ZE,
+	                                       acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkImplicitModeller> modeller(vtkSmartPointer<vtkImplicitModeller>::New());
+		modeller->SetOutputScalarTypeToFloat();
+		modeller->CappingOff();
+		modeller->SetCapValue(dx*3.6);
+		modeller->SetInput(surf);
+		modeller->ComputeModelBounds(surf);
+		modeller->SetMaximumDistance(dx*1.8*2.);
+		double b[6];
+		modeller->GetModelBounds (b);
+		double bound[6];		
+		bound[0]=b[0] - (b[1]-b[0])*offset_Z0; bound[1]=b[1] + (b[1]-b[0])*offset_ZE;
+		bound[2]=b[2] - (b[3]-b[2])*offset_Y0; bound[3]=b[3] + (b[3]-b[2])*offset_YE;
+		bound[4]=b[4] - (b[5]-b[4])*offset_X0; bound[5]=b[5] + (b[5]-b[4])*offset_XE;
+		modeller->SetModelBounds (bound);
+		modeller->SetSampleDimensions((bound[1]-bound[0]) / dx, 
+		                              (bound[3]-bound[2]) / dx, 
+		                              (bound[5]-bound[4]) / dx);
+		modeller->SetProcessModeToPerVoxel();
+		modeller->Update();
+
+		auto data(makeData(modeller->GetOutput(), 0, queue));
+		acl::initData(data->getEContainer(), (data->getEContainer() - dx*1.8)/dx/1.8);
+
+		return data;
+	}
+
+	
+	SPDataWithGhostNodesACLData readSurfVTKXML(const string & fileName,
+	                                           double dx,
+	                                           acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkXMLPolyDataReader> reader(vtkSmartPointer<vtkXMLPolyDataReader>::New());
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("SurfVTKXML reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+
+		return surfToData(reader->GetOutput(),dx,queue);
+	}
+
+	SPDataWithGhostNodesACLData readSurfVTKXML(const string & fileName,
+	                                           Block & b,
+	                                           acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkXMLPolyDataReader> reader(vtkSmartPointer<vtkXMLPolyDataReader>::New());
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("SurfVTKXML reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+
+		return surfToData(reader->GetOutput(),b,queue);
+	}
+
+	SPDataWithGhostNodesACLData readSurfVTKXML(const string & fileName,
+	                                           double dx,
+	                                           double offset_X0, double offset_XE, 
+	                                           double offset_Y0, double offset_YE, 
+	                                           double offset_Z0, double offset_ZE,
+	                                           acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkXMLPolyDataReader> reader(vtkSmartPointer<vtkXMLPolyDataReader>::New());
+		if (!reader->CanReadFile(fileName.c_str()))
+			errorMessage("SurfVTKXML reader: The input file is corrupted or file name is wrong: " + fileName);
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+
+		return surfToData(reader->GetOutput(),
+		                  dx,
+	                      offset_X0, offset_XE, 
+	                      offset_Y0, offset_YE, 
+	                      offset_Z0, offset_ZE,
+		                  queue);
+	}
+	
+	SPDataWithGhostNodesACLData readSurfSTL(const string & fileName,
+	                                        double dx,
+	                                        acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkSTLReader> reader(vtkSmartPointer<vtkSTLReader>::New());
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		
+		return surfToData(reader->GetOutput(),dx,queue);
+	}
+	
+	SPDataWithGhostNodesACLData readSurfSTL(const string & fileName,
+	                                        Block & b,
+	                                        acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkSTLReader> reader(vtkSmartPointer<vtkSTLReader>::New());
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		
+		return surfToData(reader->GetOutput(),b,queue);
+	}
+
+	SPDataWithGhostNodesACLData readSurfSTL(const string & fileName,
+	                                        double dx,
+	                                        double offset_X0, double offset_XE, 
+	                                        double offset_Y0, double offset_YE, 
+	                                        double offset_Z0, double offset_ZE,
+	                                        acl::CommandQueue queue)
+	{
+		vtkSmartPointer<vtkSTLReader> reader(vtkSmartPointer<vtkSTLReader>::New());
+		reader->SetFileName(fileName.c_str());
+		reader->Update();
+		
+		return surfToData(reader->GetOutput(),
+		                  dx,
+	                      offset_X0, offset_XE, 
+	                      offset_Y0, offset_YE, 
+	                      offset_Z0, offset_ZE,
+		                  queue);
+	}
+	
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                 			         double dx,
+	                                     acl::CommandQueue queue)
+	{
+		string fileExtension;
+		path pathToFile(fileName);
+		fileExtension = pathToFile.extension().string();
+
+		SPDataWithGhostNodesACLData data;
+
+		if (fileExtension == ".vtp")
+			data = readSurfVTKXML(fileName, dx, queue);
+
+		if (fileExtension == ".stl")
+			data = readSurfSTL(fileName, dx, queue);
+		
+		if (data.get() == 0)
+			errorMessage("Reader: file format not supported");
+
+		return data;		
+	}
+	
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                                     Block & b,
+	                                     acl::CommandQueue queue)
+	{
+		string fileExtension;
+		path pathToFile(fileName);
+		fileExtension = pathToFile.extension().string();
+
+		SPDataWithGhostNodesACLData data;
+
+		if (fileExtension == ".vtp")
+			data = readSurfVTKXML(fileName, b, queue);
+
+		if (fileExtension == ".stl")
+			data = readSurfSTL(fileName, b, queue);
+		
+		if (data.get() == 0)
+			errorMessage("Reader: file format not supported");
+
+		return data;		
+	}
+
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                                     double dx,
+	                                     double offset_X0, double offset_XE, 
+	                                     double offset_Y0, double offset_YE, 
+	                                     double offset_Z0, double offset_ZE,
+	                                     acl::CommandQueue queue)
+	{
+		string fileExtension;
+		path pathToFile(fileName);
+		fileExtension = pathToFile.extension().string();
+
+		SPDataWithGhostNodesACLData data;
+
+		if (fileExtension == ".vtp")
+			data = readSurfVTKXML(fileName, 
+			                      dx,
+	                              offset_X0, offset_XE, 
+	                              offset_Y0, offset_YE, 
+	                              offset_Z0, offset_ZE,
+			                      queue);
+
+		if (fileExtension == ".stl")
+			data = readSurfSTL(fileName, 
+			                   dx,
+	                           offset_X0, offset_XE, 
+	                           offset_Y0, offset_YE, 
+	                           offset_Z0, offset_ZE,
+			                   queue);
+		
+		if (data.get() == 0)
+			errorMessage("Reader: file format not supported");
+
+		return data;		
+	}
+	
+} //asl
+
+
diff --git a/src/readers/aslVTKFormatReaders.h b/src/readers/aslVTKFormatReaders.h
new file mode 100644
index 0000000..7da16e1
--- /dev/null
+++ b/src/readers/aslVTKFormatReaders.h
@@ -0,0 +1,85 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLVTKFORMATREADERS_H
+#define ASLVTKFORMATREADERS_H
+
+
+#include <stdlib.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <memory>
+#include <acl/aclHardware.h>
+#include <data/aslDataWrapper.h>
+#include <aslGenerators.h>
+
+using  namespace std;
+
+namespace agl
+{
+	class TrianglesList;
+	typedef std::shared_ptr<TrianglesList> SPTrianglesList;
+}
+
+namespace asl
+{
+	using namespace asl;
+
+//    std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
+
+	/// Reads \p arrayNum of data from a file (detecting its format through its extension)
+	/// to asl data and puts it in \p queue;
+	/// returns asl data;
+	/// Supported formats: .vtk .vti .mnc .dcm
+	/// \ingroup IO
+	SPDataWithGhostNodesACLData read(const string & fileName,
+	                                 unsigned int arrayNum,
+	                                 acl::CommandQueue queue = acl::hardware.defaultQueue);
+
+	/// Reads \p arrayNum of data from a file (detecting its format through its extension)
+	/// to asl data and puts it in \p queue;
+	/// returns asl data;
+	/// Supported formats: .vtp .stl
+	/// \ingroup IO
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                                     double dx,
+	                                     acl::CommandQueue queue = acl::hardware.defaultQueue);
+
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                                     Block & b,
+	                                     acl::CommandQueue queue = acl::hardware.defaultQueue);
+
+	// read surface with offsets retative to the surface outframe
+	SPDataWithGhostNodesACLData readSurf(const string & fileName,
+	                                     double dx,
+	                                     double offset_X0, double offset_XE, 
+	                                     double offset_Y0, double offset_YE, 
+	                                     double offset_Z0, double offset_ZE,
+	                                     acl::CommandQueue queue = acl::hardware.defaultQueue);
+	
+} // asl
+
+#endif // ASLVTKFORMATREADERS_H
+
diff --git a/src/utilities/aslGlobalSpace.h b/src/utilities/aslGlobalSpace.h
new file mode 100644
index 0000000..01fb242
--- /dev/null
+++ b/src/utilities/aslGlobalSpace.h
@@ -0,0 +1,52 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLGLOBALSPACE_H
+#define ASLGLOBALSPACE_H
+
+
+namespace asl{
+	
+	//The class describes global discrete space
+	/**
+		It is used for correct positioning of the objects and 
+		sychronisation of processes in time
+	*/
+	class GlobalSpace {
+		public:
+			typedef long int Type;
+			typedef AVec<long int> VType;
+		private:
+			const double dt;
+			const double dx;
+		public:
+			inline GlobalSpace():dx(1.),dt(1.){};
+			inline double discreteToGlobal(Type t){return dt*t;}
+			inline Type globalToDiscrete(double t){return floor(t/dt);}
+			inline Avec<double> discreteToGlobal(VType r){return dt*r;}
+			inline VType globalToDiscrete(AVec<double> t){return floor(t/dt);}
+	};
+
+}  //namespace acl
+
+#endif // ASLTIMESTAMP_H
diff --git a/src/utilities/aslMATLABCasters.cxx b/src/utilities/aslMATLABCasters.cxx
new file mode 100644
index 0000000..1f8972a
--- /dev/null
+++ b/src/utilities/aslMATLABCasters.cxx
@@ -0,0 +1,179 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslMATLABCasters.h"
+
+#include <data/aslBlocks.h>
+#include <data/aslProbe.h>
+#include <data/aslDataWrapper.h>
+#include <acl/acl.h>
+#include <acl/DataTypes/aclArray.h>
+#include <math/aslVectors.h>
+
+#include <matio.h>
+
+template <typename T> asl::AVec<T> castMATLABVector(const asl::AVec<T> &a)
+{
+	unsigned int n(nD(a));
+	asl::AVec<T> b(n>2?n:2);
+	if(n == 1)
+		b[0] = a[0]; b[1] = 1;
+	if (n >= 2)
+		b = a;
+	return b;
+}
+
+template <typename T> class MATLABTypes{};
+template <> class MATLABTypes<double>{public: 
+		const static int c=MAT_C_DOUBLE,
+						 t=MAT_T_DOUBLE;
+};
+template <> class MATLABTypes<float>{public: 
+		const static int c=MAT_C_SINGLE,
+						 t=MAT_T_SINGLE;
+};
+template <> class MATLABTypes<cl_int>{public: 
+		const static int c=MAT_C_INT32,
+						 t=MAT_C_INT32;
+};
+
+
+
+matiocpp::Var::~Var(){
+	if (var->mem_conserve && freeArray)
+		switch (var->data_type)
+		{
+			case MAT_T_DOUBLE: delete[] ((double*)var->data); break;
+			case MAT_T_SINGLE: delete[] ((float*)var->data); break;
+			case MAT_T_INT32: delete[] ((cl_int*)var->data); break;
+		}
+	Mat_VarFree(var);
+}
+
+template<typename T> matvar_t* matiocpp::Var::init(T *d, const asl::AVec<int> & size, const std::string &name)
+{
+	asl::AVec<size_t> msize(castMATLABVector(size));
+	return Mat_VarCreate(name.c_str(),
+	                 	 MATLABTypes<T>::c,
+	                   	 MATLABTypes<T>::t,
+	                   	 nD(msize),
+	                   	 &msize[0],
+	                   	 d,
+	                   	 0);
+}
+
+template<typename T> matiocpp::Var::Var(T *d, const asl::AVec<int> & size, const std::string &name, bool freeArr):
+	var(init(d,size,name)), 
+	freeArray(freeArr)
+{
+}
+
+template<typename T> matiocpp::Var::Var(T *d, unsigned int size, const std::string &name, bool freeArr):
+	var(init(d,asl::makeAVec((int)size),name)),
+	freeArray(freeArr)
+{	
+}
+
+template<typename T> matiocpp::Var::Var(std::vector<T> & d, const std::string &name):
+	var(init(&d.front(),asl::makeAVec((int)d.size()),name)),
+	freeArray(false)
+{	
+}
+
+
+namespace asl
+{
+
+	SPMatVar castMATLABCellArray(acl::Element source, const std::string &name)
+	{
+		if (!isMemBlock(source))
+			errorMessage ("Error (castMATLABCellArray): the given element is not a MemBlock type");
+		
+		if (source->getTypeID() == acl::TYPE_DOUBLE)
+		{
+			double* d=new double[source->getSize()];
+			copy(source,d);
+			return SPMatVar(new matiocpp::Var(d,source->getSize(),name));
+		}
+		if (source->getTypeID() == acl::TYPE_FLOAT)
+		{
+			float* d=new float[source->getSize()];
+			copy(source,d);
+			return SPMatVar(new matiocpp::Var(d,source->getSize(),name));
+		}
+		if (source->getTypeID() == acl::TYPE_INT)
+		{
+			int* d=new int[source->getSize()];
+			copy(source,d);
+			return SPMatVar(new matiocpp::Var(d,source->getSize(),name));
+		}
+		return SPMatVar();
+	}	
+
+	SPMatVar castMATLABCellArray(acl::Element source, const AVec<int> & size, const std::string &name)
+	{
+		if (!isMemBlock(source))
+			errorMessage ("Error (castMATLABCellArray): the given element is not a MemBlock type");
+		
+		if (source->getTypeID() == acl::TYPE_DOUBLE)
+		{
+			double* d = new double[source->getSize()];
+			copy(source, d);
+			return SPMatVar(new matiocpp::Var(d,size,name));
+		}
+		if (source->getTypeID() == acl::TYPE_FLOAT)
+		{
+			float* d = new float[source->getSize()];
+			copy(source, d);
+			return SPMatVar(new matiocpp::Var(d,size,name));
+		}
+		if (source->getTypeID() == acl::TYPE_INT)
+		{
+			int* d = new int[source->getSize()];
+			copy(source, d);
+			return SPMatVar(new matiocpp::Var(d,size,name));
+		}
+		return SPMatVar();
+	}	
+
+
+	SPMatVar castMATLABCellArray(const AbstractData & d, const std::vector<std::string> &names)
+	{
+		const Block &b(d.getBlock());
+		bool bnames(names.size()>0);
+
+		if (d.getDContainer().size()==1)
+			return castMATLABCellArray(d.getDContainer()[0],b.getSize(),bnames?names[0]:"");
+//		else
+//			for (unsigned int i(1); i < ; ++i)
+//			image->GetPointData()->AddArray(castVTKDataArray(d.getDContainer()[i],bnames?names[i]:""));
+		return SPMatVar();				
+	}
+
+	SPMatVar castMATLABCellArray(Probe &p, unsigned int component, const std::string &name)
+	{
+		return SPMatVar(new matiocpp::Var(p.getComponent(component),name));
+	}	
+	
+
+}// asl
diff --git a/src/utilities/aslMATLABCasters.h b/src/utilities/aslMATLABCasters.h
new file mode 100644
index 0000000..4dc99e1
--- /dev/null
+++ b/src/utilities/aslMATLABCasters.h
@@ -0,0 +1,81 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLMATLABCASTERS_H
+#define ASLMATLABCASTERS_H
+
+#include <memory>
+#include <string>
+#include <vector>
+
+/**
+	\defgroup MATLABInterfacing MATLAB Interfacing
+	\ingroup Interfacing
+*/
+
+namespace acl{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+}
+
+struct matvar_t;
+namespace asl{
+	template <class T> class AVec;
+}
+
+/// the matio c++ wrapper \ingroup MATLABInterfacing
+namespace matiocpp{
+	class Var{
+		private:
+			template <class T> matvar_t* init(T *d, const asl::AVec<int> & size, const std::string &name="");
+		public:
+			matvar_t* var;
+			bool freeArray;
+			inline Var(matvar_t* v,bool freeArr=false):var(v){}
+			template <class T> Var(std::vector<T> & d, const std::string &name="");			
+			template <class T> Var(T *d, unsigned int size, const std::string &name="",bool freeArr=true);
+			template <class T> Var(T *d, const asl::AVec<int> & size, const std::string &name="",bool freeArr=true);
+//			Var(T *matiocpp, const asl::AVec<int> & size, const std::string &name=""); ///!!!
+			~Var();
+	};
+}
+
+namespace asl{
+	class Block;
+	class AbstractData;
+	class Probe;
+	
+	/// @{
+	/// \ingroup MATLABInterfacing
+	typedef std::shared_ptr<matiocpp::Var> SPMatVar;
+	
+	SPMatVar castMATLABCellArray(acl::Element source, const std::string &name="");
+	SPMatVar castMATLABCellArray(acl::Element source, const AVec<int> & size, const std::string &name="");
+	SPMatVar castMATLABCellArray(const AbstractData & d, const std::vector<std::string> &names=
+	                          								std::vector<std::string>(0));	
+	SPMatVar castMATLABCellArray(Probe & p, unsigned int component, const std::string &name="");
+	/// }@
+}  //namespace acl
+
+
+#endif // ASLVTKCASTERS_H
diff --git a/src/utilities/aslParametersManager.cxx b/src/utilities/aslParametersManager.cxx
new file mode 100644
index 0000000..0dbfc9c
--- /dev/null
+++ b/src/utilities/aslParametersManager.cxx
@@ -0,0 +1,427 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "aslParametersManager.h"
+#include "../aslUtilities.h"
+#include "../acl/aclHardware.h"
+#include <math/aslVectorsDynamicLength.h>
+#include <iostream>
+#include <fstream>
+#include <boost/filesystem.hpp>
+#include <acl/aclTypesList.h>
+#include <map>
+#include <memory>
+
+using namespace std;
+using namespace boost::filesystem;
+using namespace boost::program_options;
+
+namespace asl
+{
+
+	// Auxiliary infrastructure in order to enable
+	// usage of "*" wildcard in options key and
+	// map population.
+	// This should be removed once program_options
+	// enables population of a map<string, T>.
+	//
+	//
+	// see also (add after the implementation bellow):
+	// http://stackoverflow.com/questions/15554842/boostprogram-options-parameters-with-a-fixed-and-a-variable-token
+	//
+	class PrefixStore
+	{
+		public:
+			PrefixStore(const string prefix_);
+			virtual void store(variables_map & vm) = 0;
+
+		protected:
+			string prefix;
+	};
+
+
+	template <typename T> class PrefixMapStore : public PrefixStore
+	{
+		public:
+			PrefixMapStore(const string prefix_,
+			               shared_ptr<map<string, T>> destinationMap_);
+			virtual void store(variables_map & vm);
+
+		private:
+			shared_ptr<map<string, T>> destinationMap;
+	};
+
+
+	PrefixStore::PrefixStore(const string prefix_):
+		prefix(prefix_)
+	{
+	}
+
+
+	template <typename T>
+	PrefixMapStore<T>::PrefixMapStore(const string prefix_,
+	                                  shared_ptr<map<string, T>> destinationMap_ ):
+		PrefixStore(prefix_),
+		destinationMap(destinationMap_)
+	{
+	}
+
+
+	template <typename T>
+	void PrefixMapStore<T>::store(variables_map & vm)
+	{
+		variables_map::iterator it;
+		for (it = vm.begin(); it != vm.end(); ++it)
+		{
+			if ((*it).first.find(prefix) != string::npos)
+			{
+				pair<string, T> p(it->first, it->second.as<T>());
+				destinationMap->insert(p);
+			}
+		}
+	}
+	// End of auxiliary infrastructure.
+
+
+	template <typename T> class WildcardCheck
+	{
+		public:
+			static void check(string key, shared_ptr<T> dummyPointer)
+			{
+				if (*key.rbegin() == '*')
+					errorMessage("Parameter<T>::Parameter() - attempt to use \"*\" wildcard in the option key without providing corresponding map");
+			}
+	};
+
+
+	template <typename T> class WildcardCheck<map<string, T>>
+	{
+		public:
+			static void check(string key, shared_ptr<map<string, T>> destinationMap)
+			{
+				if (*key.rbegin() != '*')
+					errorMessage("Parameter<map<string, T>>::Parameter() - no \"*\" wildcard in the option key");		
+
+				// generate prefix by cutting option key's last char - "*"
+				ParametersManager::current->addPrefix(key.substr(0, key.size() - 1),
+				                                      destinationMap);
+			}
+	};
+		
+
+
+	template <typename T>
+	Parameter<T>::Parameter(string key_,
+	                        string description_,
+	                        string units_):
+		key(key_),
+		description(description_),
+		units(units_)
+	{
+		// Adds itself to current ParametersManager
+		if (ParametersManager::current == NULL)
+			errorMessage("ParametersManager was not instantiated and is not available");
+
+		WildcardCheck<T>::check(key, parameter.p);
+
+		ParametersManager::current->add(parameter,
+		                                key,
+		                                description);
+	}
+
+	template Parameter<string>::Parameter(string key,
+	                                      string description,
+	                                      string units);
+		
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template Parameter<t>::Parameter(string key, \
+										 string description, \
+										 string units); \
+		template Parameter<AVec<t>>::Parameter(string key, \
+											   string description, \
+											   string units); \
+		template Parameter<map<string, t>>::Parameter(string key, \
+													  string description, \
+													  string units); \
+		template Parameter<map<string, AVec<t>>>::Parameter(string key, \
+															string description, \
+															string units);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+
+	template <typename T> Parameter<T>::Parameter(T defaultValue,
+	                                              string key_,
+	                                              string description_,
+	                                              string units_):
+		key(key_),
+		description(description_),
+		units(units_)
+	{
+		// Adds itself to current ParametersManager
+		if (ParametersManager::current == NULL)
+			errorMessage("ParametersManager was not instantiated and is not available");
+		
+		ParametersManager::current->add(parameter,
+		                                defaultValue,
+		                                key,
+		                                description);
+	}
+
+	template Parameter<string>::Parameter(string defaultValue,
+	                                      string key,
+	                                      string description,
+	                                      string units);
+		
+	#define BOOST_TT_rep_expression(r, data, t) \
+		template Parameter<t>::Parameter(t defaultValue, \
+										 string key, \
+										 string description, \
+										 string units); \
+		template Parameter<AVec<t>>::Parameter(AVec<t> defaultValue, \
+											   string key, \
+											   string description, \
+											   string units);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+
+	ParametersManager * ParametersManager::current(NULL);
+
+	ParametersManager::ParametersManager():
+		configurationOptions("Configuration options")
+	{
+		enable();
+	}
+
+
+	ParametersManager::~ParametersManager()
+	{
+		// Deactivates this instance of ParametersManager
+		if (current == this)
+			current = NULL;
+	}
+
+
+	void ParametersManager::enable()
+	{
+		// Activates this instance of ParametersManager
+		current = this;
+	}
+
+
+	// Function that teaches boost::program_options how to deal with AVec<>
+	template <typename T> void validate(boost::any& v,
+	                                    const std::vector<std::string>& values,
+	                                    AVec<T> *, int)
+	{
+		// Make sure no previous assignment to 'v' was made.
+		validators::check_first_occurrence(v);		
+
+		AVec<T> vec;
+		// Extract tokens from values string vector and populate AVec
+		if (values[0] == "")
+		{
+			errorMessage("ParametersManager - no value provided for a variable of type AVec<...>");
+		}
+
+		vector<T> converted;
+		stringstream strStream(values[0]);
+		string token;
+		while (!strStream.eof())
+		{
+			strStream >> token;
+			converted.push_back(strToNum<T>(token));
+		}
+
+		vec = converted;
+		v = vec;
+	}
+
+
+	template <typename T> void ParametersManager::add(UValue<T> parameter,
+	                                                  string key,
+	                                                  string description)
+	{
+		configurationOptions.add_options()
+			(key.c_str(), value<T>(&parameter.v())->required(), description.c_str());
+	}
+
+
+	template<typename T> void ParametersManager::add(UValue<map<string, T>> parameter,
+	                                                  string key,
+	                                                  string description)
+	{
+		configurationOptions.add_options()
+			(key.c_str(), value<T>()->required(), description.c_str());
+	}
+
+
+	template<typename T> void ParametersManager::add(UValue<T> parameter,
+	                                                 T defaultValue,
+	                                                 string key,
+	                                                 string description)
+	{		
+		configurationOptions.add_options()
+			(key.c_str(), value<T>(&parameter.v())->default_value(defaultValue), description.c_str());
+	}
+
+
+	template<typename T>
+	void ParametersManager::addPrefix(string prefix,
+	                                  shared_ptr<map<string, T>> destinationMap)
+	{
+		prefixes.push_back(std::make_shared<PrefixMapStore<T>>(prefix, destinationMap));
+	}
+
+
+	void ParametersManager::populateMaps(variables_map & vm)
+	{
+		for (unsigned int i = 0; i < prefixes.size(); ++i)
+		{
+			prefixes[i]->store(vm);
+		}
+	}
+
+
+	void ParametersManager::load(int argc, char * argv[],
+	                             string programName,
+	                             string programVersion)
+	{
+		variables_map vm;
+
+		options_description genericOptions("Generic options");
+
+		genericOptions.add_options()
+			("help,h", "display this help and exit")
+			("version,v", "display version and exit")
+			("devices,d", "display available devices and exit")
+			("folder,f",
+			 value<string>()->default_value("Default"),
+			 "path to the working folder that contains configuration file - parameters.ini")
+			("check,c", "check configuration for consistency and exit");
+
+		positional_options_description positional;
+		positional.add("folder", 1);
+
+		options_description allOptions;
+
+		allOptions.add(genericOptions).add(configurationOptions);
+
+		try
+		{
+			store(command_line_parser(argc, argv).options(allOptions).positional(positional).run(), vm);
+
+			if (vm.count("help"))
+			{
+				cout << "Usage: " + programName + " [WORKING_FOLDER] [OPTION]...\n"
+					 << allOptions
+					 << endl;
+				exit(0);
+			}
+
+			if (vm.count("version"))
+			{
+				cout << programName + " " + programVersion
+					 << endl;
+				exit(0);
+			}
+
+			if (vm.count("devices"))
+			{
+				cout << programName + " " + programVersion + "\n\n"
+					 << acl::hardware.getDevicesInfo()
+					 << endl;
+				exit(0);
+			}
+
+			path p(vm["folder"].as<string>());
+			// add at least one slash at the end
+			p /= "/";
+			// and then cut all possible slashes at the end
+			p = p.parent_path();
+			folder = p.string();
+			p /= "/";
+			folderWithSlash = p.string();
+			p /= "parameters.ini";
+			ifstream ifs(p.string());
+			if (!ifs)
+				warningMessage("ParametersManager::load() - can not open configuration file: " + p.string());
+
+			parsed_options parsed = parse_config_file(ifs, allOptions, true);
+			store(parsed, vm);
+			// Run error notification only after obtaining
+			// all options and dealing with "--help"
+			notify(vm);
+
+			populateMaps(vm);
+
+			// Place it after(!) notify(vm);
+			if (vm.count("check"))
+			{
+				cout << programName + " " + programVersion + "\n"
+					 << "Consistency check - successful."
+					 << endl;
+				exit(0);
+			}
+		}
+		catch(exception& e)
+		{
+			errorMessage(string("ParametersManager::load() - ") + e.what());
+		}
+	}
+
+
+	void ParametersManager::load(string configFile)
+	{
+		variables_map vm;
+
+		try
+		{
+			ifstream ifs(configFile);
+			if (!ifs)
+				errorMessage("ParametersManager::load() - Can not open configuration file: " + configFile);
+
+			parsed_options parsed = parse_config_file(ifs, configurationOptions, true);
+			store(parsed, vm);
+			notify(vm);
+			populateMaps(vm);
+		}
+		catch(exception& e)
+		{
+			errorMessage(string("ParametersManager::load() - ") + e.what());
+		}
+	}
+
+
+	string ParametersManager::getFolder()
+	{
+		return folder;
+	}
+
+
+	string ParametersManager::getFolderWithSlash()
+	{
+		return folderWithSlash;
+	}
+
+} //namespace asl
diff --git a/src/utilities/aslParametersManager.h b/src/utilities/aslParametersManager.h
new file mode 100644
index 0000000..1c16ecf
--- /dev/null
+++ b/src/utilities/aslParametersManager.h
@@ -0,0 +1,145 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLPARAMETERSMANAGER_H
+#define ASLPARAMETERSMANAGER_H
+
+#include "aslUValue.h"
+#include <boost/program_options.hpp>
+#include <map>
+#include <typeinfo>
+
+namespace asl
+{
+
+	class PrefixStore;
+
+	/// This class stores parameter's value and the information
+	/// needed to extract it from command line and/or configuration file
+	/// \ingroup LDI
+	template <typename T> class Parameter
+	{
+		public:
+			/// \p key is the parameter's identification key in the configuration file
+			/// If no default value is specified, then the parameter
+			/// is required to be specified in the configuration file.
+			Parameter(std::string key_,
+			          std::string description_,
+			          std::string units_ = "");
+			/// \p key is the parameter's identification key in the configuration file
+			/// If a default value is specified, then the parameter
+			/// is not required to be specified in the configuration file.		
+			Parameter(T defaultValue,
+			          std::string key_,
+			          std::string description_,
+			          std::string units_ = "");
+			inline const T & v() const;
+			inline T & v();
+			inline std::shared_ptr<T> p();
+
+		private:
+			UValue<T> parameter;
+			std::string key;
+			std::string description;
+			std::string units;
+	};
+
+
+	/// This class automatically accomodates newly created Parameters
+	/// and then loads them
+	class ParametersManager
+	{
+		public:
+			ParametersManager();
+			~ParametersManager();
+			/// Enables parameter loader
+			void enable();
+			/// Adds a Parameter to ParametersManager
+			template <typename T> void add(UValue<T> parameter,
+			                               std::string key,
+			                               std::string description);
+			/// Adds a group of parameters with common prefix to ParametersManager
+			template <typename T> void add(UValue<std::map<std::string, T>> parameter,
+			                               std::string key,
+			                               std::string description);
+			/// Adds a Parameter to ParametersManager
+			template <typename T> void add(UValue<T> parameter,
+			                               T defaultValue,
+			                               std::string key,
+			                               std::string description);
+			/// Adds prefix and the pointer on the respective
+			/// Parameter's destinationMap
+			template <typename T>
+			void addPrefix(const std::string prefix,
+			               std::shared_ptr<std::map<std::string, T>> destinationMap);
+
+			/// Loads all previously declared parameters
+			/// from command line and/or configuration file (provided
+			/// through command line)
+			void load(int argc, char* argv[],
+			          std::string programName = "program_name",
+			          std::string programVersion = "1.0");
+			/// Loads all previously declared parameters
+			/// from configuration file \p configFile
+			void load(std::string configFile);
+			std::string getFolder();
+			std::string getFolderWithSlash();
+
+			static ParametersManager * current;
+
+		private:
+			boost::program_options::options_description configurationOptions;
+			std::string folder;
+			std::string folderWithSlash;
+			/// Accomodates prefixes (defined by attached "*" wildcard)
+			/// using PrefixStore class
+			std::vector<std::shared_ptr<PrefixStore>> prefixes;
+
+			void populateMaps(boost::program_options::variables_map & vm);			
+	};
+
+
+
+//-------------------------- Implementation --------------------------
+
+
+	template <typename T> const T & Parameter<T>::v() const
+	{
+		return parameter.v();
+	}
+
+
+	template <typename T> T & Parameter<T>::v()
+	{
+		return parameter.v();
+	}
+
+	template <typename T> std::shared_ptr<T> Parameter<T>::p()
+	{
+		return parameter.p;
+	}
+	
+} //namespace asl
+
+
+#endif // ASLPARAMETERSMANAGER_H
diff --git a/src/utilities/aslSmartPtrUtils.h b/src/utilities/aslSmartPtrUtils.h
new file mode 100644
index 0000000..5f58c2e
--- /dev/null
+++ b/src/utilities/aslSmartPtrUtils.h
@@ -0,0 +1,39 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLSMARTPTRUTILS_H
+#define ASLSMARTPTRUTILS_H
+
+#include <memory>
+
+/// class for compatibility with std:shared_ptr \ingroup LDI
+template <typename T> class ArrayDeleter
+{
+	public:
+    	inline void operator () (T* d) const
+		{
+			delete [] d;
+    	}
+};
+
+#endif // ASLSMARTPTRUTILS_H
diff --git a/src/utilities/aslTimeStamp.cxx b/src/utilities/aslTimeStamp.cxx
new file mode 100644
index 0000000..bde2c38
--- /dev/null
+++ b/src/utilities/aslTimeStamp.cxx
@@ -0,0 +1,30 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslTimeStamp.h"
+
+namespace asl
+{
+	TimeStamp::TSType TimeStamp::tsTime(1);
+
+}// asl
diff --git a/src/utilities/aslTimeStamp.h b/src/utilities/aslTimeStamp.h
new file mode 100644
index 0000000..61fe8aa
--- /dev/null
+++ b/src/utilities/aslTimeStamp.h
@@ -0,0 +1,60 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLTIMESTAMP_H
+#define ASLTIMESTAMP_H
+
+
+namespace asl{
+
+	/// \ingroup LDI	
+	class TimeStamp {
+		public:
+			typedef long unsigned int TSType;
+		private:
+			static TSType tsTime;
+			TSType stamp;
+		public:
+			inline TimeStamp():stamp(0){};
+			inline void update(){stamp=++tsTime; tsTime=(tsTime==0?1:tsTime);}
+			inline bool needUpdate(const TimeStamp & a) const{
+				return (stamp<a.stamp) || (stamp> tsTime);
+			}
+//			friend bool operator<(const TimeStamp &a, const TimeStamp &b);
+//			friend bool operator>(const TimeStamp &a, const TimeStamp &b);
+	};
+
+/*	inline bool operator<(const TimeStamp &a, const TimeStamp &b)
+	{
+		return a.stamp<b.stamp;
+	}
+
+	inline bool operator>(const TimeStamp &a, const TimeStamp &b)
+	{
+		return a.stamp>b.stamp;
+	}
+*/
+
+}  //namespace acl
+
+#endif // ASLTIMESTAMP_H
diff --git a/src/utilities/aslTimer.h b/src/utilities/aslTimer.h
new file mode 100644
index 0000000..e37c1a3
--- /dev/null
+++ b/src/utilities/aslTimer.h
@@ -0,0 +1,70 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLTIMER_H
+#define ASLTIMER_H
+
+#include <sys/time.h>
+
+namespace asl{
+
+	/// \ingroup Utilities
+	class Timer {
+		private:
+			clock_t _c;
+			double _t;
+			inline double tod(){
+				timeval tim;
+				gettimeofday(&tim,NULL);
+				return tim.tv_sec+(tim.tv_usec/1000000.0);
+			}
+		public:
+			inline Timer():_c(0),_t(0){};
+			inline void start(){_c=-clock();_t=-tod();}
+			inline void resume(){_c-=clock();_t-=tod();}
+			inline void stop(){_c+=clock();_t+=tod();}
+			inline const double getTime() const{return _t;}
+			inline const double getClockTime() const{return (float)_c/CLOCKS_PER_SEC;}
+			inline const double getProcessorLoad() const{return getClockTime()/getTime();}
+			inline void reset(){_c=0; _t=0;}
+			inline const double getExpectedTime(double fractTime){return _t/fractTime;}
+			inline const double getLeftTime(double fractTime){return (1.-fractTime)*getExpectedTime(fractTime);}
+	};
+
+	// waits \p dt seconds, uses loop
+	inline void delay(double dt)
+	{
+		timeval t;
+		gettimeofday(&t,NULL);
+		double t0(t.tv_sec+(t.tv_usec/1000000.0));
+		double tc(t0);
+		while (t0+dt>tc)
+		{
+			gettimeofday(&t,NULL);
+			tc=t.tv_sec+(t.tv_usec/1000000.0);			
+		}
+	 }
+
+}  //namespace acl
+
+#endif // aslGeneratorS_H
diff --git a/src/utilities/aslUValue.h b/src/utilities/aslUValue.h
new file mode 100644
index 0000000..7c27843
--- /dev/null
+++ b/src/utilities/aslUValue.h
@@ -0,0 +1,68 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLUVALUE_H
+#define ASLUVALUE_H
+
+#include "aslTimeStamp.h"
+#include <memory>
+
+namespace asl
+{
+
+	/// Updatable value. This class stores value and its TimeStamp \ingroup LDI
+	template<typename T> class UValue
+	{
+		public:
+			std::shared_ptr<T> p;
+			TimeStamp ts;
+			inline explicit UValue():p(new T){}
+			inline explicit UValue(const T & a):p(new T(a)){ts.update();}
+			/// updates UValue::ts automaticaly
+			inline const T & operator=(const T& a){ts.update(); return (*p = a);}
+			inline const T & v() const {return *p;};
+			inline T & v() {return *p;};
+	};
+
+	/// \related UValue
+	template<typename T> inline bool operator==(const asl::UValue<T> & a,const T & v);
+	/// \related UValue
+	template<typename T> inline bool operator!=(const asl::UValue<T> & a,const T & v);
+
+//-------------------------- Implementation --------------------------
+
+
+	template<typename T> inline bool operator==(const asl::UValue<T> & a,const T & v)
+	{
+		return *(a.p) == v;
+	}
+
+	template<typename T> inline bool operator!=(const asl::UValue<T> & a,const T & v)
+	{
+		return *(a.p) != v;
+	}
+	
+} //namespace asl
+
+
+#endif // ASLUVALUE_H
diff --git a/src/utilities/aslVTKCasters.cxx b/src/utilities/aslVTKCasters.cxx
new file mode 100644
index 0000000..3c1b534
--- /dev/null
+++ b/src/utilities/aslVTKCasters.cxx
@@ -0,0 +1,613 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslVTKCasters.h"
+
+#include <data/aslBlocks.h>
+#include <data/aslDataWrapper.h>
+#include <acl/acl.h>
+#include <acl/DataTypes/aclArray.h>
+#include <data/aslDataWithGhostNodes.h>
+
+#include <vtkDoubleArray.h>
+#include <vtkFloatArray.h>
+#include <vtkIntArray.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkLongLongArray.h>
+#include <vtkIdTypeArray.h>
+#include <vtkPointData.h>
+
+#include <vtkImageData.h>
+
+#include "acl/aclTypesList.h"
+
+
+namespace asl
+{
+
+	template <typename T> void combineArrays(T* d1, unsigned int size, T* dTarget, unsigned int nComponents=1);
+	template <typename T> void combineArrays(T* d1, T* d2, unsigned int size, T* dTarget,unsigned int nComponents=2);	
+	template <typename T> void combineArrays(T* d1, T* d2, T* d3, unsigned int size, T* dTarget,unsigned int nComponents=3);
+	template <typename TO, typename TI> TO* combineArrays(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size);
+
+	template <typename T> void combineArrays(T* d1,
+	                                         unsigned int size,
+	                                         T* dTarget,
+	                                         unsigned int nComponents = 1)
+	{
+		if (nComponents < 1)
+			errorMessage("combineArrays() - attempt to provide nComponents that is less than 1");
+
+		for(unsigned int i(0); i < size; ++i)
+		{
+			dTarget[i * nComponents] = d1[i];
+		}
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template void combineArrays(T* d1, unsigned int size, T* dTarget, unsigned int nComponents=1);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	template <typename T> void combineArrays(T* d1,
+	                                         T* d2,
+	                                         unsigned int size,
+	                                         T* dTarget,
+	                                         unsigned int nComponents = 2)
+	{
+		if (nComponents < 2)
+			errorMessage("combineArrays() - attempt to provide nComponents that is less than 2");
+
+		for(unsigned int i(0); i < size; ++i)
+		{
+			dTarget[nComponents * i] = d1[i];
+			dTarget[nComponents * i + 1] = d2[i];
+		}
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+			template void combineArrays(T* d1, T* d2, unsigned int size, T* dTarget, unsigned int nComponents=2);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> void combineArrays(T* d1,
+	                                         T* d2,
+	                                         T* d3,
+	                                         unsigned int size,
+	                                         T* dTarget,
+	                                         unsigned int nComponents = 3)
+	{
+		if (nComponents < 3)
+			errorMessage("combineArrays() - attempt to provide nComponents that is less than 3");
+
+		for (unsigned int i(0); i < size; ++i)
+		{
+			dTarget[nComponents * i] = d1[i];
+			dTarget[nComponents * i + 1] = d2[i];
+			dTarget[nComponents * i + 2] = d3[i];
+		}
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template void combineArrays(T* d1, T* d2, T* d3, unsigned int size, T* dTarget, unsigned int nComponents=3);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+	
+	template <typename T> T* combineArrays(T* d1, T* d2, unsigned int size)
+	{
+		T* d(new T[size * 2]);
+		combineArrays(d1, d2, size, d);
+		return d;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template T* combineArrays(T* d1, T* d2, unsigned int size);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename T> T* combineArrays(T* d1, T* d2, T* d3, unsigned int size)
+	{
+		T* d(new T[size * 3]);
+		combineArrays(d1, d2, d3, size, d);
+		return d;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template T* combineArrays(T* d1, T* d2, T* d3, unsigned int size);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	template <typename TO, typename TI> TO* combineArrays(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size)
+	{
+		TO* d(new TO[size*4]);
+		for(unsigned int i(0); i < size; ++i)
+		{
+			d[4 * i] = d0[i];
+			d[4 * i + 1] = d1[i];
+			d[4 * i + 2] = d2[i];
+			d[4 * i + 3] = d3[i];
+		}
+		return d;
+	}
+
+	template vtkIdType* combineArrays<vtkIdType, unsigned int>(unsigned int* d0,
+	                                                           unsigned int* d1,
+	                                                           unsigned int* d2,
+	                                                           unsigned int* d3,
+	                                                           unsigned int size);
+
+	template <typename T> class VTKDataArrayClass{};
+	template <> class VTKDataArrayClass<cl_double>{public: typedef vtkDoubleArray T;};
+	template <> class VTKDataArrayClass<cl_float>{public: typedef vtkFloatArray T;};
+	template <> class VTKDataArrayClass<cl_int>{public: typedef vtkIntArray T;};
+	template <> class VTKDataArrayClass<cl_uint>{public: typedef vtkUnsignedIntArray T;};
+	template <> class VTKDataArrayClass<cl_long>{public: typedef vtkLongLongArray T;};
+	
+	template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill=0)
+	{
+		AVec<T> b(3);
+		if (nD(a) == 1)
+		{
+			b[0] = a[0]; b[1] = fill; b[2] = fill;
+		}
+		if (nD(a) == 2)
+		{
+			b[0] = a[1]; b[1] = a[0]; b[2] = fill;
+		}
+		if (nD(a) == 3)
+		{
+			b[0] = a[2]; b[1] = a[1]; b[2] = a[0];
+		}
+		return b;
+	}
+	
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template AVec<T> castVTKVector(AVec<T> a, T fill);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression
+
+	/// Combines 2 arrays into 3 (while 3rd one is made of '0')
+	/// and puts them in dTarget
+	template <typename T> void combine2ArraysInto3(T* d1,
+	                                               T* d2,
+	                                               unsigned int size,
+	                                               T* dTarget)
+	{
+		for (unsigned int i(0); i < size; ++i)
+		{
+			dTarget[3 * i] = d2[i];
+			dTarget[3 * i + 1] = d1[i];
+			dTarget[3 * i + 2] = 0;
+		}
+	}
+
+	template <typename T> T* combine2ArraysInto3(T* d1, T* d2, unsigned int size)
+	{
+		T* d(new T[size * 3]);
+		combine2ArraysInto3(d1, d2, size, d);
+		return d;
+	}
+	
+	
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d,
+	                                                                    unsigned int np,
+	                                                                    unsigned int save,
+	                                                                    const string &name)
+	{
+		typedef typename VTKDataArrayClass<T>::T DT;
+		vtkSmartPointer<DT> vtkArray(vtkSmartPointer<DT>::New());
+		vtkArray->SetName(name.c_str());
+		vtkArray->SetNumberOfComponents(1);
+		typedef decltype(DT::GetDataTypeValueMin()) vtkT;
+		if(sizeof(vtkT)!=sizeof(T))
+		   errorMessage("castVTKDataArray: type conversion is illegal");
+		vtkArray->SetArray((vtkT*) d, np, save);
+		return vtkArray;
+	}
+
+	
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template vtkSmartPointer<vtkDataArray> castVTKDataArray<T>(T *d, unsigned int np, unsigned int save, const string &name);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1, T *d2, unsigned int np, const string &name)
+	{
+		typedef typename VTKDataArrayClass<T>::T DT;
+		vtkSmartPointer<DT> vtkArray(vtkSmartPointer<DT>::New());
+		vtkArray->SetName(name.c_str());
+		vtkArray->SetNumberOfComponents(2);
+		typedef decltype(DT::GetDataTypeValueMin()) vtkT;
+		if(sizeof(vtkT)!=sizeof(T))
+		   errorMessage("castVTKDataArray: type convetion is illegal");
+		vtkArray->SetArray((vtkT*)combineArrays(d1, d2, np), 2 * np, 0);
+		return vtkArray;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+			template vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1, T *d2, unsigned int np, const string &name);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1, T *d2, T *d3, unsigned int np, const string &name)
+	{
+		typedef typename VTKDataArrayClass<T>::T DT;
+		vtkSmartPointer<DT> vtkArray(vtkSmartPointer<DT>::New());
+		vtkArray->SetName(name.c_str());
+		vtkArray->SetNumberOfComponents(3);
+		typedef decltype(DT::GetDataTypeValueMin()) vtkT;
+		if(sizeof(vtkT)!=sizeof(T))
+		   errorMessage("castVTKDataArray: type convetion is illegal");
+		vtkArray->SetArray((vtkT*)combineArrays(d1, d2, d3, np), 3 * np, 0);
+		return vtkArray;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1, T *d2, T *d3, unsigned int np, const string &name);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray2in3(T *d1, T *d2, unsigned int np, const string &name)
+	{
+		typedef typename VTKDataArrayClass<T>::T DT;
+		vtkSmartPointer<DT> vtkArray(vtkSmartPointer<DT>::New());
+		vtkArray->SetName(name.c_str());
+		vtkArray->SetNumberOfComponents(3);
+		typedef decltype(DT::GetDataTypeValueMin()) vtkT;
+		if(sizeof(vtkT)!=sizeof(T))
+		   errorMessage("castVTKDataArray: type convetion is illegal");
+		vtkArray->SetArray((vtkT*)combine2ArraysInto3(d1, d2, np), 3 * np, 0);
+		return vtkArray;
+	}
+
+	#define BOOST_TT_rep_expression(r, data, T) \
+		template vtkSmartPointer<vtkDataArray> castVTKDataArray2in3(T *d1, T *d2, unsigned int np, const string &name);
+	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+	#undef BOOST_TT_rep_expression	
+
+	
+	vtkSmartPointer<vtkIdTypeArray> castVTKIdTypeArray(unsigned int *d0, unsigned int *d1, unsigned int *d2, unsigned int *d3, unsigned int np, const std::string &name)	
+	{
+		vtkSmartPointer<vtkIdTypeArray> vtkArray(vtkSmartPointer<vtkIdTypeArray>::New());
+		vtkArray->SetName(name.c_str());
+		vtkArray->SetNumberOfComponents(1);
+		vtkArray->SetArray(combineArrays<vtkIdType, unsigned int>(d0, d1, d2, d3, np), 4 * np, 0);
+		return vtkArray;
+	}
+
+
+	vtkSmartPointer<vtkDataArray> castVTKDataArray(acl::Element source, const string & name)
+	{
+		if (!isMemBlock(source))
+			errorMessage ("castVTKDoubleArray(): provided element is not a MemBlock type");
+
+		if (source->getTypeID() == acl::TYPE_DOUBLE)
+		{
+			double* d = new double[source->getSize()];
+			copy(source, d);
+			return castVTKDataArray(d, source->getSize(), 0, name);
+		}
+		if (source->getTypeID() == acl::TYPE_FLOAT)
+		{
+			float* d = new float[source->getSize()];
+			copy(source, d);
+			return castVTKDataArray(d, source->getSize(), 0, name);
+		}
+		if (source->getTypeID() == acl::TYPE_INT)
+		{
+			int* d = new int[source->getSize()];
+			copy(source, d);
+			return castVTKDataArray(d, source->getSize(), 0, name);
+		}
+		return NULL;
+	}	
+
+
+	vtkSmartPointer<vtkImageData> castVTKData(const Block & b)
+	{
+		vtkSmartPointer<vtkImageData> image(vtkSmartPointer<vtkImageData>::New());
+		image->SetSpacing(b.dx,b.dx,b.dx);
+		
+		image->SetOrigin(&castVTKVector(b.position)[0]);
+		image->SetDimensions(&castVTKVector(b.getSize(),1)[0]);
+		return image;
+	}
+
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d, const Block & b, unsigned int save, const std::string &name)
+	{
+		vtkSmartPointer<vtkImageData> image(castVTKData(b));
+		image->GetPointData()->SetScalars(castVTKDataArray(d,
+		                                                   productOfElements(b.getSize()),
+		                                                   save,
+		                                                   name));
+		return image;
+	}
+
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d1, double *d2, const Block & b, const std::string &name)
+	{
+		vtkSmartPointer<vtkImageData> image(castVTKData(b));
+		image->GetPointData()->SetVectors(castVTKDataArray(d1, d2,
+		                                                   productOfElements(b.getSize()),
+		                                                   name));
+		return image;
+	}
+
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d1, double *d2, double *d3, const Block & b, const std::string &name)
+	{
+		vtkSmartPointer<vtkImageData> image(castVTKData(b));
+		image->GetPointData()->SetVectors(castVTKDataArray(d1, d2, d3,
+		                                                   productOfElements(b.getSize()),
+		                                                   name));
+		return image;
+	}
+
+
+	vtkSmartPointer<vtkImageData> castVTKData(const AbstractData & d, const vector<string> & names)
+	{
+		const Block &b(d.getBlock());
+		vtkSmartPointer<vtkImageData> image(vtkSmartPointer<vtkImageData>::New());
+		image->SetSpacing(b.dx, b.dx, b.dx);
+		
+		image->SetOrigin(&castVTKVector(b.position)[0]);
+		image->SetDimensions(&castVTKVector(b.getSize(), 1)[0]);
+		bool bnames(names.size() > 0);
+		image->GetPointData()->SetScalars(castVTKDataArray(d.getDContainer()[0], bnames ? names[0] : ""));
+		for (unsigned int i(1); i < d.getDContainer().size(); ++i)
+			image->GetPointData()->AddArray(castVTKDataArray(d.getDContainer()[i], bnames ? names[i] : ""));
+		return image;				
+	}
+
+
+	void putToVTKData(double *d, vtkSmartPointer<vtkImageData> target)
+	{
+		double *dTarget(((vtkDoubleArray *) target->GetPointData()->GetArray(0))->GetPointer(0));
+		unsigned int size(target->GetPointData()->GetArray(0)->GetNumberOfTuples());
+		unsigned int nComponents(target->GetPointData()->GetArray(0)->GetNumberOfComponents());
+		combineArrays(d, size, dTarget, nComponents);
+	}
+
+
+	void putToVTKData(double *d1, double *d2, vtkSmartPointer<vtkImageData> target)
+	{
+		double *dTarget(((vtkDoubleArray *) target->GetPointData()->GetArray(0))->GetPointer(0));
+		unsigned int size(target->GetPointData()->GetArray(0)->GetNumberOfTuples());
+		unsigned int nComponents(target->GetPointData()->GetArray(0)->GetNumberOfComponents());
+		combineArrays(d1, d2, size, dTarget, nComponents);
+	}
+
+
+	void putToVTKData(double *d1, double *d2, double *d3, vtkSmartPointer<vtkImageData> target)
+	{
+		double *dTarget(((vtkDoubleArray *) target->GetPointData()->GetArray(0))->GetPointer(0));
+		unsigned int size(target->GetPointData()->GetArray(0)->GetNumberOfTuples());
+		unsigned int nComponents(target->GetPointData()->GetArray(0)->GetNumberOfComponents());
+		combineArrays(d1, d2, d3, size, dTarget, nComponents);
+	}
+
+
+	template <typename T> void decomposeArrays(T* d, T* d1, T* d2, unsigned int size)
+	{
+		for (unsigned int i(0); i < size; ++i)
+		{
+			d1[i] = d[2 * i];
+			d2[i] = d[2 * i + 1];
+		}
+	}
+
+	template void decomposeArrays<double>(double* d, double* d1, double* d2, unsigned int size);
+	template void decomposeArrays<float>(float* d, float* d1, float* d2, unsigned int size);
+	template void decomposeArrays<int>(int* d, int* d1, int* d2, unsigned int size);
+	template void decomposeArrays<unsigned int>(unsigned int* d, unsigned int* d1, unsigned int* d2, unsigned int size);
+
+	template <typename T> void decomposeArrays(T* d, T* d1, T* d2, T* d3, unsigned int size)
+	{
+		for (unsigned int i(0); i < size; ++i)
+		{
+			d1[i] = d[3 * i];
+			d2[i] = d[3 * i + 1];
+			d3[i] = d[3 * i + 2];
+		}
+	}
+
+	template void decomposeArrays<double>(double* d, double* d1, double* d2, double* d3, unsigned int size);
+	template void decomposeArrays<float>(float* d, float* d1, float* d2, float* d3, unsigned int size);
+	template void decomposeArrays<int>(int* d, int* d1, int* d2, int* d3, unsigned int size);
+	template void decomposeArrays<unsigned int>(unsigned int* d, unsigned int* d1, unsigned int* d2, unsigned int* d3, unsigned int size);
+
+
+	// Creates destination arrays (they need to be deleted outside after being used!),
+	// transfers data from \p source to \p destination.
+	template <typename T> void decomposeVTKDataArray(vtkDataArray * source,
+	                                                 vector<T *> & destination)
+	{
+		typedef typename VTKDataArrayClass<T>::T DataType;
+		
+		unsigned int numOfComponents(source->GetNumberOfComponents());
+		unsigned int numOfTuples(source->GetNumberOfTuples());
+
+		for (unsigned int i = 0; i < numOfComponents; ++i)
+		{
+			destination.push_back(new T[numOfTuples]);
+		}
+
+		DataType * array((DataType *) source);
+		for (unsigned int i = 0; i < numOfTuples; ++i)
+		{
+			for (unsigned int j = 0; j < numOfComponents; ++j)
+			{
+				destination[j][i] = array->GetValue(numOfComponents * i + j);
+			}
+		}
+	}
+
+	template void decomposeVTKDataArray<double>(vtkDataArray * source,
+	                                            vector<double *> & destination);
+	template void decomposeVTKDataArray<float>(vtkDataArray * source,
+	                                           vector<float *> & destination);
+	template void decomposeVTKDataArray<int>(vtkDataArray * source,
+	                                         vector<int *> & destination);
+	template void decomposeVTKDataArray<unsigned int>(vtkDataArray * source,
+	                                                  vector<unsigned int *> & destination);
+
+	std::shared_ptr<Block> makeBlock(vtkSmartPointer<vtkImageData> image)
+	{
+		int dims[3];
+		image->GetDimensions(dims);
+
+		double spacing[3];
+		image->GetSpacing(spacing);
+
+		double origin[3];
+		int extent[6];
+		image->GetOrigin(origin);
+		image->GetExtent(extent);
+		origin[0]+=extent[0]*spacing[0];
+		origin[1]+=extent[2]*spacing[1];
+		origin[2]+=extent[4]*spacing[2];
+		
+		shared_ptr<Block> block(new Block(makeAVec<int>(dims[2], dims[1], dims[0]),
+		                                  spacing[0],
+		                                  makeAVec<double>(origin[2], origin[1], origin[0])));
+
+		return block;
+	}
+
+
+	// Converts vtk data type into asl data type;
+	// exits if non-supported data type is provided.
+	acl::TypeID aslType(int vtkType)
+	{
+		acl::TypeID t(acl::TYPE_INT);
+		switch (vtkType)
+		{
+			case VTK_INT :
+				t = acl::TYPE_INT;
+				break;
+			case VTK_UNSIGNED_INT :
+				t = acl::TYPE_UINT;
+				break;
+			case VTK_FLOAT :
+				t = acl::TYPE_FLOAT;
+				break;
+			case VTK_DOUBLE :
+				t = acl::TYPE_DOUBLE;
+				break;
+			case VTK_LONG :
+				t = acl::TYPE_LONG;
+				break;
+			default :
+				errorMessage("aslType - vtk data type not recognized: " + numToStr(vtkType));
+				break;
+		}
+		return t;
+	}
+	
+	SPDataWithGhostNodesACLData makeData(vtkSmartPointer<vtkImageData> image,
+	                                     unsigned int arrayNum,
+	                                     acl::CommandQueue queue)
+	{
+
+		if ((int)arrayNum >= image->GetPointData()->GetNumberOfArrays())
+			errorMessage("makeData() - arrayNum out of range");
+
+		shared_ptr<Block> block = makeBlock(image);
+		acl::TypeID type = aslType(image->GetPointData()->GetArray(arrayNum)->GetDataType());
+		unsigned int numOfComponents(image->GetPointData()->GetArray(arrayNum)->GetNumberOfComponents());
+		SPDataWithGhostNodesACLData data = generateDataContainerACL_SP(offset(*block,-1),
+		                                                               type,
+		                                                               numOfComponents,
+		                                                               1,
+		                                                               queue);
+
+		switch (type)
+		{
+			case acl::TYPE_INT :
+			{
+				vector<cl_int *> decomposedData;
+				decomposeVTKDataArray<cl_int>(image->GetPointData()->GetArray(arrayNum),
+				                              decomposedData);
+				for (unsigned int i = 0; i < decomposedData.size(); ++i)
+				{
+					copy(decomposedData[i], data->getDContainer()[i]);
+					delete[] decomposedData[i];
+				}
+				break;
+			}
+			case acl::TYPE_UINT :
+			{
+				vector<cl_uint *> decomposedData;
+				decomposeVTKDataArray<cl_uint>(image->GetPointData()->GetArray(arrayNum),
+				                               decomposedData);
+				for (unsigned int i = 0; i < decomposedData.size(); ++i)
+				{
+					copy(decomposedData[i], data->getDContainer()[i]);
+					delete[] decomposedData[i];
+				}
+				break;
+			}
+			case acl::TYPE_FLOAT :
+			{
+				vector<cl_float *> decomposedData;
+				decomposeVTKDataArray<cl_float>(image->GetPointData()->GetArray(arrayNum),
+				                                decomposedData);
+				for (unsigned int i = 0; i < decomposedData.size(); ++i)
+				{
+					copy(decomposedData[i], data->getDContainer()[i]);
+					delete[] decomposedData[i];
+				}
+				break;
+			}
+			case acl::TYPE_DOUBLE :
+			{
+				vector<cl_double *> decomposedData;
+				decomposeVTKDataArray<cl_double>(image->GetPointData()->GetArray(arrayNum),
+				                                 decomposedData);
+				for (unsigned int i = 0; i < decomposedData.size(); ++i)
+				{
+					copy(decomposedData[i], data->getDContainer()[i]);
+					delete[] decomposedData[i];
+				}
+				break;
+			}
+			case acl::TYPE_LONG :
+			{
+				vector<cl_long *> decomposedData;
+				decomposeVTKDataArray<cl_long>(image->GetPointData()->GetArray(arrayNum),
+				                               decomposedData);
+				for (unsigned int i = 0; i < decomposedData.size(); ++i)
+				{
+					copy(decomposedData[i], data->getDContainer()[i]);
+					delete[] decomposedData[i];
+				}
+				break;
+			}
+		}		
+
+		return data;
+	}
+	
+		
+} // asl
diff --git a/src/utilities/aslVTKCasters.h b/src/utilities/aslVTKCasters.h
new file mode 100644
index 0000000..9ed6a8f
--- /dev/null
+++ b/src/utilities/aslVTKCasters.h
@@ -0,0 +1,174 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLVTKCASTERS_H
+#define ASLVTKCASTERS_H
+
+#include <memory>
+#include <string>
+#include <vector>
+#include <vtkSmartPointer.h>
+#include <acl/aclHardware.h>
+#include <aslGenerators.h>
+#include <math/aslVectors.h>
+
+/**
+	\defgroup VTKInterfacing VTK Interfacing
+	\ingroup Interfacing
+*/
+
+class vtkDataArray; 
+class vtkImageData;
+class vtkIdTypeArray;
+
+namespace acl
+{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+}
+
+namespace asl
+{
+	class Block;
+	class AbstractData;
+	
+	
+	/// @{
+	/// \ingroup VTKInterfacing
+
+	/// creates VTKDataArray with 1 component \p d and length \p np and \p name 
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d,
+	                                                                    unsigned int np,
+	                                                                    unsigned int save = 0,
+	                                                                    const std::string &name = "");
+
+	/// creates VTKDataArray with 2 component \p d1 and \p d2 and length \p np and \p name 
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1,
+	                                                                    T *d2,
+	                                                                    unsigned int np,
+	                                                                    const std::string &name = "");	
+
+	/// creates VTKDataArray with 3 component \p d1, \p d2 and \p d3 and length \p np and \p name 
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray(T *d1,
+	                                                                    T *d2,
+	                                                                    T *d3,
+	                                                                    unsigned int np,
+	                                                                    const std::string &name = "");	
+
+	/// creates VTKDataArray with 3 component \p d2, \p d1 and 0 and length \p np and \p name 
+	template<typename T> vtkSmartPointer<vtkDataArray> castVTKDataArray2in3(T *d1, T *d2, 
+	                                                                        unsigned int np, 
+	                                                                        const std::string &name);
+
+	
+	/// creates VTKDataArray with 3 component \p d1, \p d2 and \p d3 and length \p np and \p name 
+	vtkSmartPointer<vtkIdTypeArray> castVTKIdTypeArray(unsigned int *d0,
+	                                                   unsigned int *d1,
+	                                                   unsigned int *d2,
+	                                                   unsigned int *d3,
+	                                                   unsigned int np,
+	                                                   const std::string &name = "");	
+
+	vtkSmartPointer<vtkDataArray> castVTKDataArray(acl::Element source,
+	                                               const std::string &name = "");
+
+	vtkSmartPointer<vtkImageData> castVTKData(const Block & b);	
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d,
+	                                          const Block & b,
+	                                          unsigned int save = 0,
+	                                          const std::string &name = "");
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d1,
+	                                          double *d2,
+	                                          const Block & b,
+	                                          const std::string &name = "");
+
+	vtkSmartPointer<vtkImageData> castVTKData(double *d1,
+	                                          double *d2,
+	                                          double *d3,
+	                                          const Block & b,
+	                                          const std::string &name = "");
+
+	void putToVTKData(double *d, vtkSmartPointer<vtkImageData> target);
+	void putToVTKData(double *d1, double *d2, vtkSmartPointer<vtkImageData> target);
+	void putToVTKData(double *d1, double *d2, double *d3, vtkSmartPointer<vtkImageData> target);
+
+	
+	vtkSmartPointer<vtkImageData> castVTKData(const AbstractData & d,
+	                                          const std::vector<std::string> &names = std::vector<std::string>(0));	
+
+	SPDataWithGhostNodesACLData makeData(vtkSmartPointer<vtkImageData> image,
+	                                     unsigned int arrayNum = 0,
+	                                     acl::CommandQueue queue = acl::hardware.defaultQueue);
+	
+	std::shared_ptr<Block> makeBlock(vtkSmartPointer<vtkImageData> image);
+	
+	template<typename T> inline vtkSmartPointer<vtkDataArray> castVTKDataArray(std::shared_ptr<T> d,
+	                                                                           unsigned int np,
+	                                                                           const std::string &name = "")
+	{
+		return castVTKDataArray(d.get(), np, 1, name);	
+	}
+	
+	vtkSmartPointer<vtkImageData> inline castVTKData(std::shared_ptr<double> d,
+	                                                 const Block & b,
+	                                                 const std::string &name = "")
+	{
+		return castVTKData(d.get(), b, 1, name);	
+	}
+
+
+	template<typename T> inline vtkSmartPointer<vtkDataArray> castVTKDataArray(std::vector<T> & d,
+	                                                                           unsigned int np,
+	                                                                           const std::string &name = "")
+	{
+		return castVTKDataArray(&d.front(), np, 1, name);	
+	}
+	
+
+	vtkSmartPointer<vtkImageData> inline castVTKData(std::vector<double> & d,
+	                                                 const Block & b,
+	                                                 const std::string &name = "")
+	{
+		return castVTKData(&d.front(), b, 1, name);	
+	}
+
+
+	template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill = 0);
+
+
+	template <typename T> void combineArrays(T* d1,
+	                                         T* d2,
+	                                         T* d3,
+	                                         unsigned int size,
+	                                         T* dTarget,
+	                                         unsigned int nComponents = 3);
+	/// @}
+	
+}  //namespace acl
+
+//--------------------------------Implementation------------------------
+
+
+#endif // ASLVTKCASTERS_H
diff --git a/src/utilities/aslVTKDataGenerators.cxx b/src/utilities/aslVTKDataGenerators.cxx
new file mode 100644
index 0000000..85ea0eb
--- /dev/null
+++ b/src/utilities/aslVTKDataGenerators.cxx
@@ -0,0 +1,45 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+// ToDo: remove if not needed! (also from Makefile.am)
+
+#include "aslVTKDataGenerators.h"
+
+#include <data/aslBlocks.h>
+#include <data/aslDataWrapper.h>
+#include <acl/acl.h>
+#include <acl/DataTypes/aclArray.h>
+
+#include <vtkDoubleArray.h>
+#include <vtkFloatArray.h>
+#include <vtkIntArray.h>
+#include <vtkIdTypeArray.h>
+#include <vtkPointData.h>
+
+#include <vtkImageData.h>
+
+
+namespace asl
+{
+
+} // asl
diff --git a/src/utilities/aslVTKDataGenerators.h b/src/utilities/aslVTKDataGenerators.h
new file mode 100644
index 0000000..4b509d2
--- /dev/null
+++ b/src/utilities/aslVTKDataGenerators.h
@@ -0,0 +1,59 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+// ToDo: remove if not needed! (also from Makefile.am)
+
+#ifndef ASLVTKDATAGENERATORS_H
+#define ASLVTKDATAGENERATORS_H
+
+#include <memory>
+#include <string>
+#include <vector>
+#include <vtkSmartPointer.h>
+
+#include <data/aslDataWrapper.h>
+
+class vtkDataArray; 
+class vtkImageData;
+class vtkIdTypeArray;
+
+namespace acl{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+}
+
+namespace asl{
+	class Block;
+	class AbstractData;
+	
+	
+	/// @{
+	/// \ingroup VTKInterfacing
+	/// @}
+	
+}  //namespace acl
+
+//--------------------------------Implementation------------------------
+
+
+#endif // VTKDATAGENERATORS_H
diff --git a/src/writers/aslABDFormat.cxx b/src/writers/aslABDFormat.cxx
new file mode 100644
index 0000000..06903b9
--- /dev/null
+++ b/src/writers/aslABDFormat.cxx
@@ -0,0 +1,86 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslABDFormat.h"
+
+#include "data/aslBlocks.h"
+#include <acl/acl.h>
+#include <utilities/aslSmartPtrUtils.h>
+#include <acl/DataTypes/aclArray.h>
+
+using  namespace std;
+
+namespace asl {
+
+	ABDFileOut & operator <<(ABDFileOut & f, const Block &b)
+	{
+		f<<b.dx<<b.getSize()<<b.position;		
+		return f;
+	}
+
+	ABDFileIn & operator >>(ABDFileIn & f,Block &b)
+	{
+		double dx(0);
+		Block::V pos;
+		Block::DV size;
+		f>>dx>>size>>pos;
+
+		b.dx=dx;
+		b.position=pos;
+		b.setSize(size);
+		
+		return f;
+	}
+
+	ABDFileOut & operator <<(ABDFileOut & f, const AbstractData &a)
+	{
+		unsigned int s(a.getDContainer()[0]->getSize());
+		double* d=new double[s];
+		copy(a.getDContainer()[0],d);
+		f<<std::make_pair(d,s);
+		delete[] d;
+		return f;
+	}
+
+	ABDFileIn & operator >>(ABDFileIn & f, AbstractData &a)
+	{
+		std::shared_ptr<double> d(acl::map<double>(a.getDContainer()[0]));
+		unsigned int s(a.getDContainer()[0]->getSize());
+		f>>std::make_pair(d.get(),s);
+		return f;
+	}
+
+	ABDFileIn & get(ABDFileIn & f, AbstractData &a, std::shared_ptr<double> d)
+	{
+		unsigned int s(a.getDContainer()[0]->getSize());
+		if (d.get()==0)
+			d.reset(new double[s],ArrayDeleter<double>());
+		f>>std::make_pair(d.get(),s);
+		copy(d.get(),a.getDContainer()[0]);
+		return f;
+	}
+	
+	
+} //asl
+
+
diff --git a/src/writers/aslABDFormat.h b/src/writers/aslABDFormat.h
new file mode 100644
index 0000000..39086bb
--- /dev/null
+++ b/src/writers/aslABDFormat.h
@@ -0,0 +1,247 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLABDFORMAT_H
+#define ASLABDFORMAT_H
+
+#include <stdlib.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <memory>
+
+#include <data/aslDataWrapper.h>
+
+using  namespace std;
+
+namespace asl {
+
+	/**
+		\defgroup ABDFormat ASL Binary Dump (ABD) format
+		\ingroup IO
+	 */
+	
+	/// ABD (ASL Binary Dump) file, input
+	/**
+		 \ingroup ABDFormat
+	*/
+	class ABDFileIn: public std::ifstream{
+		public:
+			inline ABDFileIn();
+			inline ABDFileIn(string name);
+	};
+
+	/// ABD (ASL Binary Dump) file, output
+	/**
+		 \ingroup ABDFormat
+	*/
+	class ABDFileOut: public std::ofstream{
+		public:
+			inline ABDFileOut();
+			inline ABDFileOut(string name);
+	};
+	
+/*	/// \relates ABDFileOut
+	template <typename T> inline ABDFileOut & operator <<(ABDFileOut & f, const T & a);
+	/// \relates ABDFileIn
+	template <typename T> inline ABDFileIn & operator >>(ABDFileIn & f,T & a);
+*/
+	
+	/// \relates ABDFileOut
+	inline ABDFileOut & operator <<(ABDFileOut & f, const int a);
+	/// \relates ABDFileIn
+	inline ABDFileIn & operator >>(ABDFileIn & f,int & a);
+	/// \relates ABDFileOut
+	inline ABDFileOut & operator <<(ABDFileOut & f, const unsigned int a);
+	/// \relates ABDFileIn
+	inline ABDFileIn & operator >>(ABDFileIn & f, unsigned int & a);
+	/// \relates ABDFileOut
+	inline ABDFileOut & operator <<(ABDFileOut & f, const float a);
+	/// \relates ABDFileIn
+	inline ABDFileIn & operator >>(ABDFileIn & f,float & a);
+	/// \relates ABDFileOut
+	inline ABDFileOut & operator <<(ABDFileOut & f, const double a);
+	/// \relates ABDFileIn
+	inline ABDFileIn & operator >>(ABDFileIn & f,double & a);
+	
+	
+	/// \relates ABDFileOut
+	template <typename T> inline ABDFileOut & operator <<(ABDFileOut & f,pair<T*, unsigned int> a);
+	/// \relates ABDFileIn
+	template <typename T> inline ABDFileIn & operator >>(ABDFileIn & f,pair<T*, unsigned int> a);
+
+	/// \relates ABDFileOut	
+	inline ABDFileOut & operator <<(ABDFileOut & f, const string &a);
+	/// \relates ABDFileIn	
+	inline ABDFileIn & operator >>(ABDFileIn & f,string &a);
+
+	/// \relates ABDFileOut
+	template <typename T> inline ABDFileOut & operator <<(ABDFileOut & f, const AVec<T> & a);
+	/// \relates ABDFileIn
+	template <typename T> inline ABDFileIn & operator >>(ABDFileIn & f,AVec<T> & a);
+
+	class Block;
+	
+	/// \relates ABDFileOut	
+	ABDFileOut & operator <<(ABDFileOut & f, const Block &a);
+	/// \relates ABDFileIn	
+	ABDFileIn & operator >>(ABDFileIn & f, Block &a);
+
+	class AbstractData;
+	
+	/// writes data. It is assumed that the Block is written separately \relates ABDFileOut	
+	/**
+		 The function writes only the first element
+	*/
+	ABDFileOut & operator <<(ABDFileOut & f, const AbstractData &a);
+
+	/// reads data. It is assumed that the class has the propper size \relates ABDFileIn	
+	/**
+		 The function writes only the first element
+	*/
+	ABDFileIn & operator >>(ABDFileIn & f, AbstractData &a);
+
+	/// reads data. It is assumed that the class has the propper size \relates ABDFileIn	
+	/**
+		 The function reads only the first element. Additionaly it creates and 
+		 stores data in the memory \p d; in case of d.get()==0 defineds whether 
+		 the new d should be allocated
+	*/
+	ABDFileIn & get(ABDFileIn & f, AbstractData &a, std::shared_ptr<double> d);
+		 		
+	/// writes \p data in a file with ABD (ASL Binary Dump) format
+	/**
+		 \ingroup ABDFormat
+	*/
+	void writeABD(const string &fileName, const AbstractData & data, const string & name);
+
+
+//------------------------IMPLEMENTATION------------------------------
+
+	ABDFileIn::ABDFileIn():ifstream()
+	{};
+	ABDFileIn::ABDFileIn(string name):
+		ifstream(name,ios::in | ios::binary)
+	{}	
+
+	ABDFileOut::ABDFileOut():ofstream()
+	{}
+	ABDFileOut::ABDFileOut(string name):
+		ofstream(name,ios::out | ios::binary)
+	{}
+
+	inline ABDFileOut & operator <<(ABDFileOut & f, const int a)
+	{
+		f.write((char*)&a,sizeof(int)); 
+		return f;
+	}
+
+	inline ABDFileIn & operator >>(ABDFileIn & f,int & a)
+	{
+		f.read((char*)&a,sizeof(int)); 
+		return f;
+	}
+
+	inline ABDFileOut & operator <<(ABDFileOut & f, const unsigned int a)
+	{
+		f.write((char*)&a,sizeof(unsigned int)); 
+		return f;
+	}
+
+	inline ABDFileIn & operator >>(ABDFileIn & f, unsigned int & a)
+	{
+		f.read((char*)&a,sizeof(unsigned int)); 
+		return f;
+	}
+
+	inline ABDFileOut & operator <<(ABDFileOut & f, const float a)
+	{
+		f.write((char*)&a,sizeof(float)); 
+		return f;
+	}
+
+	inline ABDFileIn & operator >>(ABDFileIn & f,float & a)
+	{
+		f.read((char*)&a,sizeof(float)); 
+		return f;
+	}
+
+	inline ABDFileOut & operator <<(ABDFileOut & f, const double a)
+	{
+		f.write((char*)&a,sizeof(double)); 
+		return f;
+	}
+
+	inline ABDFileIn & operator >>(ABDFileIn & f,double & a)
+	{
+		f.read((char*)&a,sizeof(double)); 
+		return f;
+	}
+		
+
+	template <typename T> inline ABDFileOut & operator <<(ABDFileOut & f,pair<T*, unsigned int> a)
+	{
+		f.write((char*)a.first,sizeof(T)*a.second); 
+		return f;
+	}
+	template <typename T> inline ABDFileIn & operator >>(ABDFileIn & f,pair<T*, unsigned int> a)
+	{
+		f.read((char*)a.first,sizeof(T)*a.second); 
+		return f;
+	}
+	
+	inline ABDFileOut & operator <<(ABDFileOut & f, const string &a){
+		unsigned int n=a.size();
+		f<<n<<make_pair(&a[0],n);
+		return f;
+	}
+
+	inline ABDFileIn & operator >>(ABDFileIn & f,string &a){
+		unsigned int n;
+		f>>n; a.resize(n);
+		f>>make_pair(a.data(),n);
+		return f;
+	}
+
+	template <typename T> inline ABDFileOut & operator <<(ABDFileOut & f, const AVec<T> & a)
+	{
+		unsigned int n(a.getSize());
+		f<<n<<make_pair(&(a[0]),n);
+		return f;
+	}
+
+	template <typename T> inline ABDFileIn & operator >>(ABDFileIn & f,AVec<T> & a)
+	{
+		unsigned int n(0);
+		f>>n; 
+		a.resize(n);
+		f>>make_pair(&(a[0]),n);
+		return f;
+	}
+
+		
+}// asl
+
+#endif //ASLVTKFORMAT_H
+
diff --git a/src/writers/aslMATFormat.cxx b/src/writers/aslMATFormat.cxx
new file mode 100644
index 0000000..71524ed
--- /dev/null
+++ b/src/writers/aslMATFormat.cxx
@@ -0,0 +1,95 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslMATFormat.h"
+
+#include <matio.h>
+
+#include <utilities/aslMATLABCasters.h>
+#include <data/aslDataWrapper.h>
+#include <data/aslProbe.h>
+
+#include "math/aslVectors.h"
+#include "acl/acl.h"
+
+using  namespace std;
+
+namespace asl {
+
+	void writeMAT(const string &fileName, const AbstractData & data, const string & name)
+	{
+		mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL <http://asl.org.il>"));
+
+		unsigned int nComp(data.getDContainer().size());
+		std::vector<string> names(nComp,name);
+		for (unsigned int i(0); i < nComp; ++i)
+			names[i]+="-"+numToStr(i);
+
+		SPMatVar var(castMATLABCellArray(data,names));
+		Mat_VarWrite(matFile,var->var, 0);
+        Mat_Close(matFile);
+	}
+
+
+	void writeMAT(const string &fileName, vector<pair<SPAbstractData,string>> data)
+	{
+		mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL <http://asl.org.il>"));
+
+		for(unsigned int k(0); k<data.size(); ++k)
+		{
+			unsigned int nComp(data[k].first->getDContainer().size());
+			std::vector<string> names(nComp,data[k].second);
+			for (unsigned int i(0); i < nComp; ++i)
+				names[i]+="-"+numToStr(i);
+
+			SPMatVar var(castMATLABCellArray(*data[k].first,names));
+			Mat_VarWrite(matFile,var->var, 0);
+		}
+        Mat_Close(matFile);		
+	}
+
+	void writeMAT(const string &fileName, vector<pair<acl::Element,string>> data)
+	{
+		mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL <http://asl.org.il>"));
+
+		for(unsigned int k(0); k<data.size(); ++k)
+		{
+			SPMatVar var(castMATLABCellArray(data[k].first,data[k].second));
+			Mat_VarWrite(matFile,var->var, 0);
+		}
+        Mat_Close(matFile);		
+	}
+	
+	
+	void writeMAT(const string &fileName,Probe & probe, unsigned int component, const string & name)
+	{
+		mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL <http://asl.org.il>"));
+
+		SPMatVar var(castMATLABCellArray(probe,component,name));
+		Mat_VarWrite(matFile,var->var, 0);
+        Mat_Close(matFile);
+	}
+		
+} //asl
+
+
diff --git a/src/writers/aslMATFormat.h b/src/writers/aslMATFormat.h
new file mode 100644
index 0000000..3a1bfad
--- /dev/null
+++ b/src/writers/aslMATFormat.h
@@ -0,0 +1,82 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLMATFORMAT_H
+#define ASLMATFORMAT_H
+
+
+#include <stdlib.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <memory>
+#include <vector>
+
+
+using  namespace std;
+
+namespace acl{
+	class ElementBase;
+	typedef std::shared_ptr<ElementBase> Element;
+}
+
+namespace asl {
+	class AbstractData;
+	class Probe;
+	typedef shared_ptr<AbstractData> SPAbstractData;
+	/// writes \p data in a MatLab file  
+	/**
+		 \ingroup IO
+	*/
+	void writeMAT(const string &fileName, const AbstractData & data, const string & name);
+
+	/// writes \p data in a MatLab file  
+	/**
+		 \ingroup IO
+		 \param fileName name of the file;
+		 \param data is vector which contains pairs of the corresponding 
+		 data and its name
+	*/
+	void writeMAT(const string &fileName, vector<pair<SPAbstractData,string>> data);
+
+	/// writes \p data in a MatLab file  
+	/**
+		 \ingroup IO
+		 \param fileName name of the file;
+		 \param data is vector which contains pairs of the corresponding 
+		 data and its name
+	*/
+	void writeMAT(const string &fileName, vector<pair<acl::Element,string>> data);
+
+	
+	/// writes \p probe values in a MatLab file  
+	/**
+		 \ingroup IO
+	*/
+	void writeMAT(const string &fileName, Probe & probe, unsigned int component, const string & name);
+
+}// asl
+
+#endif //ASLVTKFORMAT_H
+
diff --git a/src/writers/aslVTKFormatWriters.cxx b/src/writers/aslVTKFormatWriters.cxx
new file mode 100644
index 0000000..8474439
--- /dev/null
+++ b/src/writers/aslVTKFormatWriters.cxx
@@ -0,0 +1,150 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslVTKFormatWriters.h"
+#include <utilities/aslVTKCasters.h>
+//#include <agl/vtk/aglVTK.h>
+
+#include <vtkXMLImageDataWriter.h>
+#include <vtkXMLPolyDataWriter.h>
+#include <vtkPolyData.h>
+#include <vtkPointData.h>
+#include <vtkImageData.h>
+
+#include "math/aslVectors.h"
+#include "acl/acl.h"
+#include <acl/DataTypes/aclMemBlock.h>
+#include <acl/aclTypesList.h>
+#include <data/aslDataWrapper.h>
+
+namespace asl
+{
+
+	vtkSmartPointer<vtkImageData> makeVTKData(const Block & block,
+	                                          const vector<pair<string, acl::VectorOfElementsData> > & scalarFields,
+	                                          const vector<pair<string, acl::VectorOfElementsData> > & vectorFields)
+	{
+		vtkSmartPointer<vtkImageData> image(vtkSmartPointer<vtkImageData>::New());
+		image->SetSpacing(block.dx, block.dx, block.dx);
+		
+		image->SetOrigin(&castVTKVector(block.position)[0]);
+		image->SetDimensions(&castVTKVector(block.getSize(), 1)[0]);
+
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			errorMessage("WriterVTK::makeVTKData() - there are no fields to write");
+
+		for (unsigned int i = 0; i < scalarFields.size(); ++i)
+		{
+			auto vtkArray(castVTKDataArray(scalarFields[i].second[0],
+			                                scalarFields[i].first));
+			if (i==0)
+				image->GetPointData()->SetScalars(vtkArray);
+			image->GetPointData()->AddArray(vtkArray);
+		}
+
+		for (unsigned int i = 0; i < vectorFields.size(); ++i)
+		{
+			// compose a long vtk vector array and then feed it below
+			vtkSmartPointer<vtkDataArray> vtkArray;
+			switch (vectorFields[i].second[0]->getTypeID()) 
+			{
+				#define BOOST_TT_rep_expression(r, data, t) \
+					case acl::typeToTypeID<t>(): \
+					{ \
+						if (vectorFields[i].second.size() == 2) \
+						{   \
+							auto p0(acl::map<t>(vectorFields[i].second[0])); \
+							auto p1(acl::map<t>(vectorFields[i].second[1])); \
+							vtkArray = castVTKDataArray2in3(p0.get(), \
+												            p1.get(), \
+												            vectorFields[i].second[0]->getSize(), \
+												            vectorFields[i].first); \
+						}   \
+						if (vectorFields[i].second.size() == 3) \
+						{   \
+							auto p0(acl::map<t>(vectorFields[i].second[2])); \
+							auto p1(acl::map<t>(vectorFields[i].second[1])); \
+							auto p2(acl::map<t>(vectorFields[i].second[0])); \
+							vtkArray = castVTKDataArray(p0.get(), \
+												        p1.get(), \
+												        p2.get(), \
+												        vectorFields[i].second[0]->getSize(), \
+												        vectorFields[i].first); \
+						}   \
+					} \
+					break;	
+				BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
+				#undef BOOST_TT_rep_expression	
+			}
+			
+			image->GetPointData()->AddArray(vtkArray); 
+		}	
+	
+		return image;
+	}
+
+
+	WriterVTKXML::WriterVTKXML(const string & file, Block *nbl) :
+		Writer(file),
+		newBl(nbl)
+	{
+	}
+
+	void WriterVTKXML::write()
+	{
+		vtkSmartPointer<vtkXMLImageDataWriter> writer(vtkSmartPointer<vtkXMLImageDataWriter>::New());
+		writer->SetInput(makeVTKData(*block, scalarFields, vectorFields).GetPointer());
+		writer->SetFileName((file + "_" + numToStr(numOfWrites) + ".vti").c_str());
+		writer->SetDataModeToAppended();
+		writer->EncodeAppendedDataOff();		
+//		writer->SetDataModeToBinary();
+//		writer->SetDataModeToAscii();
+		writer->Write();
+
+		++numOfWrites;
+	}
+
+
+	void writeVTKXML(const string & fileName,
+	                 const AbstractData & data,
+	                 const string & name)
+	{
+		vtkSmartPointer<vtkXMLImageDataWriter> writer(vtkSmartPointer<vtkXMLImageDataWriter>::New());
+		unsigned int nComp(data.getDContainer().size());
+
+		std::vector<string> names(nComp, name);
+		for (unsigned int i(0); i < nComp; ++i)
+			names[i] += "-" + numToStr(i);
+		
+		writer->SetInput(castVTKData(data, names).GetPointer());
+		writer->SetFileName(fileName.c_str());
+		writer->SetDataModeToAppended();
+		writer->EncodeAppendedDataOff();		
+//		writer->SetDataModeToBinary();
+//		writer->SetDataModeToAscii();
+		writer->Write();
+	}
+	
+} //asl
+
+
diff --git a/src/writers/aslVTKFormatWriters.h b/src/writers/aslVTKFormatWriters.h
new file mode 100644
index 0000000..a44dbc1
--- /dev/null
+++ b/src/writers/aslVTKFormatWriters.h
@@ -0,0 +1,59 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLVTKFORMATWRITERS_H
+#define ASLVTKFORMATWRITERS_H
+
+#include "aslWriter.h"
+//#include <data/aslDataWrapper.h>
+
+#include <stdlib.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <memory>
+
+namespace asl 
+{
+	/// Writes data accumulated in Writer into a file with VTK XML format "vti"
+	/// \ingroup IO
+	class WriterVTKXML : public Writer
+	{
+		Block *newBl;
+		public:
+			WriterVTKXML(const std::string & file, Block *nbl=0);
+			void write();
+	};
+
+
+	/// writes \p data in a file with VTK XML format "vti"
+	/// \ingroup IO
+	void writeVTKXML(const std::string & fileName,
+	                 const AbstractData & data,
+	                 const std::string & name);
+
+} // asl
+
+#endif // ASLVTKFORMATWRITERS_H
+
diff --git a/src/writers/aslWriter.cxx b/src/writers/aslWriter.cxx
new file mode 100644
index 0000000..aa023ca
--- /dev/null
+++ b/src/writers/aslWriter.cxx
@@ -0,0 +1,184 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "aslWriter.h"
+#include <acl/aclMath/aclVectorOfElementsOperations.h>
+#include <acl/Kernels/aclKernel.h>
+#include <acl/acl.h>
+#include <acl/DataTypes/aclArray.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <data/aslDataWrapper.h>
+#include <data/aslDataWithGhostNodes.h>
+
+using namespace acl;
+
+namespace asl
+{
+
+	Writer * Writer::current(NULL);
+
+	Writer::Writer(const string & file_):
+		file(file_),
+		numOfWrites(0)
+	{
+		enable();
+	}
+
+
+	Writer::~Writer()
+	{
+		// Deactivates this instance of Writer
+		if (current == this)
+			current = NULL;
+	}
+
+
+	void Writer::enable()
+	{
+		// Activates this instance of Writer
+		current = this;
+	}
+
+
+	void Writer::addScalars(string name, AbstractData & data)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			block= make_shared<Block>(data.getBlock());
+
+		// check whether the new block is compatible with the old one
+		if (block->getSize() != data.getBlock().getSize())
+			errorMessage("Writer::addScalars() - attempt to add AbstractData with incompatible block size");
+
+		for (unsigned int i = 0; i < data.getDContainer().size() ; ++i)
+		{
+			scalarFields.push_back(make_pair(name + "-" + numToStr(i),
+			                                 subVE(data.getDContainer(), i, i)));
+		}
+	}
+
+
+	void Writer::addVector(string name, AbstractData & data)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			block= make_shared<Block>(data.getBlock());
+
+		// check whether the new block is compatible with the old one
+		if (block->getSize() != data.getBlock().getSize())
+			errorMessage("Writer::addVector() - attempt to add AbstractData with incompatible block size");
+
+		vectorFields.push_back(make_pair(name, data.getDContainer()));
+	}
+
+
+	void Writer::addScalars(string name, VectorOfElementsData & data)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			errorMessage("Writer::addScalars() - attempt to add VectorOfElementsData before any Block was defined");
+
+		// check whether the new data is compatible with the old block
+		if (!compatibleSizes((unsigned int)productOfElements(block->getSize()), data))
+			errorMessage("Writer::addScalars() - attempt to add VectorOfElementsData with incompatible block size");
+
+		for (unsigned int i = 0; i < data.size() ; ++i)
+		{
+			scalarFields.push_back(make_pair(name + "-" + numToStr(i),
+			                                 subVE(data, i, i)));
+		}
+	}
+
+
+	void Writer::addVector(string name, VectorOfElementsData & data)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			errorMessage("Writer::addVector() - attempt to add VectorOfElementsData before any Block was defined");
+
+		// check whether the new data is compatible with the old block
+		if (!compatibleSizes((unsigned int)productOfElements(block->getSize()), data))
+			errorMessage("Writer::addVector() - attempt to add VectorOfElementsData with incompatible block size");
+
+		vectorFields.push_back(make_pair(name, data));
+	}
+
+
+	void Writer::addScalars(string name, 
+	                        const VectorOfElements & data, 
+	                        Kernel & kernel, 
+	                        unsigned int nGhost)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			errorMessage("Writer::addScalars() - attempt to add VectorOfElements before any Block was defined");
+
+		if (kernel.getQueue().get() == 0)
+			errorMessage("Writer::addScalars() - attempt to add VectorOfElements before any Queue was defined in Kernel");
+
+		if (data.size() == 0)
+			errorMessage("Writer::addScalars() - attempt to add VectorOfElements with size 0");
+
+		auto queue(kernel.getQueue());
+		auto v(generateDataContainerACL_SP(offset(*block,-nGhost), 
+			                                   acl::getElementType(data),
+	                                           data.size(), 
+	                                           nGhost, 
+	                                           queue));
+		acl::initData(v->getEContainer(), generateVEConstantN(data.size(), 0.));
+		       
+		for (unsigned int i = 0; i < data.size() ; ++i)
+		{
+			scalarFields.push_back(make_pair(name + "-" + numToStr(i),
+			                                 subVE(v->getDContainer(), i, i)));
+		}
+		
+		kernel << assignmentSafe(v->getSubContainer(), data);
+	}
+
+
+	void Writer::addVector(string name, 
+	                       const VectorOfElements & data, 
+	                       Kernel & kernel, 
+	                       unsigned int nGhost)
+	{
+		if ((scalarFields.size() == 0) && (vectorFields.size() == 0))
+			errorMessage("Writer::addVector() - attempt to add VectorOfElements before any Block was defined");
+
+		if (kernel.getQueue().get() == 0)
+			errorMessage("Writer::addVector() - attempt to add VectorOfElements before any Queue was defined in Kernel");
+
+		if (data.size() == 0)
+			errorMessage("Writer::addVector() - attempt to add VectorOfElements with size 0");
+		
+		auto queue(kernel.getQueue());
+		auto v(generateDataContainerACL_SP(offset(*block,-nGhost), 
+			                                   acl::getElementType(data),
+	                                           data.size(), 
+	                                           nGhost, 
+	                                           queue));
+		acl::initData(v->getEContainer(), generateVEConstantN(data.size(), 0.));
+
+		vectorFields.push_back(make_pair(name, v->getDContainer()));
+
+		kernel << assignmentSafe(v->getSubContainer(), data);
+	}
+
+
+} // namespace asl
diff --git a/src/writers/aslWriter.h b/src/writers/aslWriter.h
new file mode 100644
index 0000000..472f263
--- /dev/null
+++ b/src/writers/aslWriter.h
@@ -0,0 +1,76 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ASLWRITER_H
+#define ASLWRITER_H
+
+//#include <acl/aclMath/aclVectorOfElementsDef.h>
+#include<string>
+#include<memory>
+#include<vector>
+
+namespace acl
+{
+	class VectorOfElements;
+	class VectorOfElementsData;
+	class Kernel;
+}
+
+namespace asl 
+{
+	class AbstractData;
+	class Block;
+
+	class Writer
+	{
+		public:
+			Writer(const std::string & file_);
+			~Writer();
+			virtual void write() = 0;
+			void enable();
+			void addScalars(std::string name, AbstractData & data);
+			void addVector(std::string name, AbstractData & data);
+			void addScalars(std::string name, acl::VectorOfElementsData & data);
+			void addVector(std::string name, acl::VectorOfElementsData & data);
+			void addScalars(std::string name, 
+			                const acl::VectorOfElements & data, 
+			                acl::Kernel & kernel, 
+			                unsigned int nGhost = 1);
+			void addVector(std::string name,
+			               const acl::VectorOfElements & data, 
+			               acl::Kernel & kernel,
+			               unsigned int nGhost = 1);
+
+			static Writer * current;
+
+		protected:
+			std::shared_ptr<Block> block;
+			std::vector<std::pair<std::string, acl::VectorOfElementsData>> scalarFields;
+			std::vector<std::pair<std::string, acl::VectorOfElementsData>> vectorFields;
+			std::string file;
+			unsigned int numOfWrites;
+	};
+
+} // asl
+
+#endif // ASLWRITER_H
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..9d9652c
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(testABD)
+add_subdirectory(testACL)
+add_subdirectory(testAGL)
+add_subdirectory(testMath)
+add_subdirectory(testPhysics)
+
diff --git a/test/input_data/asl.ini b/test/input_data/asl.ini
new file mode 100644
index 0000000..75d4553
--- /dev/null
+++ b/test/input_data/asl.ini
@@ -0,0 +1,8 @@
+
+# Sample ASL configuration file
+# If desired platform and device are not detected
+# the user will be warned and the automatically found device will be used
+
+platform = Advanced Micro Devices, Inc.
+device = AMD FX(tm)-6300 Six-Core Processor
+
diff --git a/test/input_data/bus.stl b/test/input_data/bus.stl
new file mode 100644
index 0000000..d665a85
Binary files /dev/null and b/test/input_data/bus.stl differ
diff --git a/test/input_data/locomotive.stl b/test/input_data/locomotive.stl
new file mode 100644
index 0000000..ec3ed01
Binary files /dev/null and b/test/input_data/locomotive.stl differ
diff --git a/test/testABD/CMakeLists.txt b/test/testABD/CMakeLists.txt
new file mode 100644
index 0000000..9ddb83a
--- /dev/null
+++ b/test/testABD/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+add_executable(testABDFormat testABDFormat.cc)
+target_link_libraries(testABDFormat asl asldata aslmath)
+
diff --git a/test/testABD/testABDFormat.cc b/test/testABD/testABDFormat.cc
new file mode 100644
index 0000000..b467447
--- /dev/null
+++ b/test/testABD/testABDFormat.cc
@@ -0,0 +1,135 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testABDFormat.cc
+ */
+
+#include "writers/aslABDFormat.h"
+#include "aslUtilities.h"
+#include "math/aslVectors.h"
+#include "data/aslBlocks.h"
+
+bool testNumbers()
+{
+	unsigned int aui(3);
+	int ai(-2);	
+	float af(5);
+	double ad(4);	
+	
+	asl::ABDFileOut afO("test.abd");
+	afO<<aui<<ai<<af<<ad;
+	afO.close();
+		
+	asl::ABDFileIn afI("test.abd");
+	unsigned int bui(0);
+	int bi(0);	
+	float bf(0);
+	double bd(0);	
+
+	afI>>bui>>bi>>bf>>bd;
+
+	bool status((aui==bui) && (ai==bi) && (af==bf) && (ad==bd));
+	asl::errorMessage(status);
+
+	return status;		
+}
+
+bool testAVec()
+{
+	asl::Block b(asl::makeAVec (10,15),0.1,asl::makeAVec (.1,1.));
+
+	asl::ABDFileOut afO("test.abd");
+	afO<<b;
+	afO.close();
+		
+	asl::ABDFileIn afI("test.abd");
+	asl::Block bn;
+
+	afI>>bn;
+
+	bool status((b.getSize()==bn.getSize()) && (b.dx==bn.dx) && (b.position==bn.position));
+	asl::errorMessage(status);
+
+	return status;		
+}
+
+bool testString()
+{
+	std::string b("Hello!!");
+
+	asl::ABDFileOut afO("test.abd");
+	afO<<b;
+	afO.close();
+		
+	asl::ABDFileIn afI("test.abd");
+	std::string bn;
+
+	afI>>bn;
+
+	bool status(b==bn);
+	asl::errorMessage(status);
+
+	return status;		
+}
+
+
+bool testBlock()
+{
+	asl::AVec<int> ai(asl::makeAVec(2,3));	
+	asl::AVec<float> af(asl::makeAVec(2.f,3.f));	
+	asl::AVec<double> ad(asl::makeAVec(4.,5.));	
+
+	asl::ABDFileOut afO("test.abd");
+	afO<<ai<<af<<ad;
+	afO.close();
+		
+	asl::ABDFileIn afI("test.abd");
+	asl::AVec<int> bi(1);	
+	asl::AVec<float> bf(1);
+	asl::AVec<double> bd(1);	
+
+	afI>>bi>>bf>>bd;
+
+	bool status((ai==bi) && (af==bf) && (ad==bd));
+	asl::errorMessage(status);
+
+	return status;		
+}
+
+int main()
+{
+	cout<<"Test of Numbers...";
+	testNumbers();
+
+	cout<<"Test of String...";
+	testString();
+
+	cout<<"Test of AVec...";	
+	testAVec();
+
+	cout<<"Test of Block...";	
+	testBlock();
+
+	return 0;
+}
diff --git a/test/testACL/CMakeLists.txt b/test/testACL/CMakeLists.txt
new file mode 100644
index 0000000..be21d78
--- /dev/null
+++ b/test/testACL/CMakeLists.txt
@@ -0,0 +1,25 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+add_executable(testVectorOfElements testVectorOfElements.cc)
+target_link_libraries(testVectorOfElements aslacl)
+
+add_executable(testMatrixOfElements testMatrixOfElements.cc)
+target_link_libraries(testMatrixOfElements aslacl asl aslmath asldata)
+
+add_executable(testPerformance testPerformance.cc)
+target_link_libraries(testPerformance aslacl)
+
+add_executable(testKernel testKernel.cc)
+target_link_libraries(testKernel aslacl)
+
+add_executable(testHardware testHardware.cc)
+target_link_libraries(testHardware aslacl)
+
+add_executable(testOperators testOperators.cc)
+target_link_libraries(testOperators aslacl)
+
+add_executable(testKernelMerger testKernelMerger.cc)
+target_link_libraries(testKernelMerger aslacl)
+
+add_executable(testPrivateVar testPrivateVar.cc)
+target_link_libraries(testPrivateVar aslacl)
diff --git a/test/testACL/testHardware.cc b/test/testACL/testHardware.cc
new file mode 100644
index 0000000..06fe9c7
--- /dev/null
+++ b/test/testACL/testHardware.cc
@@ -0,0 +1,116 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testHardware.cc
+ */
+
+#include "acl/aclHardware.h"
+#include "aslUtilities.h"
+
+using namespace acl;
+using namespace std;
+using namespace asl;
+
+string typeToString(unsigned int t)
+{
+	string s;
+	switch (t)
+	{
+		case CL_DEVICE_TYPE_CPU : s="CPU"; break;
+		case CL_DEVICE_TYPE_GPU : s="GPU"; break;
+		case CL_DEVICE_TYPE_ACCELERATOR : s="ACCELERATOR"; break;
+		case CL_DEVICE_TYPE_DEFAULT : s="DEFAULT"; break;
+//		case CL_DEVICE_TYPE_CUSTOM : s="CUSTOM"; break; //in opencl 1.1 is undefined
+		default: s="type is unknown";
+	}
+	return s;
+}
+
+void printHardwareInfo(const CommandQueue & queue)
+{
+
+	cout << "\t\ttype: " << typeToString(getDeviceType(queue)) << endl;
+	cout << "\t\tnumber of compute units: " << getNComputeUnits(queue) << endl;
+	cout << "\t\talignment: " << getAlignment(queue) << endl;
+	cout << "\t\tlocal memory type: "
+		 << (getLocalMemoryType(queue) == CL_LOCAL ? "CL_LOCAL" : "CL_GLOBAL") << endl;
+	cout << "\t\tlocal memory size: " << getLocalMemorySize(queue) << endl;
+	cout << "\t\tmax item size: " << getMaxItemSize(queue) << endl;
+	cout << "\t\tvector width float: " << getVectorWidth(queue, TYPE_FLOAT) << endl;
+	cout << "\t\tvector width double: " << getVectorWidth(queue, TYPE_DOUBLE) << endl;
+	cout << "\t\textension CL_KHR_FP64: "
+		 << extensionAvailable(queue, CL_KHR_FP64) << endl;
+	cout << "\t\textension CL_KHR_INT64_EXTENDED_ATOMICS: "
+		 << extensionAvailable(queue, CL_KHR_INT64_EXTENDED_ATOMICS) << endl;
+}
+
+
+int main()
+{
+
+	// Have a look at the available platforms and their devices
+	vector<cl::Platform> platforms;
+	vector<cl::Device> devices;
+	cl_context_properties cps[3];
+	cl::Context context;
+	CommandQueue queue;
+		
+	cl_int status = 0;	
+	status = cl::Platform::get(&platforms);
+	errorMessage(status, "Platform::get()");
+		
+	if (platforms.size() > 0)
+	{
+		for (unsigned int i = 0; i < platforms.size(); ++i)
+		{
+			status = platforms[i].getDevices(CL_DEVICE_TYPE_ALL, &devices);
+			errorMessage(status, "Platform::getDevices()");
+			cout << "Platform: " << platforms[i].getInfo<CL_PLATFORM_VENDOR>()
+				 << "\nNumber of devices: " << devices.size() << endl;
+
+			cps[0] = CL_CONTEXT_PLATFORM;
+			cps[1] = (cl_context_properties)(platforms[i])();
+			cps[2] = 0;
+
+			for (unsigned int j = 0; j < devices.size(); ++j)
+			{
+				// Create an OpenCL context for the current device
+				context = cl::Context(vector<cl::Device>(1, devices[j]), cps, NULL, NULL, &status);
+				errorMessage(status, "Context::Context()");
+
+				// Create an OpenCL command queue for current context and device
+				queue = CommandQueue(new cl::CommandQueue(context, devices[j], 0, &status));
+				errorMessage(status, "CommandQueue::CommandQueue()");
+
+				cout << "\t" << devices[j].getInfo<CL_DEVICE_NAME>() << endl;
+				printHardwareInfo(queue);
+				cout << endl;
+			}
+			cout << endl;
+		}
+	}
+
+
+	return 0;
+}
diff --git a/test/testACL/testKernel.cc b/test/testACL/testKernel.cc
new file mode 100644
index 0000000..1404aa8
--- /dev/null
+++ b/test/testACL/testKernel.cc
@@ -0,0 +1,436 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testKernel.cc
+ */
+
+
+#include "acl/acl.h"
+#include "acl/DataTypes/aclIndex.h"
+#include "acl/DataTypes/aclGroupID.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "acl/DataTypes/aclVariable.h"
+#include "acl/DataTypes/aclVariableReference.h"
+#include "acl/DataTypes/aclPrivateVariable.h"
+#include "acl/DataTypes/aclPrivateArray.h"
+#include "acl/DataTypes/aclArray.h"
+#include "acl/DataTypes/aclSubvector.h"
+#include "acl/DataTypes/aclLocalArray.h"
+#include "acl/Operators/aclElementFor.h"
+#include "acl/Operators/aclElementIfElse.h"
+#include "acl/Operators/aclElementExcerpt.h"
+#include "acl/Kernels/aclKernel.h"
+#include "aslUtilities.h"
+#include <math.h>
+#include <initializer_list>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+
+using namespace acl;
+using namespace std;
+
+bool testCopy()
+{
+	cout << "Test of \"copy\" function...";
+	Element vec0(new Array<cl_float> (10));
+	
+	vector<cl_float> input(10, 3);
+	vector<cl_float> output(10, 1);
+
+	copy(input, vec0);
+	copy(vec0, output);
+
+	bool status(output[3] == 3);
+	errorMessage(status);
+
+	return status;		
+}
+
+
+bool testKernel()
+{
+	cout << "Test of Kernel with double...";
+
+	Element vec0(new Array<cl_double>(10));
+	Element vec1(new Array<cl_double>(10));
+	Element vec2(new Array<cl_double>(10));
+	Element c(new Constant<cl_double>(2.));
+	Element ind(new Index());
+
+
+	Kernel k;
+	{ 
+		using namespace elementOperators;
+		k.addExpression(operatorAssignment(vec2, c ));
+		k.addExpression(operatorAssignment(vec0, c + powI(vec2, 3)));
+		k.addExpression(operatorAssignment(vec1, ind));
+	}
+	k.setup();
+	k.compute();
+
+	vector<cl_double> output0(10), output1(10);
+	copy(vec0, output0);	
+	copy(vec1, output1);
+
+	bool status(output0[9]<10.1 && output1[2]>2-1e-4 && output1[3]<3+1e-4);
+	errorMessage(status);
+
+	return status;		
+}
+
+
+bool testKernelSIMD()
+{
+	cout << "Test of KernelSIMD...";
+
+	Element vec0(new Array<cl_float>(11));
+	Element vec1(new Array<cl_float>(11));
+	
+	vector<cl_float> input0(11, 3);
+	vector<cl_float> input1(11, 5);
+	vector<cl_float> output(11, 0);
+	vector<cl_float> expected({8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8});
+	copy(input0, vec0);
+	copy(input1, vec1);
+
+	Kernel k(KERNEL_SIMD);
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignmentSafe(vec1, vec0 + vec1));
+	}
+
+	k.setup();
+
+	k.compute();
+	copy(vec1, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;
+}
+
+
+bool testKernelSIMDUA()
+{
+	cout << "Test of KernelSIMDUA...";
+
+	Element vec0(new Array<cl_float> (11));
+	Element vec1(new Array<cl_float> (11));
+	
+	vector<cl_float> input0(11, 3);
+	vector<cl_float> input1(11, 5);
+	vector<cl_float> output(11, 0);
+	vector<cl_float> expected({8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8});
+	copy(input0, vec0);
+	copy(input1, vec1);
+
+	KernelConfiguration kConf(KERNEL_SIMDUA);
+//	kConf.extensions.push_back("cl_amd_printf");
+	Kernel k(kConf);
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignmentSafe(vec1, vec0 + vec1));
+//		k.addExpression(printfFunction("\"index: %d\\n\", index"));
+	}
+
+	k.setup();
+
+	k.compute();
+	copy(vec1, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;
+}
+
+
+bool testPrivateVariable()
+{
+	cout << "Test of kernel with PrivateVariable...";
+
+	Element vec0(new Array<cl_float>(10));
+	Element vec1(new Array<cl_float>(10));
+	Element loc(new PrivateVariable<cl_float>());
+	
+	vector<cl_float> input1(10, 3);
+	vector<cl_float> input2(10, 5);
+	vector<cl_float> output(10, 1);
+
+	copy(input1, vec0);
+	copy(input2, vec1);
+
+	Kernel k;
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignment(loc, vec0 + vec1));
+		k.addExpression(operatorAssignment(vec1, vec0 - vec1));
+		k.addExpression(operatorAssignment(vec0, loc));
+	}
+	k.setup();
+	
+	k.compute();
+	copy(vec0, output);
+
+
+	bool status(output[2] ==8.);
+	errorMessage(status);
+
+	return status;
+}
+
+
+bool testPrivateArray()
+{
+	cout << "Test of kernel with PrivateArray...";
+	
+	vector<cl_int> inputGaIn({0, 4, 5});
+	vector<cl_float> inputGaOut(3, 0);
+	vector<cl_float> inputPa({-9, 2, 0, 15, 1, 3});
+	vector<cl_float> output(3);
+	vector<cl_float> expected({-9, 1, 3});
+
+	Element gaIn(new Array<cl_int>(3));
+	Element gaOut(new Array<cl_float>(3));
+	Element pa(new PrivateArray<cl_float>(inputPa));
+	shared_ptr<ElementExcerpt> ex(new ElementExcerpt(pa, gaIn));
+	
+	copy(inputGaIn, gaIn);
+
+
+	Kernel k;
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignment(gaOut, ex));
+	}
+	k.setup();
+
+	k.compute();
+	copy(gaOut, output);
+
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;
+}
+
+
+bool testVariable()
+{
+	cout << "Test of Variable functionality...";
+
+	Element vec0(new Array<cl_float> (10));
+	shared_ptr<Variable<cl_float> > a(new Variable<cl_float> (1.));	
+	
+	vector<cl_float> output(10, 1);
+
+	Kernel k;
+
+	k.addExpression(elementOperators::operatorAssignment(vec0, a));	
+	k.setup();
+
+	k.compute();
+	a->setValue(10.);
+	k.compute();
+	copy(vec0, output);
+	
+	bool status(output[2] ==10.);
+	errorMessage(status);
+
+	return status;		
+}
+
+bool testVariableReference()
+{
+	cout << "Test of VariableReference functionality...";
+
+	Element vec0(new Array<cl_float> (10));
+	float v(1.);
+	Element a(new VariableReference<cl_float> (v));	
+	
+	vector<cl_float> output(10, 1);
+
+	Kernel k;
+
+	k.addExpression(elementOperators::operatorAssignment(vec0, a));	
+	k.setup();
+
+	k.compute();
+	v=10.;
+	k.compute();
+	copy(vec0, output);
+
+	bool status(output[2] ==10.);
+	errorMessage(status);
+
+	return status;		
+}
+
+
+bool testSelect()
+{
+	cout << "Test of select function...";
+
+	Element vec0(new Array<cl_double> (10));
+	Element c0(new Constant<cl_double> (2.1));
+
+	vector<cl_double> input(10, 3.);
+	vector<cl_double> output(10, 1.);
+
+	copy(input,vec0);
+
+	Kernel k;
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignment(vec0, 
+		                                   select(vec0-c0, 
+		                                          vec0*vec0, 
+		                                          convert(TYPE_SELECT[TYPE_DOUBLE],
+		                                                  vec0 > c0,
+		                                                  false))));
+	}	
+	k.setup();
+
+	k.compute();
+	copy(vec0, output);
+	
+	bool status(output[2] ==9.);
+	errorMessage(status);
+
+	return status;		
+}
+
+
+bool testSubvector()
+{
+	cout << "Test of Subvector...";
+	cl_float init[] = {16, 2, 77, 29, 23, 16, 2, 77, 29, 23};
+	shared_ptr<Array<cl_float> > vec0(new Array<cl_float>(10));
+	
+	vector<cl_float> input(init, init + sizeof(init) / sizeof(cl_float) );
+	vector<cl_float> output(2);
+
+	copy(input, vec0);
+	Element subvec0(new Subvector<cl_float> (vec0, 2, 0));
+	copy(subvec0, output);
+
+	bool status(output[0]==16);
+	errorMessage(status);
+
+	return status;
+}
+
+
+bool testSwapBuffers()
+{
+	cout << "Test of Swap functionality...";
+	shared_ptr<Array<cl_float> > vec0(new Array<cl_float>(10));
+	shared_ptr<Array<cl_float> > vec1(new Array<cl_float>(10));
+	
+	vector<cl_float> input0(10, 1);
+	vector<cl_float> input1(10, 2);
+	vector<cl_float> output(10, 10);
+
+	copy(input0, vec0);
+	copy(input1, vec1);
+	swapBuffers(*vec1,*vec0);
+	copy(vec0, output);
+
+	bool status(output[3] == 2);
+	errorMessage(status);
+
+	return status;	
+}
+
+
+bool testLocalArray()
+{
+	cout << "Test of LocalArray and syncCopy with barrier()...";
+
+	KernelConfiguration kConf(KERNEL_BASIC);
+	kConf.local = true;
+
+	unsigned int groupsNumber = 5;
+	unsigned int groupSize = 2;
+	
+	Element vec0(new Array<cl_float>(groupSize * groupsNumber));
+	Element vec1(new Array<cl_float>(groupSize * groupsNumber));
+	Element loc0(new LocalArray<cl_float>(groupSize));
+	Element loc1(new LocalArray<cl_float>(groupSize));
+	Element groupID(new GroupID());
+	Element cGroupSize(new Constant<cl_uint>(groupSize));
+	Element c0(new Constant<cl_uint>(0));
+	
+	vector<cl_float> input0(groupSize * groupsNumber, 3);
+	vector<cl_float> input1(groupSize * groupsNumber, 5);
+	vector<cl_float> output(groupSize * groupsNumber, 0);
+	vector<cl_float> expected({2, 2, 2, 2, 2, 2, 2, 2, 2, 2});
+	copy(input0, vec0);
+	copy(input1, vec1);
+
+	Kernel k(kConf);
+	k.setGroupsNumber(groupsNumber);
+	{
+		using namespace elementOperators;
+		k.addExpression(syncCopy(vec0, loc0, cGroupSize * groupID, c0, cGroupSize));
+		k.addExpression(syncCopy(vec1, loc1, cGroupSize * groupID, c0, cGroupSize));
+		k.addExpression(barrier());
+		k.addExpression(operatorAssignment(loc1, loc1 - loc0));
+		k.addExpression(barrier("CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE"));
+		k.addExpression(syncCopy(loc1, vec1, c0, cGroupSize * groupID, cGroupSize));
+	}
+	k.setup();
+
+	
+	k.compute();
+	copy(vec1, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;
+
+}
+
+
+int main()
+{
+	testCopy();
+	testKernel();
+	testKernelSIMD();
+	testKernelSIMDUA();
+	testPrivateVariable();
+	testPrivateArray();
+	testVariable();
+	testVariableReference();
+	testSelect();
+	testSwapBuffers();
+	testLocalArray();
+	testSubvector();
+	
+	return 0;
+}
diff --git a/test/testACL/testKernelMerger.cc b/test/testACL/testKernelMerger.cc
new file mode 100644
index 0000000..cd49400
--- /dev/null
+++ b/test/testACL/testKernelMerger.cc
@@ -0,0 +1,90 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testKernelMerger.cc
+ */
+
+
+#include "acl/acl.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "acl/DataTypes/aclArray.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelMerger.h"
+#include "aslUtilities.h"
+#include <math.h>
+#include <initializer_list>
+
+using namespace acl;
+using namespace std;
+
+bool testKernelMerger()
+{
+	cout << "Test of \"KernelMerger\" functionality...";
+	ElementData vec0(new Array<cl_float> (10));
+	ElementData vec1(new Array<cl_float> (5));
+	ElementData vec2(new Array<cl_float> (8));
+	ElementData vec3(new Array<cl_float> (20));	
+
+	Element c0(new Constant<cl_double>(2));
+	Element c1(new Constant<cl_double>(1));
+	Element c2(new Constant<cl_double>(4));
+	Element c3(new Constant<cl_double>(7));
+	
+	SPKernel k0(new Kernel());
+	SPKernel k1(new Kernel());
+	SPKernel k2(new Kernel());
+	SPKernel k3(new Kernel());
+	{ 
+		using namespace elementOperators;
+		k0->addExpression(operatorAssignment (vec0, c0));
+		k1->addExpression(operatorAssignment (vec1, c1));
+		k2->addExpression(operatorAssignment (vec2, c2));
+		k3->addExpression(operatorAssignment (vec3, c3));
+	}
+
+	KernelMerger km;
+	km.addKernel(k0);
+	km.addKernel(k1);
+	km.addKernel(k2);
+//	km.addKernel(k3);
+
+	km.setup();
+	cout<<km.getKernelSource()<<endl;
+	km.compute();
+
+	bool status((acl::map<float>(vec0).get()[9] == 2) && 
+	            (acl::map<float>(vec1).get()[3] == 1) &&
+	            (acl::map<float>(vec2).get()[7] == 4));// &&
+//	            (acl::map<float>(vec3).get()[19] == 7));
+	errorMessage(status);
+
+	return status;		
+}
+
+int main()
+{
+	testKernelMerger();
+	
+	return 0;
+}
diff --git a/test/testACL/testMatrixOfElements.cc b/test/testACL/testMatrixOfElements.cc
new file mode 100644
index 0000000..e88232c
--- /dev/null
+++ b/test/testACL/testMatrixOfElements.cc
@@ -0,0 +1,138 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testMatrixOfElements.cc
+ */
+
+#include "acl/acl.h"
+#include "acl/aclGenerators.h"
+#include "acl/aclMath/aclMatrixOfElements.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+#include "math/aslMatrices.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/DataTypes/aclArray.h"
+
+using namespace asl;
+using namespace acl;
+using namespace std;
+
+bool testMatrixOperations()
+{
+	cout << "Test of \"Matrix Operations\" function...";
+
+	VectorOfElements vec0(3);
+	VectorOfElements vec1(1);
+	copy(generateVEData<cl_float>(10u,3u),vec0);
+	copy(generateVEData<cl_float>(10u,1u),vec1);
+
+	Kernel k;
+	{ 
+		using namespace elementOperators;
+		k << (vec0=generateVEConstant(0.1f,1.f,2.f));
+		k << (vec1=(elementProduct(generateVEConstant(0.f,1.f,2.f),vec0)*generateVEConstant(1.f,0.f,2.f))*vec0);
+	}
+	k.setup();
+	k.compute();
+
+	vector<cl_float> output(10);
+	copy(vec1[0], output);
+	
+	bool testResult(output[1] == 20.5);
+	if (testResult)	cout << " Ok" << endl;
+	else cout << " Error" << output[1] << endl;
+
+	return testResult;		
+}
+
+
+bool testSystemSolve()
+{
+	cout << "Test of \"System Solve Cramer's rule\" function...";
+
+	VectorOfElements vecB(2);
+	VectorOfElements vecX(2);
+	copy(generateVEData<cl_float>(10u,2u),vecB);
+	copy(generateVEData<cl_float>(10u,2u),vecX);
+	
+	auto matA(generateMEConstant(makeAMatr(makeAVec(4.,1.),makeAVec(1.,3.))));
+
+	Kernel k;
+	{ 
+		using namespace elementOperators;
+		k << (vecB=generateVEConstant(1.f,2.f));
+		k << gcSolveSystem(matA,vecB,vecX);
+	}
+	k.setup();
+	k.compute();
+
+	vector<cl_float> output(10);
+	copy(vecX[0], output);
+	
+	bool testResult(output[1] > 0.09 && output[1] < .1);
+	if (testResult)	cout << " Ok" << endl;
+	else cout << " Error" << output[1] << endl;
+
+	return testResult;		
+}
+
+bool testSystemSolveCG()
+{
+	cout << "Test of \"System Solve congugate gradient method\" function...";
+
+	VectorOfElements vecB(2);
+	VectorOfElements vecX(2);
+	copy(generateVEData<cl_float>(10u,2u),vecB);
+	copy(generateVEData<cl_float>(10u,2u),vecX);
+	
+	auto matA(generateMEConstant(makeAMatr(makeAVec(4.,1.),makeAVec(1.,3.))));
+
+	Kernel k;
+	{ 
+		using namespace elementOperators;
+		k << (vecB=generateVEConstant(1.f,2.f));
+		k << gcSolveSystemCG(matA,vecB,vecX);
+	}
+	k.setup();
+	k.compute();
+
+	vector<cl_float> output(10);
+	copy(vecX[0], output);
+	
+	bool testResult(output[1] > 0.09 && output[1] < .1);
+	if (testResult)	cout << " Ok" << endl;
+	else cout << " Error" << output[1] << endl;
+
+	return testResult;		
+}
+
+
+int main()
+{
+	testMatrixOperations();
+	testSystemSolve();
+	testSystemSolveCG();
+
+	return 0;
+}
diff --git a/test/testACL/testOperators.cc b/test/testACL/testOperators.cc
new file mode 100644
index 0000000..0cfd416
--- /dev/null
+++ b/test/testACL/testOperators.cc
@@ -0,0 +1,162 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testOperators.cc
+ */
+
+
+#include "acl/acl.h"
+#include "acl/DataTypes/aclIndex.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "acl/DataTypes/aclVariable.h"
+#include "acl/DataTypes/aclVariableReference.h"
+#include "acl/DataTypes/aclPrivateVariable.h"
+#include "acl/DataTypes/aclArray.h"
+#include "acl/DataTypes/aclLocalArray.h"
+#include "acl/DataTypes/aclSubvector.h"
+#include "acl/Operators/aclElementFor.h"
+#include "acl/Operators/aclElementIfElse.h"
+#include "acl/Operators/aclElementParser.h"
+#include "acl/Kernels/aclKernel.h"
+#include "aslUtilities.h"
+#include <math.h>
+#include <initializer_list>
+
+using namespace acl;
+using namespace std;
+
+
+bool testIfElse()
+{
+	cout << "Test of If-Else...";
+
+	using namespace elementOperators;
+	shared_ptr<Variable<cl_int> > a(new Variable<cl_int> (15));
+	Element c0(new Constant<cl_int> (15));
+	Element c1(new Constant<cl_int> (3));
+	Element vec(new Array<cl_float> (11));
+	vector<cl_float> input(11, 2); 
+	vector<cl_float> output(11, 0);
+	vector<cl_float> expected({8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8});
+	copy(input, vec);
+
+	// Test if
+	shared_ptr<ElementIfElse> ifElse_TestIf(new ElementIfElse(isEqual(a, c0)));
+	ifElse_TestIf->addBodyExpressionIf(operatorAssignment(vec, vec + c1));
+	ifElse_TestIf->addBodyExpressionElse(operatorAssignment(vec, vec - c1));
+
+	// Test else
+	shared_ptr<ElementIfElse> ifElse_TestElse(new ElementIfElse(isEqual(a, c1)));
+	ifElse_TestElse->addBodyExpressionIf(operatorAssignment(vec, vec - c1));
+	ifElse_TestElse->addBodyExpressionElse(operatorAssignment(vec, vec + c1));
+
+
+	Kernel k;
+
+	k.addExpression(ifElse_TestIf);
+	k.addExpression(ifElse_TestElse);
+	k.setup();
+	k.compute();
+	copy(vec, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;		
+}
+
+
+bool testParser()
+{
+	cout << "Test of Parser...";
+
+	using namespace elementOperators;
+	shared_ptr<Variable<cl_int> > a(new Variable<cl_int> (15));
+	Element c0(new Constant<cl_int> (15));
+	Element c1(new Constant<cl_int> (3));
+	Element vec(new Array<cl_float> (11));
+	vector<cl_float> input(11, 2);
+	vector<cl_float> output(11, 0);
+	vector<cl_float> expected({35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35});
+
+	copy(input, vec);
+
+	string statement("a + c0 + c1 + vec");
+	shared_ptr<ElementParser> parser(new ElementParser());
+	parser->addElementNamePair(a, "a");
+	parser->addElementNamePair(c0, "c0");
+	parser->addElementNamePair(c1, "c1");
+	parser->addElementNamePair(vec, "vec");
+	parser->setStatement(statement);
+	
+	Kernel k;
+
+	k.addExpression(operatorAssignment(vec, parser));
+	k.setup();
+	k.compute();
+
+	copy(vec, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;		
+}
+
+bool testAtomicSum()
+{
+	cout << "Test of Atomic Sum...";
+
+	using namespace elementOperators;
+	Element c(new Constant<cl_int> (6));
+	Element vec(new Array<cl_int> (11));
+	vector<cl_int> input(11, 2); 
+	vector<cl_int> output(11, 0);
+	vector<cl_int> expected({8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8});
+	copy(input, vec);
+
+	KernelConfiguration kConf(KERNEL_BASIC);
+	kConf.extensions.push_back("cl_khr_global_int32_base_atomics");
+	Kernel k(kConf);
+
+	k.addExpression(atomic_add(vec, c));
+	k.setup();
+	k.compute();
+	copy(vec, output);
+
+	bool status(output == expected);
+	errorMessage(status);
+
+	return status;		
+}
+
+int main()
+{
+
+	testIfElse();
+	testParser();
+	testAtomicSum();
+
+	return 0;
+}
diff --git a/test/testACL/testPerformance.cc b/test/testACL/testPerformance.cc
new file mode 100644
index 0000000..24dc926
--- /dev/null
+++ b/test/testACL/testPerformance.cc
@@ -0,0 +1,372 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+ 	\example testPerformance.cc
+
+	\todo repare
+ 
+	Results:
+ 	processor: Intel(R) Core(TM)2 Duo CPU     T8100  @ 2.10GHz
+	\code
+	Test of Sum Operator...
+	GPU: 9
+	CPU: 12
+	\endcode
+*/
+
+#include "acl/acl.h"
+#include "acl/aclHardware.h"
+#include "acl/DataTypes/aclIndex.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "acl/DataTypes/aclVariable.h"
+#include "acl/DataTypes/aclPrivateVariable.h"
+#include "acl/DataTypes/aclArray.h"
+#include "acl/DataTypes/aclSubvector.h"
+#include "acl/Kernels/aclKernel.h" 
+#include "aslUtilities.h"
+#include "utilities/aslTimer.h"
+#include <math.h>
+#include <fstream>
+
+#include <acl/Kernels/aclKernelConfigurationTemplates.h>
+
+#define ARRAY_SIZE 10000000
+//#define ITERATIONS_NUM 20
+#define TIME_INTERVAL 5 // in seconds
+
+using namespace acl;
+using namespace std;
+
+
+// Operators: +
+template <typename T> inline T testSum(T x1, T x2)
+{ 
+	using namespace elementOperators;
+	return x1 + x2;
+}
+
+
+// Operators: + (non sequential)
+template <typename T> inline T testSumNonSequential(T x1, T x2)
+{
+	Element index(new Index(ARRAY_SIZE));
+	Element c(new Constant<cl_uint>(17));
+	Element cArraySize(new Constant<cl_uint>(ARRAY_SIZE));
+	using namespace elementOperators;
+	return excerpt(x1 + x2, (index * c) % cArraySize);
+}
+
+
+// Operators: +, -, *, /
+template <typename T> inline T testBasicOperators(T x1, T x2)
+{
+	using namespace elementOperators;
+	return x1 * (x2 + x2) * x1 + (x2 + x1 * x1) * x2 * x1 * x2 * x1 - x1 / x2 + 
+		    x1 * (x1 + x2) * x1 + (x2 - x1 * x2) * x2 - x1 * x2 * x1 - x2 / x1 + 
+		    x1 * (x2 + x1) * x1 - (x2 + x1 * x1) * x2 * x1 * x2 * x1 + x1 / x2 -
+		    x1 * (x1 + x2) * x2 + (x2 - x1 * x2) * x2 - x1 * x2 * x1 - x2 / x1 + 
+		    x1 * (x2 + x1) * x1 - (x2 + x1 * x1) * x2 * x1 * x2 * x1 + x1 / x2;
+}
+
+
+// Operators: +, -, *, /, sin, cos, sqrt
+template <typename T> inline T testSpecialOperators(T x1, T x2)
+{
+	using namespace elementOperators;
+	return cos(x1*sin(x2+x2)*x1+sqrt(x2+x1*x1)*x2*sin(x1)*x1*sqrt(x2)*x2*x1*sqrt(x1*x2)-x1/x2);
+}
+
+
+/*
+void print(Glib::KeyFile * keyFile,
+           string deviceName,
+           string key,
+           string value,
+           bool writeToKeyFile)
+{
+	cout << key + ": " + value << endl;
+	
+	// Save the output for this device to the performance report file if needed
+	if (writeToKeyFile)
+	{
+		keyFile->set_string((deviceName),
+		                    key,
+		                    value);
+	}
+}
+*/
+
+/*
+template <typename T> inline void testKernelPerformance(const KernelConfiguration kernelConfig,
+                                                        const CommandQueue & queue,
+                                                        Glib::KeyFile * keyFile,
+                                                        bool writeToKeyFile)
+{
+	Element arr1(new Array<T>(ARRAY_SIZE, queue));
+	Element arr2(new Array<T>(ARRAY_SIZE, queue));
+	Element arrResult(new Array<T>(ARRAY_SIZE, queue));
+	Element c(new Constant<T>(5));
+
+	string typeStr = typeToStr<T>();
+	
+	string kernelConfigStr;
+	if (kernelConfig == KERNEL_BASIC)
+		kernelConfigStr = "KERNEL_BASIC";
+	else
+		if (kernelConfig == KERNEL_SIMD)
+			kernelConfigStr = "KERNEL_SIMD";
+		else
+			if (kernelConfig == KERNEL_SIMDUA)
+				kernelConfigStr = "KERNEL_SIMDUA";
+
+	
+	Kernel k(kernelConfig);
+	
+	// Initialization of the arrays
+	{
+		using namespace elementOperators;
+		k.addExpression(operatorAssignmentSafe(arr1, c));
+		k.addExpression(operatorAssignmentSafe(arr2, c));
+	}
+	k.compute();
+
+	// Test of sum
+	k.clear();
+	{ 
+		using namespace elementOperators;
+		k.addExpression(operatorAssignmentSafe(arrResult, testSum(arr1, arr2)));
+	}
+	k.setup();
+	
+	asl::Timer timer;
+	unsigned int iterationsNum;
+
+	timer.start();
+	timer.stop();
+	iterationsNum = 0;
+	do
+	{
+		timer.resume();
+		k.compute();
+		++iterationsNum;
+		timer.stop();
+	}
+	while (timer.getTime() < TIME_INTERVAL);
+
+	print(keyFile,
+	      getDeviceName(queue),
+	      kernelConfigStr + "---" + typeStr + "---" + "Sum",
+	      numToStr((float) iterationsNum / timer.getTime()),
+	      writeToKeyFile);
+
+	// Test of non sequential sum (only for non SIMD kernels)
+	if (kernelConfig.vectorWidth == 1)
+	{
+		k.clear();
+		{ 
+			using namespace elementOperators;
+			k.addExpression(operatorAssignmentSafe(arrResult,
+			                                       testSumNonSequential(arr1, arr2)));
+		}
+		k.setup();
+		
+		timer.start();
+		timer.stop();
+		iterationsNum = 0;
+		do
+		{
+			timer.resume();
+			k.compute();
+			++iterationsNum;
+			timer.stop();
+		}
+		while (timer.getTime() < TIME_INTERVAL);
+
+		print(keyFile,
+		      getDeviceName(queue),
+		      kernelConfigStr + "---" + typeStr + "---" + "NonSequentialSum",
+		      numToStr((float) iterationsNum / timer.getTime()),
+		      writeToKeyFile);
+
+	}
+
+	// Test of basic operators
+	k.clear();
+	{ 
+		using namespace elementOperators;
+		k.addExpression(operatorAssignmentSafe(arrResult,
+		                                       testBasicOperators(arr1, arr2)));
+	}
+	k.setup();
+	
+	timer.start();
+	timer.stop();
+	iterationsNum = 0;
+	do
+	{
+		timer.resume();
+		k.compute();
+		++iterationsNum;
+		timer.stop();
+	}
+	while (timer.getTime() < TIME_INTERVAL);
+
+	print(keyFile,
+	      getDeviceName(queue),
+	      kernelConfigStr + "---" + typeStr + "---" + "BasicOperators",
+	      numToStr((float) iterationsNum / timer.getTime()),
+	      writeToKeyFile);
+
+
+	// Test of special operators
+	k.clear();
+	if (arr1->getTypeID() != TYPE_INT)
+	{
+		{ 
+			using namespace elementOperators;
+			k.addExpression(operatorAssignmentSafe(arrResult,
+			                                       testSpecialOperators(arr1, arr2)));
+		}
+		k.setup();
+	
+		timer.start();
+		timer.stop();
+		iterationsNum = 0;
+		do
+		{
+			timer.resume();
+			k.compute();
+			++iterationsNum;
+			timer.stop();
+		}
+		while (timer.getTime() < TIME_INTERVAL);
+
+		print(keyFile,
+		      getDeviceName(queue),
+		      kernelConfigStr + "---" + typeStr + "---" + "SpecialOperators",
+		      numToStr((float) iterationsNum / timer.getTime()),
+		      writeToKeyFile);
+	}
+}
+*/
+
+int main()
+{
+	/*
+	const string FILE_NAME("./PerformanceReport.txt");
+	bool writeToKeyFile = false;
+	bool dumpKeyFile = false;
+	
+	Glib::KeyFile *keyFile = new Glib::KeyFile;
+
+	ifstream fileCheck(FILE_NAME);
+	if (fileCheck.good())
+	{
+ 		keyFile->load_from_file(FILE_NAME);
+	}
+	else
+	{
+		warningMessage("Failed to open " + FILE_NAME + " . Creating new file");
+		keyFile->set_comment("\n Performance test report\n\n");
+	}
+
+	
+	for (unsigned int i = 0; i < hardware.queues.size(); ++i)
+	{
+		if (!keyFile->has_group(getDeviceName(hardware.queues[i])))
+		{
+			writeToKeyFile = true;
+			dumpKeyFile = true;
+		}
+		
+		cout << "\nDevice: " + getDeviceName(hardware.queues[i]) + "\n" << endl;
+		
+		testKernelPerformance<cl_int>(KERNEL_BASIC,
+		                              hardware.queues[i],
+		                              keyFile,
+		                              writeToKeyFile);
+		testKernelPerformance<cl_float>(KERNEL_BASIC,
+		                                hardware.queues[i],
+		                                keyFile,
+		                                writeToKeyFile);
+		if (doublePrecisionSupport(hardware.queues[i]))
+			testKernelPerformance<cl_double>(KERNEL_BASIC,
+			                                 hardware.queues[i],
+			                                 keyFile,
+			                                 writeToKeyFile);
+
+
+		testKernelPerformance<cl_int>(KERNEL_SIMD,
+		                              hardware.queues[i],
+		                              keyFile,
+		                              writeToKeyFile);
+		testKernelPerformance<cl_float>(KERNEL_SIMD,
+		                                hardware.queues[i],
+		                                keyFile,
+		                                writeToKeyFile);
+		if (doublePrecisionSupport(hardware.queues[i]))
+			testKernelPerformance<cl_double>(KERNEL_SIMD,
+			                                 hardware.queues[i],
+			                                 keyFile,
+			                                 writeToKeyFile);
+
+
+		testKernelPerformance<cl_int>(KERNEL_SIMDUA,
+		                              hardware.queues[i],
+		                              keyFile,
+		                              writeToKeyFile);
+		testKernelPerformance<cl_float>(KERNEL_SIMDUA,
+		                                hardware.queues[i],
+		                                keyFile,
+		                                writeToKeyFile);
+		if (doublePrecisionSupport(hardware.queues[i]))
+			testKernelPerformance<cl_double>(KERNEL_SIMDUA,
+			                                 hardware.queues[i],
+			                                 keyFile,
+			                                 writeToKeyFile);
+
+		writeToKeyFile = false;
+	}
+
+	if (dumpKeyFile)
+	{
+		ofstream file;
+		file.open(FILE_NAME, ios::app);
+		if (!file.good())
+		{
+			errorMessage("Opening file " + FILE_NAME + " failed");
+		}
+		else
+		{
+			file << keyFile->to_data();
+			if (!file.good())
+				errorMessage("Writing to file " + FILE_NAME + " failed");
+		}
+		file.close();
+	}
+
+	delete keyFile;
+	*/
+	return 0;
+}
diff --git a/test/testACL/testPrivateVar.cc b/test/testACL/testPrivateVar.cc
new file mode 100644
index 0000000..9d7a3e8
--- /dev/null
+++ b/test/testACL/testPrivateVar.cc
@@ -0,0 +1,137 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+ 	\example testPrivateVar.cc
+*/
+
+#include "utilities/aslUValue.h"
+#include "acl/Kernels/aclKernel.h"
+#include "acl/Kernels/aclKernelConfigurationTemplates.h"
+#include <acl/acl.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/aclGenerators.h>
+#include <utilities/aslTimer.h>
+
+const unsigned int nLength(1000000);
+const unsigned int nOperations(10);
+const unsigned int nCycles(10000);
+const acl::KernelConfiguration & kConf(acl::KERNEL_BASIC); 
+//const acl::KernelConfiguration & kConf(acl::KERNEL_SIMDUA); 
+
+bool testKernelUnoptimized()
+{
+	cout << "Test of \"Simple kernel\" function...";
+
+	auto vec1(acl::generateVEData<float>(nLength,1u));
+	acl::Kernel k(kConf);
+
+	auto res(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT));
+	k << (res = acl::generateVEConstant(0.));
+	for(unsigned int i(0); i<nOperations; ++i)
+	{
+		auto tempRes(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT));
+		k << (tempRes=acl::generateVEIndex() * i+5.*i*i+7./(i+1.));
+		k << (res+=tempRes*tempRes+rsqrt(.2*tempRes)+ 1./tempRes);
+	}
+	k << (vec1=res);
+	k.setup();
+
+	asl::Timer timer;
+	timer.start();
+	for(unsigned int i(0); i<nCycles; ++i)
+		k.compute();
+	timer.stop();
+	std::cout<<"Unoptimized: "<<timer.getTime()<<endl;
+
+	return true;		
+}
+
+bool testKernelUnoptimizedPlus()
+{
+	cout << "Test of \"Simple kernel\" function...";
+
+	auto vec1(acl::generateVEData<float>(nLength,1u));
+	acl::Kernel k(kConf);
+
+	auto res(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT));
+	k << (res = acl::generateVEConstant(0.));
+	vector<acl::VectorOfElements> tempRes(nOperations);
+	for(unsigned int i(0); i<nOperations; ++i)
+	{
+		copy(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT), tempRes[i]);
+		k << (tempRes[i]=acl::generateVEIndex() * i+5.*i*i+7./(i+1.));
+	}
+	for(unsigned int i(0); i<nOperations; ++i)
+		k << (res+=tempRes[i]*tempRes[i]+rsqrt(.2*tempRes[i])+ 1./tempRes[i]);
+	k << (vec1=res);
+	k.setup();
+
+	asl::Timer timer;
+	timer.start();
+	for(unsigned int i(0); i<nCycles; ++i)
+		k.compute();
+	timer.stop();
+	std::cout<<"UnoptimizedPlus: "<<timer.getTime()<<endl;
+
+	return true;		
+}
+bool testKernelOptimized()
+{
+	cout << "Test of \"Simple kernel\" function...";
+
+	auto vec1(acl::generateVEData<float>(nLength,1u));
+	acl::Kernel k(kConf);
+
+	auto res(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT));
+	auto tempRes(acl::generateVEPrivateVariable(1u, acl::TYPE_FLOAT));
+	k << (res = acl::generateVEConstant(0.));
+	for(unsigned int i(0); i<nOperations; ++i)
+	{
+		k << (tempRes=acl::generateVEIndex() * i+5.*i*i+7./(i+1.));
+		k << (res+=tempRes*tempRes+rsqrt(.2*tempRes)+ 1./tempRes);
+	}
+	k << (vec1=res);
+	k.setup();
+//	cout<<k.getKernelSource()<<endl;
+
+	asl::Timer timer;
+	timer.start();
+	for(unsigned int i(0); i<nCycles; ++i)
+		k.compute();
+	timer.stop();
+	std::cout<<"Optimized: "<<timer.getTime()<<endl;
+
+	return true;		
+}
+
+
+
+int main()
+{
+	testKernelUnoptimized();
+	testKernelUnoptimizedPlus();
+	testKernelOptimized();
+
+	return 0;
+}
diff --git a/test/testACL/testVectorOfElements.cc b/test/testACL/testVectorOfElements.cc
new file mode 100644
index 0000000..ab1ceb0
--- /dev/null
+++ b/test/testACL/testVectorOfElements.cc
@@ -0,0 +1,118 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testVectorOfElements.cc
+ */
+
+#include "acl/acl.h"
+#include "utilities/aslUValue.h"
+#include "acl/aclGenerators.h"
+#include "acl/Kernels/aclKernel.h"
+#include <acl/aclMath/aclVectorOfElements.h>
+#include "aslUtilities.h"
+#include <math.h>
+
+using namespace asl;
+using namespace acl;
+using namespace std;
+
+bool testSimpleKernel()
+{
+	cout << "Test of \"Simple kernel\" function...";
+
+	VectorOfElements vec0(3);
+	VectorOfElements vec1(1);
+	copy(generateVEData<float>(10u,3u),vec0);
+	copy(generateVEData<float>(10u,1u),vec1);
+
+	Kernel k;
+	{ 
+		using namespace elementOperators;
+		k << (vec0=generateVEConstant(0.1f,1.f,2.f));
+		k << (vec1=generateVEConstant(0.f,1.f,2.f)*vec0+generateVEConstant(1.f));
+	}
+	k.setup();
+	k.compute();
+
+	vector<cl_float> output0(10), output1(10), output2(10);
+	vector<cl_float> output3(10);
+	copy(vec0[0], output0);	
+	copy(vec0[1], output1);
+	copy(vec0[2], output2);
+	copy(vec1[0], output3);
+	
+	bool testResult(output0[9]<0.101 && output1[2] ==1 && output2[5] ==2. && output3[1] ==6.);
+	if (testResult)	cout << " Ok" << endl;
+	else cout << " Error" << endl;
+
+	return testResult;		
+}
+
+bool testAdvancedOperations()
+{
+	cout << "Test of advanced operations...";
+	VectorOfElements vec0(2);
+	VectorOfElements vec1(2);
+	VectorOfElements res(2);
+	VectorOfElements ind(1);
+	VectorOfElements c(1);
+	
+	asl::UValue<cl_int> v0(7);
+	asl::UValue<cl_int> v1(8);
+	copy(generateVEConstant(3, 4), vec0);
+	copy(generateVEVariableSP(v0.p, v1.p), vec1);
+	copy(generateVEData<int>(11, 2), res);
+	copy(generateVEIndex(), ind);
+	copy(generateVEConstant(5), c);
+
+	vector<cl_int> output0(11, 0);
+	vector<cl_int> output1(11, 3);
+	vector<cl_int> expected0({10, 10, 10, 10, 10, 10, -4, -4, -4, -4, -4});
+	vector<cl_int> expected1({12, 12, 12, 12, 12, 12, -4, -4, -4, -4, -4});
+
+
+	Kernel k;
+	{ 
+		k << (res = select(vec0 + vec1, vec0 - vec1, ind > c));
+	}
+	k.setup();
+	k.compute();
+
+	copy(res[0], output0);
+	copy(res[1], output1);
+	
+	bool status(output0 == expected0 && output1 == expected1);
+	errorMessage(status);
+
+	return status;
+}
+
+
+int main()
+{
+	testSimpleKernel();
+	testAdvancedOperations();
+
+	return 0;
+}
diff --git a/test/testAGL/CMakeLists.txt b/test/testAGL/CMakeLists.txt
new file mode 100644
index 0000000..ddbb296
--- /dev/null
+++ b/test/testAGL/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+add_executable(testVTK_IO testVTK_IO.cc)
+target_link_libraries(testVTK_IO asl aslnum aslvtk)
+
diff --git a/test/testAGL/testVTK_IO.cc b/test/testAGL/testVTK_IO.cc
new file mode 100644
index 0000000..2e40512
--- /dev/null
+++ b/test/testAGL/testVTK_IO.cc
@@ -0,0 +1,80 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testVTK_IO.cc
+ */
+
+#include <writers/aslVTKFormatWriters.h>
+#include <readers/aslVTKFormatReaders.h>
+#include <aslGenerators.h>
+#include <num/aslDataResampling.h>
+#include <data/aslDataWithGhostNodes.h>
+
+void testMINC()
+{
+	cout << "Test of MINC files reader..." << endl;
+
+	auto data(asl::read("subject04_crisp_v.mnc", 0));
+	
+	asl::writeVTKXML("data.vti",
+	                 *data,
+	                 "data");
+}
+
+void testMINCplus()
+{
+	cout << "Test of MINC files reader +..." << endl;
+
+	auto data(asl::read("subject04_crisp_v.mnc", 0));
+	
+	asl::DataCoarser dc(data);
+	dc.init();
+	dc.execute();
+	asl::writeVTKXML("dataCoarsed.vti",
+	                 *dc.getDataOut(),
+	                 "data");
+
+}
+
+void testSurfSTL()
+{
+	cout << "Test of Surface STL files reader..." << endl;
+
+	auto data(asl::readSurf("bus.stl", 5));
+//	auto data(asl::readSurf("xx.vtp", .01));
+	
+	asl::writeVTKXML("dataSurfSTL.vti",
+	                 *data,
+	                 "data");
+}
+
+
+
+int main()
+{
+//	testMINC();
+//	testMINCplus();
+	testSurfSTL();
+	return 0;
+}
diff --git a/test/testMath/CMakeLists.txt b/test/testMath/CMakeLists.txt
new file mode 100644
index 0000000..8fe036b
--- /dev/null
+++ b/test/testMath/CMakeLists.txt
@@ -0,0 +1,11 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+add_executable(testASLData testASLData.cc)
+target_link_libraries(testASLData aslmath asl)
+
+add_executable(testDistanceFunction testDistanceFunction.cc)
+target_link_libraries(testDistanceFunction aslmath asl aslvtk aslnum)
+
+add_executable(testReductionFunction testReductionFunction.cc)
+target_link_libraries(testReductionFunction asl)
diff --git a/test/testMath/testASLData.cc b/test/testMath/testASLData.cc
new file mode 100644
index 0000000..9d4c2ab
--- /dev/null
+++ b/test/testMath/testASLData.cc
@@ -0,0 +1,152 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testASLData.cc
+ */
+
+#include "acl/acl.h"
+#include "acl/aclGenerators.h"
+#include "acl/DataTypes/aclGroupID.h"
+#include "acl/DataTypes/aclConstant.h"
+#include "aslGenerators.h"
+#include "aslUtilities.h"
+#include "acl/Kernels/aclKernel.h"
+#include "data/aslDataUtilities.h"
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <data/aslDataWithGhostNodes.h>
+
+using namespace acl;
+using namespace asl;
+using namespace std;
+
+bool testSimpleKernel()
+{
+	Block bl(makeAVec(10,5),0.1);
+	auto a(generateDataContainerACL_SP<double>(bl,1,1));
+	auto b(generateDataContainerACL_SP<double>(bl,1,1));
+
+	Kernel k;
+	
+	k<<(a->getEContainer()=acl::generateVEConstant<double>(0));
+	k<<(b->getEContainer()=acl::generateVEConstant<double>(0));
+
+	k.setup();
+	cout<<k.getKernelSource ()<<endl;
+
+	return true;
+}
+
+
+bool testInitData()
+{
+	Block bl(makeAVec(10,5),0.1);
+	auto a(generateDataContainerACL_SP<double>(bl, 1, 1));
+
+	initData(a->getEContainer(),acl::generateVEConstant<double>(0));
+
+	return true;
+}
+
+
+bool testUploadToLocalMem()
+{
+	cout << "Test of UploadToLocalMem()...";
+
+	unsigned int componentsNum = 2;
+	unsigned int groupSize = 27;
+	KernelConfiguration kConf(KERNEL_BASIC);
+	kConf.local = true;
+	Kernel kernel(kConf);
+	Element groupID(new GroupID());
+	Element c0(new Constant<cl_uint>(0));
+
+	asl::AVec<int> totalDimensions(asl::makeAVec(10, 10, 10));
+	// dx = 1
+	asl::Block block(totalDimensions, 1);
+
+	// boundary = 0
+	auto source(asl::generateDataContainerACL_SP<float>(block,
+	                                                     componentsNum,
+	                                                     0u));
+	// initialize source with value "13"
+	acl::initData(source->getEContainer(), acl::generateVEConstantN(componentsNum,
+	                                                                13));
+
+	// boundary = 0
+	auto destination(asl::generateDataContainerACL_SP<float>(block,
+	                                                          componentsNum,
+	                                                          0u));
+	// initialize source with value "27"
+	acl::initData(destination->getEContainer(), acl::generateVEConstantN(componentsNum,
+	                                                                     27));
+
+
+	asl::AVec<int> portionDimensions(asl::makeAVec(5, 5, 5));
+
+	unsigned int portionSize = productOfElements(portionDimensions);
+	unsigned int totalSize = productOfElements(totalDimensions);
+	unsigned int groupsNumber = totalSize / portionSize;
+	Element cPortionSize(new Constant<cl_uint>(portionSize));
+	kernel.setGroupsNumber(groupsNumber);
+
+	VectorOfElements localSource(componentsNum);
+	copy(uploadToLocalMem(*source, portionDimensions, groupSize, kernel), localSource);
+
+	using namespace elementOperators;
+	kernel.addExpression(barrier("CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE"));
+	// overwrite destination with localSource
+	for (unsigned int i = 0; i < componentsNum; ++i)
+		kernel.addExpression(syncCopy(localSource[i], destination->getEContainer()[i],
+		                              c0, cPortionSize * groupID, cPortionSize));
+
+	kernel.setup();
+	kernel.compute();
+
+
+	bool status = true;
+	vector<cl_float> src(totalSize);
+	vector<cl_float> dst(totalSize);
+	for (unsigned int i = 0; i < componentsNum; ++i)
+	{
+		copy(source->getEContainer()[i], src);
+		copy(destination->getEContainer()[i], dst);
+
+		cout << src << endl << endl << dst << endl;
+		
+		status &= (src == dst);
+	}
+	
+	errorMessage(status);
+
+	return true;
+}
+
+int main()
+{
+	testSimpleKernel();
+	testInitData();
+	testUploadToLocalMem();
+		
+	return 0;
+}
diff --git a/test/testMath/testDistanceFunction.cc b/test/testMath/testDistanceFunction.cc
new file mode 100644
index 0000000..c2f66df
--- /dev/null
+++ b/test/testMath/testDistanceFunction.cc
@@ -0,0 +1,383 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testDistanceFunction.cc
+ */
+
+#include <math/aslVectors.h>
+#include <aslGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <aslGeomInc.h>
+#include <stdlib.h>     /* srand, rand */
+#include <time.h>
+#include <data/aslDataWithGhostNodes.h>
+
+#include <num/aslDFOptimizer.h>
+#include <math/aslTemplates.h>
+
+//typedef float FlT;
+typedef double FlT;
+
+using asl::AVec;
+using asl::makeAVec;
+
+bool testDistFOperations2D()
+{
+	// Geometry description
+	// Radius
+	FlT r(10.);
+
+	// Generates a sphere with radius r and center at (50., 50.)
+	auto df1(generateDFSphere(r, asl::makeAVec(50., 50.)));
+	auto df2(generateDFSphere(r, asl::makeAVec(40., 40.)));
+	auto df3(generateDFSphere(2. * r, asl::makeAVec(50., 50.)));
+	// Resulting geometry: union of the spheres df1 and df2 intersected by df3 
+	auto resultGeometry((df1 | df2) & df3);
+
+	// Geometry to Data conversion
+	// Grid size (= discrete size of the simulated domain) 
+	asl::AVec<int> size(asl::makeAVec(100., 100.));
+	// Grid resolution (= space step)
+	FlT dx(1.);
+	// Creates a Block which describes the grid
+	asl::Block block(size, dx);
+	// Allocates memory for the data that corresponds to
+	// the nodes of the grid desribed by the \p block.
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	// Initializes the \p data with the values of the distance function
+	// extracted from all points of the \p resultGeometry.
+	asl::initData(data, resultGeometry);
+
+	// Writes the \p data into the file.
+	asl::writeVTKXML("distFOperation2D.vti", *data, "data");
+
+	return true;
+}
+
+
+bool testDistFOperations3D()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50.,50.,50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto df1(generateDFSphere(r, asl::AVec<FlT>(size)*.5));
+	auto df2(generateDFSphere(r, asl::AVec<FlT>(size)*.4));
+	auto df3(generateDFSphere(1.5*r, asl::AVec<FlT>(size)*.5));
+	asl::initData(data, ((df1 | df2) & df3));
+
+	asl::writeVTKXML("distFOperation3D.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFOrderedCylinders()
+{
+	FlT r(3.);
+	FlT spacing(4.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50., 50., 50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	vector<asl::SPDistanceFunction> cylinders;
+	asl::SPDistanceFunction resultGeometry;
+	asl::AVec<FlT> orientation(asl::makeAVec(0., 0., 1.));
+	for (int i = 0; i < size[0] / (2 * r + spacing); ++i)
+	{
+		for (int j = 0; j < size[1] / (2 * r + spacing); ++j)
+		{
+			cylinders.push_back(generateDFCylinderInf(r, orientation, asl::makeAVec(i * (2. * r + spacing) + r + spacing / 2., j * (2. * r + spacing) + r + spacing / 2., 0.)));
+			resultGeometry = resultGeometry | cylinders.back();
+		}
+	}
+
+	asl::initData(data, resultGeometry);
+
+	asl::writeVTKXML("distFOrderedCylinders.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFUnorderedCylinders()
+{
+	FlT r(3.);
+	FlT spacing(4.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(100., 100., 100.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	vector<asl::SPDistanceFunction> cylinders;
+	asl::SPDistanceFunction resultGeometry;
+	asl::AVec<FlT> orientation(asl::makeAVec(0., 0., 1.));
+	srand (time(NULL));
+	for (unsigned int i = 0; i < size[0] / (2 * r + spacing); ++i)
+	{
+		for (unsigned int j = 0; j < size[1] / (2 * r + spacing); ++j)
+		{
+			for (unsigned int d = 0; d < orientation.getSize(); ++d)
+				orientation[d] = rand() % size[d];
+
+			cylinders.push_back(generateDFCylinderInf(r, orientation, asl::makeAVec(i * (2. * r + spacing) + r + spacing / 2., j * (2. * r + spacing) + r + spacing / 2., (FlT) (rand() % size[2]))));
+			resultGeometry = resultGeometry | cylinders.back();
+		}
+	}
+
+	asl::initData(data, resultGeometry);
+
+	asl::writeVTKXML("distFUnorderedCylinders.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFNormalization2D()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(100.,100.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto df1(generateDFSphere(r, asl::AVec<FlT>(size)*.5));
+	asl::initData(data, normalize(df1, dx));
+
+	asl::writeVTKXML("distFNormalization2D.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFNormalization3D()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50.,50.,50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto df1(generateDFSphere(r, asl::AVec<FlT>(size)*.5));
+	asl::initData(data, normalize(df1,dx));
+
+	asl::writeVTKXML("distFNormalization3D.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFOperations3DPrism()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50.,50.,50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto center(asl::AVec<FlT>(size)*.5);
+	auto df1(generateDFSphere(r, center));
+	auto df2(asl::generateDFConvexPolygonPrism({center+asl::makeAVec(4.,0.,0.),
+                                                              center+asl::makeAVec(4.,4.,0.),
+                                                              center+asl::makeAVec(-4.,0.,0.),
+                                                              center+asl::makeAVec(-4.,-4.,0.)}));
+	asl::initData(data, (df1 & (-df2)));
+
+	asl::writeVTKXML("distFOperation3DPrism.vti", *data, "data");
+
+	return true;	
+}
+
+
+bool testDistFOperations3DBlock()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50.,50.,50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto center(asl::AVec<FlT>(size)*.5);
+	auto df1(generateDFSphere(r, center));
+	auto df2(generateDFInBlock(block, 1));
+
+	asl::initData(data, (df1 | df2));
+
+	asl::writeVTKXML("distFOperation3DBlock.vti", *data, "data");
+
+	return true;	
+}
+
+bool testDistFAdvanced3D()
+{
+    
+	
+//	FlT hBath(2.);
+	FlT rBath(1.);
+	FlT rDisk(.9);
+	FlT hDisk(0.1);
+	FlT dx(.02);
+
+	FlT rAxis(0.05);
+	FlT hAxis(.5);
+
+	FlT wPillar(.2);
+	FlT dPillar(.1);
+
+	FlT aCrystal(.5);
+	FlT hCrystalBase(.5);
+	FlT hCrystalPyramid(.5);
+
+	asl::AVec<int> size(asl::makeAVec(105.,105.,100.));
+
+	asl::AVec<>center(.5*dx*AVec<>(size));
+
+	vector<asl::AVec<>> pillar1{asl::makeAVec(wPillar*.5, dPillar*.5,0.),
+	                            asl::makeAVec(-wPillar*.5, dPillar*.5,0.),
+	                            asl::makeAVec(-wPillar*.5, -dPillar*.5,0.),
+	                            asl::makeAVec(wPillar*.5, -dPillar*.5,0.)};
+
+	vector<asl::AVec<>> pillar2{asl::makeAVec(dPillar*.5, wPillar*.5,0.),
+	                            asl::makeAVec(-dPillar*.5, wPillar*.5,0.),
+	                            asl::makeAVec(-dPillar*.5, -wPillar*.5,0.),
+	                            asl::makeAVec(dPillar*.5, -wPillar*.5,0.)};
+	
+	vector<asl::AVec<>> pillarC{asl::makeAVec(center[0]+rDisk-dPillar*.5, center[1], 0.),
+                                asl::makeAVec(center[0]-rDisk+dPillar*.5, center[1], 0.),
+	                            asl::makeAVec(center[0], center[1]+rDisk-dPillar*.5,0.),
+	                            asl::makeAVec(center[0], center[1]-rDisk+dPillar*.5,0.)};
+	vector<vector<asl::AVec<>>> pillarsPoints(4);
+	for(unsigned int i(0); i<4; ++i)
+		pillarsPoints[i].resize(4);
+	
+	for(unsigned int i(0); i<4; ++i)
+	{
+		pillarsPoints[0][i] = pillar2[i] + pillarC[0];
+		pillarsPoints[1][i] = pillar2[i] + pillarC[1];
+		pillarsPoints[2][i] = pillar1[i] + pillarC[2];
+		pillarsPoints[3][i] = pillar1[i] + pillarC[3];
+	}
+		
+
+	asl::Block block(size, dx);
+	auto mBath(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	auto mPlatform(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	auto mCrystal(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto bath(-generateDFCylinderInf(rBath, asl::makeAVec(0.,0.,1.),  
+	                                 dx*asl::AVec<FlT>(size)*.5));
+
+	auto diskBottom(generateDFCylinder(rDisk, 
+	                                   asl::makeAVec(0., 0., hDisk),  
+	                                   asl::makeAVec(center[0], center[1], .5*hDisk)));
+	auto diskTop(generateDFCylinder(rDisk, 
+	                                asl::makeAVec(0., 0., hDisk),  
+	                                asl::makeAVec(center[0], center[1], -.5*hDisk - hAxis + dx*size[2])));
+	auto axis(generateDFCylinder(rAxis, 
+	                                asl::makeAVec(0., 0., hAxis+hDisk*.5),  
+	                                asl::makeAVec(center[0], center[1], - .5*hAxis - hDisk*.25 + dx*size[2])));
+	auto dfPillar1(generateDFConvexPolygonPrism(pillarsPoints[0]));
+	auto dfPillar2(generateDFConvexPolygonPrism(pillarsPoints[1]));
+	auto dfPillar3(generateDFConvexPolygonPrism(pillarsPoints[2]));
+	auto dfPillar4(generateDFConvexPolygonPrism(pillarsPoints[3]));
+	auto dfPillars((dfPillar1 | dfPillar2 | dfPillar3 | dfPillar4) & 
+	               generateDFPlane(makeAVec(0.,0.,-1.), makeAVec(0.,0.,.5*hDisk)) &
+	               generateDFPlane(makeAVec(0.,0.,1.), makeAVec(0.,0.,-.5*hDisk - hAxis + dx*size[2])));
+
+
+	auto crystalB(asl::generateDFConvexPolygonPrism({center+makeAVec( aCrystal,  aCrystal,0.),
+						  				             center+makeAVec(-aCrystal,  aCrystal,0.),
+										             center+makeAVec(-aCrystal, -aCrystal,0.),
+										             center+makeAVec( aCrystal, -aCrystal,0.)}) &
+	              generateDFPlane(makeAVec(0.,0.,-1.), makeAVec(0.,0., hDisk)) &
+	              generateDFPlane(makeAVec(0.,0., 1.), makeAVec(0.,0., hDisk + hCrystalBase)));
+	auto cCrPyrBase(makeAVec(center[0],center[1],hDisk+hCrystalBase-.01));
+	auto crystalT(asl::generateDFConvexPolygonPyramid({cCrPyrBase+makeAVec( aCrystal,  aCrystal,0.),
+						  				               cCrPyrBase+makeAVec(-aCrystal,  aCrystal,0.),
+										               cCrPyrBase+makeAVec(-aCrystal, -aCrystal,0.),
+										               cCrPyrBase+makeAVec( aCrystal, -aCrystal,0.)},
+	                                                   cCrPyrBase+makeAVec(0.,0.,hCrystalPyramid)));
+	
+	asl::initData(mBath, normalize(bath, dx));
+	asl::initData(mPlatform, normalize(diskBottom | diskTop | axis | dfPillars, dx));
+	asl::initData(mCrystal, normalize(crystalB | crystalT, dx));
+
+//	asl::writeVTKXML("distFAdvanced3D.vti", *data, "data");
+	asl::WriterVTKXML writer("distFAdvanced3D");
+	writer.addScalars("Bath", *mBath);
+	writer.addScalars("Platform", *mPlatform);
+	writer.addScalars("Crysstal", *mCrystal);
+	writer.write();
+
+	return true;	
+}
+
+bool testDistFOptimizer()
+{
+	FlT r(10.);
+	FlT dx(1.);
+	asl::AVec<int> size(asl::makeAVec(50.,50.,50.));
+
+	asl::Block block(size, dx);
+	auto data(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto center(asl::AVec<FlT>(size)*.5);
+	auto df1(generateDFSphere(r, center));
+	auto df2(generateDFSphere(r, .6*center));
+
+	asl::initData(data, normalize((df1 | df2),dx));
+	optimizeMap(data, &asl::d3q15());
+
+	asl::writeVTKXML("distDistFOptimizer.vti", *data, "data");
+
+	return true;	
+}
+
+
+int main()
+{
+	testDistFOperations2D();
+	testDistFOperations3D();
+	testDistFOrderedCylinders();
+	testDistFUnorderedCylinders();
+	testDistFNormalization2D();
+	testDistFNormalization3D();
+	testDistFOperations3DPrism();	
+	testDistFOperations3DBlock();
+	testDistFAdvanced3D();
+	testDistFOptimizer();
+	
+	return 0;
+}
diff --git a/test/testMath/testReductionFunction.cc b/test/testMath/testReductionFunction.cc
new file mode 100644
index 0000000..aac26bd
--- /dev/null
+++ b/test/testMath/testReductionFunction.cc
@@ -0,0 +1,115 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testReductionFunction.cc
+ */
+
+#include "acl/Kernels/aclKernel.h"
+#include <acl/aclUtilities.h>
+#include "acl/aclMath/aclReductionAlgGenerator.h"
+#include "acl/aclGenerators.h"
+#include "aslUtilities.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+
+using namespace acl;
+
+void testSum()
+{
+	unsigned int n(101);
+	auto v(generateVEData<float>(n,1u));
+	initData(v, generateVEConstant(2));
+	auto summator(generateSumAlg<float>(v));
+	summator->generateAlg();
+	summator->compute();
+	bool b(asl::approxEqual(summator->res.v()[0],2.f*n));
+	cout<<"testSum: "<<(b? "Ok": "Error ")<<endl;
+}
+
+void testSum1()
+{
+	unsigned int n(100001);
+	VectorOfElements v1(generateVEData<float>(n,1u));
+	VectorOfElements v2(generateVEData<float>(n,1u));
+	initData(v1, generateVEConstant(2));
+	initData(v2, generateVEConstant(3));
+	auto summator(generateSumAlg<float>(v1*v2));
+	summator->generateAlg();
+	summator->compute();
+	bool b(asl::approxEqual(summator->res.v()[0],6.f*n));
+	cout<<"testSum1: "<<(b? "Ok": "Error")<<endl;
+}
+
+bool testMin()
+{
+	VectorOfElements vI(generateVEIndex());
+	VectorOfElements v1(generateVEData<float>(101u,1u));
+	initData(v1, generateVEConstant(2));
+	auto minimizer(generateMinAlg<float>(v1*((vI-100)*(vI-100)+3)));
+	minimizer->generateAlg();
+	minimizer->compute();
+	bool b(asl::approxEqual(minimizer->res.v()[0],6.f));
+	cout<<"testMin: "<<(b? "Ok": "Error")<<endl;
+	return b;
+}
+
+bool testMax()
+{
+	VectorOfElements vI(generateVEIndex());
+	VectorOfElements v1(generateVEData<float>(100001u,1u));
+	initData(v1, generateVEConstant(2));
+	auto maximizer(generateMaxAlg<float>(v1*((1000.-vI)*(vI-1000.)-10.)));
+	maximizer->generateAlg();
+	maximizer->compute();
+	bool b(asl::approxEqual(maximizer->res.v()[0],-20.f));
+	cout<<"testMax: "<<(b? "Ok": "Error")<<endl;
+	return b;
+}
+
+bool testProduct()
+{
+	typedef double FT;
+	VectorOfElements vI(generateVEIndex());
+	VectorOfElements v1(generateVEData<FT>(100001u,1u));
+	initData(v1, generateVEConstant(2));
+	auto alg(generateProductAlg<FT>(select(generateVEConstant(1.),
+	                                       v1,
+	                                       vI >=1000 && vI <= 1007, 
+	                                       acl::typeToTypeID<FT>())));
+	alg->generateAlg();
+	alg->compute();
+	bool b(asl::approxEqual(alg->res.v()[0],256));
+	cout<<"testProduct: "<<(b? "Ok": "Error")<<endl;
+	return b;
+}
+
+
+int main()
+{
+	testSum();
+	testSum1();
+	testMin();
+	testMax();
+	testProduct();
+	return 0;
+}
diff --git a/test/testPhysics/CMakeLists.txt b/test/testPhysics/CMakeLists.txt
new file mode 100644
index 0000000..71d400b
--- /dev/null
+++ b/test/testPhysics/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(flow)
+add_subdirectory(elastic)
+add_subdirectory(levelSet)
+add_subdirectory(jumpingObjects)
+add_subdirectory(heatTransfer)
+add_subdirectory(massTransferSM)
diff --git a/test/testPhysics/elastic/CMakeLists.txt b/test/testPhysics/elastic/CMakeLists.txt
new file mode 100644
index 0000000..4cd0b5a
--- /dev/null
+++ b/test/testPhysics/elastic/CMakeLists.txt
@@ -0,0 +1,23 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(poroelastic poroelastic.cc)
+target_link_libraries(poroelastic asl aslnum aslvtk)
+set_property(TARGET poroelastic PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/poroelastic)
+
+add_executable(cubeIncompressibleGravity cubeIncompressibleGravity.cc)
+target_link_libraries(cubeIncompressibleGravity asl aslnum aslvtk)
+set_property(TARGET cubeIncompressibleGravity PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cubeIncompressibleGravity)
+
+add_executable(cubePoroelasticGravity cubePoroelasticGravity.cc)
+target_link_libraries(cubePoroelasticGravity asl aslnum aslvtk)
+set_property(TARGET cubePoroelasticGravity PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cubePoroelasticGravity)
+
+add_executable(cubeGravity cubeGravity.cc)
+target_link_libraries(cubeGravity asl aslnum aslvtk)
+set_property(TARGET cubeGravity PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cubeGravity)
+
+add_executable(acousticWaves acousticWaves.cc)
+target_link_libraries(acousticWaves asl aslnum aslvtk)
+set_property(TARGET acousticWaves PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/acousticWaves)
+
diff --git a/test/testPhysics/elastic/acousticWaves.cc b/test/testPhysics/elastic/acousticWaves.cc
new file mode 100644
index 0000000..8bbc72d
--- /dev/null
+++ b/test/testPhysics/elastic/acousticWaves.cc
@@ -0,0 +1,255 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example acousticWaves.cc
+ */
+
+#include <math/aslVectors.h>
+#include <data/aslBlocks.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <num/aslBasicBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+//#include <acl/aclMath/aclVectorOfElements.h>
+#include <aslGeomInc.h>
+//#include "acl/aclUtilities.h"
+
+
+typedef float FlT;
+//typedef asl::UValue<FlT> Param;
+
+class Parameters
+{
+  private:
+		void init();
+
+  public:
+		asl::ParametersManager parametersManager;
+		string folder;
+
+		asl::Block::DV size;
+
+		asl::Parameter<double> dx;
+		asl::Parameter<double> bulkModulus;
+		asl::Parameter<double> shearModulus;
+		asl::Parameter<double> rho;
+		asl::Parameter<double> tubeL;
+		asl::Parameter<double> tubeDEx;
+		asl::Parameter<double> tubeDIn;
+		asl::Parameter<double> hole1Pos;
+		asl::Parameter<double> hole2Pos;
+		asl::Parameter<double> hole1D;
+		asl::Parameter<double> hole2D;
+
+		asl::Parameter<double> tSimulation;
+		asl::Parameter<double> tOutput;
+
+		asl::UValue<double> dt;
+		asl::UValue<double> bulkMNum;
+		asl::UValue<double> shearMNum;
+		
+		void load(int argc, char * argv[],
+		          string programName,
+		          string programVersion);
+		Parameters();
+		void updateNumValues();
+};
+
+
+Parameters::Parameters():
+	size(3),
+	dx(1e-3,"dx", "dx"),
+	bulkModulus(160e9,"bulk_modulus", "bulk modulus"),
+	shearModulus(79e9,"shear_modulus", "shear modulus"),
+	rho(7800,"rho", "density"),
+	tubeL(.2,"tube_length", "pipe length, m"),
+	tubeDEx(0.021, "tube_diameter_external", "external pipe diameter, m"),
+//	tubeDIn(0.0157,"tube_diameter_internal", "internal pipe diameter, m"),
+	tubeDIn(0.0107,"tube_diameter_internal", "internal pipe diameter, m"),
+	hole1Pos(0.1,"hole_1_position", "position of first hole, m"),
+	hole2Pos(0.15,"hole_2_position", "position of second hole, m"),
+	hole1D(15e-3,"hole_1_diameter", "diameter of first hole, m"),
+	hole2D(15e-3,"hole_2_diameter", "diameter of second hole, m"),
+	tSimulation(8e-5, "simulation_time", "simulation time"),
+	tOutput(1e-6, "output_interval", "output interval")
+{
+}
+
+
+void Parameters::load(int argc, char * argv[],
+                      string programName,
+                      string programVersion)
+{
+	parametersManager.load(argc, argv, programName, programVersion);
+	folder = parametersManager.getFolderWithSlash();
+
+	init();
+}
+
+
+void Parameters::updateNumValues()
+{
+	double vs(sqrt((bulkModulus.v()+2.*shearModulus.v())/rho.v()));
+	dt=dx.v()/vs*.1;
+	cout<<vs<<"; "<<dx.v()<<"; "<<dt.v()<<endl;
+	bulkMNum = bulkModulus.v()/rho.v()/dx.v()/dx.v();
+	shearMNum = shearModulus.v()/rho.v()/dx.v()/dx.v();
+	size = asl::makeAVec(tubeL.v() / dx.v() + 1, 
+	                     tubeDEx.v() / dx.v() + 1, 
+	                     tubeDEx.v() / dx.v() + 1);
+}
+
+void Parameters::init()
+{
+//	if (tubeD.v() < pumpD.v())
+//		asl::errorMessage("Tube's diameter is smaller than pump's diameter");
+	updateNumValues();
+}
+
+asl::SPDistanceFunction generatePipe(asl::Block & block, Parameters &params)
+{
+	asl::SPDistanceFunction pipeGeometry;
+	asl::AVec<double> orientation(asl::makeAVec(1., 0., 0.));
+	asl::AVec<double> lVec(asl::makeAVec(params.tubeL.v()+2.*params.dx.v(), 0., 0.));
+	asl::AVec<double> h1Orientation(asl::makeAVec(0., 1., 0.));
+	asl::AVec<double> h2Orientation(asl::makeAVec(0., 0., 1.));
+	asl::AVec<double> center(asl::AVec<double>(params.size)*.5*params.dx.v());
+	double wallMid((params.tubeDEx.v()+params.tubeDIn.v())*.25);
+	double wallTh((params.tubeDEx.v())*.5);
+	asl::AVec<double> h1Center(center - (center*orientation)*orientation + 
+	                           params.hole1Pos.v()*orientation + 
+	                           h1Orientation*wallMid);
+	asl::AVec<double> h2Center(center - (center*orientation)*orientation + 
+	                           params.hole2Pos.v()*orientation + 
+	                           h2Orientation*wallMid);
+
+	pipeGeometry = asl::generateDFCylinder(params.tubeDEx.v() / 2., lVec, center) &
+					(-asl::generateDFCylinderInf(params.tubeDIn.v() / 2., orientation, center));
+	pipeGeometry = pipeGeometry &  
+		           (-asl::generateDFCylinder(params.hole1D.v() / 2., h1Orientation * wallTh, h1Center));
+	pipeGeometry = pipeGeometry &  
+		           (-asl::generateDFCylinder(params.hole2D.v() / 2., h2Orientation * wallTh, h2Center));	
+	return asl::normalize(-pipeGeometry, params.dx.v());
+}
+
+asl::AVec<float> getAmplitude(double it)
+{
+	float a(it<200. ? 1.-cos(it*6.28/200.) : 0);
+	return asl::makeAVec(a,0.f,0.f);
+}
+
+
+int main(int argc, char* argv[])
+{
+	Parameters params;
+	params.load(argc, argv, "acousticWaves", "0.1");
+		
+	std::cout<<"acoustic waves: Data initialization..."<<flush;
+
+	asl::Block block(params.size, params.dx.v());
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(displacement, asl::makeAVec(0.,0.,0.));
+
+	auto mapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(mapMem, generatePipe(block, params));
+
+	
+	asl::WriterVTKXML writer(params.folder + "acousticWaves");
+	writer.addScalars("map", *mapMem);
+	writer.addVector("displacement", *displacement);
+	writer.write();
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "cubeGravity: Numerics initialization..."<<flush;
+
+	auto elasticity(generateFDElasticityRelax(displacement,
+	                                          params.bulkMNum.v(),
+	                                          params.shearMNum.v(), 
+	                                          params.dt.v(),
+	                                          &asl::d3q19()));
+/*	auto elasticity(generateFDElasticity(displacement,
+	                                     params.bulkMNum.v(),
+	                                     params.shearMNum.v(), 
+	                                     params.dt.v(),
+	                                     &asl::d3q19()));*/
+	elasticity->setDumpingFactor(acl::generateVEConstant(.9999));
+	elasticity->init();
+
+
+	std::vector<asl::SPNumMethod> bc;
+
+	bc.push_back(generateBCZeroStress(elasticity, mapMem));
+//    bc.push_back(generateBCConstantGradient(displacement,asl::makeAVec(0.,0.,0.),mapMem,&asl::d3q19()));
+//    bc.push_back(generateBCConstantGradient(elasticity->getPressureData(),0.,mapMem,&asl::d3q19()));
+//	bc.push_back(generateBCZeroStressP(elasticity, mapMem));
+	asl::UValue<asl::AVec<float>> pres(asl::makeAVec(0.f,0.f,0.f));
+	bc.push_back(asl::generateBCConstantValue(displacement, pres, {asl::X0}));
+
+	initAll(bc);
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing..."<<endl;
+	asl::Timer timer;
+
+	executeAll(bc);
+
+	timer.start();
+	double tOutPrev(0);
+	cout<<params.dt.v()<<endl;
+	for (double t(0); t < params.tSimulation.v(); t+=params.dt.v())
+	{
+		elasticity->execute();
+		pres=getAmplitude(t/params.dt.v());
+		executeAll(bc);
+		if(t - params.tOutput.v()>=tOutPrev)
+		{
+			timer.stop();
+			tOutPrev=t;
+			cout<<t<<"/"<<params.tSimulation.v()<<"; expected left time: "<< 
+				  timer.getLeftTime(t/params.tSimulation.v()) <<endl;
+			writer.write();
+			timer.resume();
+
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/elastic/cubeGravity.cc b/test/testPhysics/elastic/cubeGravity.cc
new file mode 100644
index 0000000..7db045b
--- /dev/null
+++ b/test/testPhysics/elastic/cubeGravity.cc
@@ -0,0 +1,139 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example cubeGravity.cc
+ */
+
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <aslGeomInc.h>
+#include "acl/aclUtilities.h"
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+	asl::Parameter<asl::AVec<int> > size("size", "size 3D");
+	asl::Parameter<cl_float> dx("dx", "dx");
+	asl::Parameter<cl_float> dt("dt", "dt");
+	asl::Parameter<cl_float> bulkModulus("bulk_modulus", "bulk modulus");
+	asl::Parameter<cl_float> shearModulus("shear_modulus", "shear modulus");
+	asl::Parameter<cl_float> rho("rho", "density");
+	asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
+
+	asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
+	asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
+	
+	parametersManager.load(argc, argv, "cubeGravity");
+
+	Param bulkModulusNum(bulkModulus.v()/rho.v()/dx.v()/dx.v());
+	Param shearModulusNum(shearModulus.v()/rho.v()/dx.v()/dx.v());
+
+	asl::AVec<FlT> gNum(g.v()/dx.v());
+		
+	std::cout<<"cubeGravity: Data initialization..."<<flush;
+
+	asl::Block block(size.v(), dx.v());
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	acl::initData(displacement->getEContainer(), acl::generateVEConstantN(3,0));
+
+	auto mapDF(asl::normalize(asl::generateDFInBlock(block, 0), dx.v()));
+	auto map(asl::generateDataContainer_SP(block, mapDF, 1u, acl::typeToTypeID<FlT>()));
+	auto mapX(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	initData(mapX->getEContainer(), map->getEContainer());
+
+	
+	asl::WriterVTKXML writer(parametersManager.getFolderWithSlash() + "cubeGravity");
+	writer.addScalars("map", *mapX);
+	writer.addVector("displacement", *displacement);
+	writer.write();
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "cubeGravity: Numerics initialization..."<<flush;
+
+	asl::SPFDElasticity2 elasticity(new asl::FDElasticity2(displacement,
+	                                                       acl::generateVEConstant(bulkModulusNum.v()),
+	                                                       acl::generateVEConstant(shearModulusNum.v()), 
+	                                                       acl::generateVEConstant(dt.v()),
+	                                                       &asl::d3q15()));
+	elasticity->setForce(acl::generateVEConstant(gNum));
+	elasticity->setDumpingFactor(acl::generateVEConstant(.9));
+	elasticity->init();
+
+	auto bcRigidWall(asl::generateBCRigidWall(elasticity, {asl::X0}));
+	bcRigidWall->init();
+
+	auto bcFreeSurface(generateBCZeroStress(elasticity, mapX));
+	bcFreeSurface->init();
+	
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing..."<<endl;
+	asl::Timer timer;
+
+	bcFreeSurface->execute();
+	bcRigidWall->execute();
+
+
+	timer.start();
+	for (unsigned int i(0); i < tsim.v(); ++i)
+	{
+		elasticity->execute();
+		bcFreeSurface->execute();
+		bcRigidWall->execute();
+		if(!(i % tout.v()))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/elastic/cubeIncompressibleGravity.cc b/test/testPhysics/elastic/cubeIncompressibleGravity.cc
new file mode 100644
index 0000000..de69260
--- /dev/null
+++ b/test/testPhysics/elastic/cubeIncompressibleGravity.cc
@@ -0,0 +1,143 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example cubeGravity.cc
+ */
+
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <aslGeomInc.h>
+#include "acl/aclUtilities.h"
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+	asl::Parameter<asl::AVec<int> > size("size", "size 3D");
+	asl::Parameter<cl_float> dx("dx", "dx");
+	asl::Parameter<cl_float> dt("dt", "dt");
+	asl::Parameter<cl_float> bulkModulus("bulk_modulus", "bulk modulus");
+	asl::Parameter<cl_float> shearModulus("shear_modulus", "shear modulus");
+	asl::Parameter<cl_float> rho("rho", "density");
+	asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
+
+	asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
+	asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
+	
+	parametersManager.load(argc, argv, "cubeGravity");
+
+	Param bulkModulusNum(bulkModulus.v()/rho.v()/dx.v()/dx.v()*dt.v());
+	Param shearModulusNum(shearModulus.v()/rho.v()/dx.v()/dx.v()*dt.v());
+
+	asl::AVec<FlT> gNum(g.v()/dx.v()*dt.v());
+		
+	std::cout<<"cubeGravity: Data initialization..."<<flush;
+
+	asl::Block block(size.v(), dx.v());
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	acl::initData(displacement->getEContainer(), acl::generateVEConstantN(3,0));
+
+	auto mapDF(asl::normalize(asl::generateDFInBlock(block, 0), dx.v()));
+	auto map(asl::generateDataContainer_SP(block, mapDF, 1u, acl::typeToTypeID<FlT>()));
+	auto mapX(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	initData(mapX, mapDF);
+
+	
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "cubeIncompressibleGravity: Numerics initialization..."<<flush;
+
+	auto elasticity(generateFDElasticityStatic(displacement,
+	                                           bulkModulusNum.v(),
+	                                           shearModulusNum.v(), 
+	                                           &asl::d3q15()));
+	elasticity->setForce(acl::generateVEConstant(gNum));
+	elasticity->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	bc.push_back(generateBCZeroStress(elasticity, mapX));
+	bc.push_back(generateBCZeroStressP(elasticity, mapX));
+	bc.push_back(asl::generateBCRigidWall(elasticity, {asl::X0}));
+	asl::initAll(bc);
+
+	asl::WriterVTKXML writer(parametersManager.getFolderWithSlash() + "cubeGravity");
+	writer.addScalars("map", *mapX);
+	writer.addVector("displacement", *displacement);
+	writer.addScalars("pressure", *elasticity->getPressureData());
+	
+	std::cout << "Finished" << endl;
+	std::cout << "Computing..."<<endl;
+	asl::Timer timer, timerBulk, timerBC;
+
+	executeAll(bc);
+	writer.write();
+
+	timer.start();
+	timerBulk.reset();
+	timerBC.reset();
+	for (unsigned int i(0); i < tsim.v(); ++i)
+	{
+		timerBulk.resume();
+		elasticity->execute();
+		timerBulk.stop();
+		timerBC.resume();
+		executeAll(bc);
+		timerBC.stop();		
+		if(!(i % tout.v()))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+	cout << "timeBulk=" << timerBulk.getTime() << 
+		    "; timeBC=" << timerBC.getTime()  << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/elastic/cubePoroelasticGravity.cc b/test/testPhysics/elastic/cubePoroelasticGravity.cc
new file mode 100644
index 0000000..76bb017
--- /dev/null
+++ b/test/testPhysics/elastic/cubePoroelasticGravity.cc
@@ -0,0 +1,149 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example cubePoroelasticGravity.cc
+ */
+
+#include <math/aslVectors.h>
+#include <aslDataInc.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDPoroElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <num/aslFDPoroElasticityBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <aslGeomInc.h>
+#include "acl/aclUtilities.h"
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+	asl::Parameter<asl::AVec<int> > size("size", "size 3D");
+	asl::Parameter<cl_float> dx("dx", "dx");
+	asl::Parameter<cl_float> dt("dt", "dt");
+	asl::Parameter<cl_float> bulkModulus("bulk_modulus", "bulk modulus");
+	asl::Parameter<cl_float> shearModulus("shear_modulus", "shear modulus");
+	asl::Parameter<cl_float> hydraulicConductivity("hydraulic_conductivity", "hydraulic conductivity");
+	asl::Parameter<cl_float> rho("rho", "density");
+	asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
+
+	asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
+	asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
+	
+	parametersManager.load(argc, argv, "cubePoroElasticGravity");
+
+	Param bulkModulusNum(bulkModulus.v()/rho.v()/dx.v()/dx.v()*dt.v()*dt.v());
+	Param shearModulusNum(shearModulus.v()/rho.v()/dx.v()/dx.v()*dt.v()*dt.v());
+
+	asl::AVec<FlT> gNum(g.v()*dt.v()*dt.v());
+		
+	std::cout<<"cubeGravity: Data initialization..."<<flush;
+
+	asl::Block block(size.v(), dx.v());
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(displacement, asl::makeAVec(0.,0.,0.));
+	auto pressureL(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(pressureL, 0.);
+
+	auto mapDF(asl::normalize(asl::generateDFInBlock(block, 0), dx.v()));
+	auto map(asl::generateDataContainer_SP(block, mapDF, 1u, acl::typeToTypeID<FlT>()));
+	auto mapX(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	initData(mapX, mapDF);
+
+	
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "cubeIncompressibleGravity: Numerics initialization..."<<flush;
+
+	auto elasticity(generateFDPoroElasticity(displacement,
+	                                         pressureL,
+	                                         bulkModulusNum.v(),
+	                                         shearModulusNum.v(),
+	                                         hydraulicConductivity.v(),
+	                                         &asl::d3q15()));
+	elasticity->setForce(acl::generateVEConstant(gNum));
+	elasticity->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	asl::addBCZeroStress(bc, elasticity, mapX);
+	asl::addBCRigidWall(bc, elasticity, {asl::X0});
+	asl::initAll(bc);
+
+	asl::WriterVTKXML writer(parametersManager.getFolderWithSlash() + "cubePoroElasticGravity");
+	writer.addScalars("map", *mapX);
+	writer.addVector("displacement", *displacement);
+	writer.addScalars("pressure", *elasticity->getPressureData());
+	writer.addScalars("pressureL", *elasticity->getLiquidPressureData());
+	
+	std::cout << "Finished" << endl;
+	std::cout << "Computing..."<<endl;
+	asl::Timer timer, timerBulk, timerBC;
+
+	executeAll(bc);
+	writer.write();
+
+	timer.start();
+	timerBulk.reset();
+	timerBC.reset();
+	for (unsigned int i(0); i < tsim.v(); ++i)
+	{
+		timerBulk.resume();
+		elasticity->execute();
+		timerBulk.stop();
+		timerBC.resume();
+		executeAll(bc);
+		timerBC.stop();		
+		if(!(i % tout.v()))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+	cout << "timeBulk=" << timerBulk.getTime() << 
+		    "; timeBC=" << timerBC.getTime()  << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/elastic/poroelastic.cc b/test/testPhysics/elastic/poroelastic.cc
new file mode 100644
index 0000000..00b24d0
--- /dev/null
+++ b/test/testPhysics/elastic/poroelastic.cc
@@ -0,0 +1,165 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example poroelastic.cc
+ */
+
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include<acl/aclGenerators.h>
+#include <num/aslFDPoroElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <num/aslFDPoroElasticityBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslDistanceFunction.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include "acl/aclUtilities.h"
+#include <math/aslIndex2Position.h>
+
+#include <readers/aslVTKFormatReaders.h>
+#include <writers/aslVTKFormatWriters.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+	asl::Parameter<asl::AVec<int> > size("size", "size 3D");
+	asl::Parameter<cl_float> dx("dx", "dx");
+	asl::Parameter<cl_float> dt("dt", "dt");
+	asl::Parameter<cl_float> bulkModulus("bulk_modulus", "bulk modulus");
+	asl::Parameter<cl_float> shearModulus("shear_modulus", "shear modulus");
+	asl::Parameter<cl_float> hydraulicConductivity("hydraulic_conductivity", "hydraulic conductivity");
+	asl::Parameter<cl_float> rho("rho", "density");
+	asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
+
+	asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
+	asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
+	
+	parametersManager.load(argc, argv, "poroelastic");
+		
+	std::cout<<"Jumping Box: Data initialization...";
+
+	asl::SPDataWithGhostNodesACLData map0(asl::read(parametersManager.getFolderWithSlash()+
+	                                                "brain.vti", 0));
+//	asl::Block block(size.v(), dx.v());
+	asl::Block block(map0->getInternalBlock());
+	dx.v() = block.dx*1e-3;
+
+	dt.v() = 0.0001f;
+	Param bulkModulusNum(bulkModulus.v()/rho.v()/dx.v()/dx.v());
+	Param shearModulusNum(shearModulus.v()/rho.v()/dx.v()/dx.v());
+	asl::AVec<FlT> gNum(g.v()/dx.v());
+	Param hydraulicConductivityNum(hydraulicConductivity.v()/dx.v()/dx.v()/dx.v());
+
+	cout<<gNum<<"; "<<bulkModulusNum.v()<<"; "<<hydraulicConductivityNum.v()<<endl;
+
+	
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	auto pressure(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	acl::initData(displacement->getEContainer(), acl::generateVEConstantN(3,0));
+	acl::initData(pressure->getEContainer(), acl::generateVEConstant(0));
+	
+//	auto mapDF(asl::generateDFInBlock(block, 0));
+//	auto map(asl::generateDataContainer_SP(block, mapDF, 1u, acl::typeToTypeID<FlT>()));
+	auto mapX(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+//	initData(mapX->getEContainer(), map->getEContainer());
+	initData(mapX->getEContainer(), map0->getEContainer()*2.-1., acl::KERNEL_BASIC);
+	
+	asl::WriterVTKXML writer(parametersManager.getFolderWithSlash() + "displacement");
+	writer.addVector("displacement", *displacement);
+	writer.addScalars("pressure", *pressure);
+	writer.addScalars("map", *mapX);
+//	writer.write();
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "Jumping Box: Numerics initialization...";
+
+	auto elasticity(make_shared<asl::FDPoroElasticity>(displacement,
+	                                                   pressure,
+   	                                                   acl::generateVEConstant(bulkModulusNum.v()),
+	                                                   acl::generateVEConstant(shearModulusNum.v()),
+	                                                   acl::generateVEConstant(hydraulicConductivityNum.v()),
+	                                                   &asl::d3q15()));
+
+	asl::Index2PositionACL i2p(displacement->getBlock(),acl::typeToTypeID<FlT>());
+	asl::AVec<> center(asl::AVec<>(displacement->getBlock().getSize())*.5 *
+	                   displacement->getBlock().dx +
+	                   displacement->getBlock().position);
+	asl::SPDistanceFunction scf(asl::generateDFPlane(asl::AVec<>(g.v()),center));
+	
+	auto force ((1.-acl::sign(scf->getDistance(i2p.positionWithInit)))/2.*
+	            acl::generateVEConstant(gNum));
+	auto forceField(asl::generateDataContainer_SP(block, force, 1u));
+	
+	elasticity->setForce(forceField->getSubContainer());
+	elasticity->init();
+
+	vector<asl::SPNumMethod> bcl;
+	bcl.push_back(asl::generateBCZeroStress(elasticity, mapX));
+	asl::addBCRigidWall(bcl, elasticity, {asl::X0});
+
+//!!!!!!	addSliceZ(*bcRigidWall, block.getSize()[0]/2 + 1); return
+
+	initAll(bcl);
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing..."<<flush;
+	asl::Timer timer;
+
+	executeAll(bcl);
+
+	writer.write();
+
+	timer.start();
+	for (unsigned int i(0); i < tsim.v(); ++i)
+	{
+		elasticity->execute();
+		executeAll(bcl);
+		if(!(i % tout.v()))
+			writer.write();
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/CMakeLists.txt b/test/testPhysics/flow/CMakeLists.txt
new file mode 100644
index 0000000..26eaef9
--- /dev/null
+++ b/test/testPhysics/flow/CMakeLists.txt
@@ -0,0 +1,54 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(flow flow.cc)
+target_link_libraries(flow asl aslnum aslvtk)
+set_property(TARGET flow PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flow)
+
+add_executable(flow2 flow2.cc)
+target_link_libraries(flow2 asl aslnum aslvtk)
+set_property(TARGET flow2 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flow2)
+
+add_executable(flow3 flow3.cc)
+target_link_libraries(flow3 asl aslnum aslvtk)
+set_property(TARGET flow3 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flow3)
+
+add_executable(flowRotatingCylinders flowRotatingCylinders.cc)
+target_link_libraries(flowRotatingCylinders asl aslnum aslvtk)
+set_property(TARGET flowRotatingCylinders PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flowRotatingCylinders)
+
+add_executable(flowKDPGrowth flowKDPGrowth.cc)
+target_link_libraries(flowKDPGrowth asl aslnum aslvtk)
+set_property(TARGET flowKDPGrowth PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flowKDPGrowth)
+
+add_executable(flowAroundObject flowAroundObject.cc)
+target_link_libraries(flowAroundObject asl aslnum aslvtk)
+set_property(TARGET flowAroundObject PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flowAroundObject)
+
+add_executable(compressor compressor.cc)
+target_link_libraries(compressor asl aslnum aslvtk)
+set_property(TARGET compressor PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/compressor)
+
+add_executable(locomotive_in_tunnel locomotive_in_tunnel.cc)
+target_link_libraries(locomotive_in_tunnel asl aslnum aslvtk)
+set_property(TARGET locomotive_in_tunnel PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locomotive_in_tunnel)
+
+add_executable(locomotive_stability locomotive_stability.cc)
+target_link_libraries(locomotive_stability asl aslnum aslvtk)
+set_property(TARGET locomotive_stability PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locomotive_stability)
+
+add_executable(bus_wind bus_wind.cc)
+target_link_libraries(bus_wind asl aslnum aslvtk)
+set_property(TARGET bus_wind PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bus_wind)
+
+add_executable(multiphase_flow multiphase_flow.cc)
+target_link_libraries(multiphase_flow asl aslnum aslvtk)
+set_property(TARGET multiphase_flow PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/multiphase_flow)
+
+add_executable(multicomponent_flow multicomponent_flow.cc)
+target_link_libraries(multicomponent_flow asl aslnum aslvtk)
+set_property(TARGET multicomponent_flow PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/multicomponent_flow)
+
+add_executable(pitot_tube_ice pitot_tube_ice.cc)
+target_link_libraries(pitot_tube_ice asl aslnum aslvtk)
+set_property(TARGET pitot_tube_ice PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pitot_tube_ice)
diff --git a/test/testPhysics/flow/bus_wind.cc b/test/testPhysics/flow/bus_wind.cc
new file mode 100644
index 0000000..0b0e0f1
--- /dev/null
+++ b/test/testPhysics/flow/bus_wind.cc
@@ -0,0 +1,146 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example bus_wind.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <math/aslDistanceFunction.h>
+#include<math/aslPositionFunction.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <readers/aslVTKFormatReaders.h>
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+
+int main()
+{
+	Param dx(8);
+	Param dt(1.);
+	Param nu(.01);
+	
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	
+	std::cout<<"Flow: Data initialization...";
+
+
+	auto object(asl::readSurf("bus.stl", dx.v(), 1.5,.25,0.,1.,3.,1.));
+	
+	asl::Block block(object->getInternalBlock());
+
+	auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(forceField, makeAVec(0.,0.,0.));
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nu.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(-.1,.0,-.05));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+
+	bc.push_back(generateBCNoSlip(lbgk,  object));
+	bcV.push_back(generateBCNoSlipVel(lbgk, object));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(-0.1,0.,-0.05), 
+	                                                {asl::X0, asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	initAll(bc);
+	initAll(bcV);
+
+	auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+	computeForce->init();
+	
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+
+	asl::WriterVTKXML writer("bus_wind");
+	writer.addScalars("bus", *object);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+	writer.addVector("force", *forceField);
+
+	executeAll(bc);
+	executeAll(bcV);
+	computeForce->execute();
+
+	writer.write();
+
+	asl::Timer timer, timer1, timer2;
+	timer.start();
+	timer1.reset();
+	timer2.reset();
+	for(unsigned int i(1); i < 101; ++i)
+	{
+		timer1.resume();
+		lbgk->execute();
+		timer1.stop();
+		timer2.resume();
+		executeAll(bc);
+		timer2.stop();
+		if(!(i%1000))
+		{
+			cout<<i<<endl;
+			executeAll(bcV);
+			computeForce->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+	cout << "time1=" << timer1.getTime() << "; time2=" << timer2.getTime() << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/compressor.cc b/test/testPhysics/flow/compressor.cc
new file mode 100644
index 0000000..fb21bfc
--- /dev/null
+++ b/test/testPhysics/flow/compressor.cc
@@ -0,0 +1,164 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example compressor.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include<math/aslPositionFunction.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <readers/aslVTKFormatReaders.h>
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateCase(asl::Block & bl)
+{
+	double rCase((bl.getBPosition()[1] - bl.position[1]) / 2.);
+
+	asl::AVec<> center(.5*(bl.getBPosition() + bl.position)); 
+	center[1] = bl.position[1]  + rCase;
+
+	auto comprCase(-(generateDFCylinderInf(rCase, makeAVec(0., 0., 1.), center)));
+
+	return normalize(comprCase, bl.dx);
+}
+
+int main()
+{
+	Param dx(0.5);
+	Param dt(.001);
+	Param nu(.2);
+	// Angular velocity
+	Param w(6.*3.14*2./60.);
+	
+	AVec<int> size(makeAVec(33., 33., 90.)*(1./dx.v()));
+	asl::Block bl(size, dx.v(), makeAVec(-16.65, -26.15, -67.7));
+	
+//	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	Param nuNum(.2);
+	// Angular velocity in one iteration
+	Param wNum(w.v()*dt.v());
+
+	std::cout<<"Compressor: Data initialization...";
+
+
+	auto compressorMap(asl::readSurf("axial-compressor.stl", bl));
+	
+	asl::Block block(compressorMap->getInternalBlock());
+
+	auto comprCaseMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(comprCaseMap, generateCase(block));
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Compressor: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block,
+	                               acl::generateVEConstant(FlT(nuNum.v())),
+	                               &asl::d3q15()));
+	// Set angular velocity in lbgk
+	lbgk->setOmega(acl::generateVEConstant(makeAVec(0.,0.,wNum.v())));
+	lbgk->init();
+
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	// Initialization of lbgk
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcVis;
+
+	// Position Function Angular Velocity Field
+	auto vfCase(asl::generatePFRotationField(makeAVec(0.,0., wNum.v()/dx.v()),
+	                                         .5*(block.getBPosition() + block.position)));
+	// Boundary condition
+	bc.push_back(generateBCVelocity(lbgk, vfCase, comprCaseMap));
+	// Boundary condition for visualization
+	bcVis.push_back(generateBCVelocityVel(lbgk, vfCase, comprCaseMap));
+	bc.push_back(asl::generateBCConstantPressure(lbgk, 1., {asl::Z0, asl::ZE}));
+	bc.push_back(generateBCNoSlip(lbgk, compressorMap));
+	bcVis.push_back(generateBCNoSlipVel(lbgk, compressorMap));
+
+	initAll(bc);
+	initAll(bcVis);
+
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("compressor");
+	writer.addScalars("compressor", *compressorMap);
+	writer.addScalars("case", *comprCaseMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+
+	executeAll(bc);
+	executeAll(bcVis);
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 10001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%2000))
+		{
+			cout<<i<<endl;
+			executeAll(bcVis);
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flow.cc b/test/testPhysics/flow/flow.cc
new file mode 100644
index 0000000..d33011f
--- /dev/null
+++ b/test/testPhysics/flow/flow.cc
@@ -0,0 +1,142 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flow.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param nu(.00625);
+
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	AVec<int> size(asl::makeAVec(300,50,50));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+
+	auto ball(generateDFCylinderInf(.125*gSize[1],
+	                             makeAVec(0.,1.,0.),
+	                             .45*makeAVec(gSize[1],gSize[1],gSize[2])));
+	// Formula
+	auto ballMap(asl::generateDataContainer_SP(block, ball, 1u, acl::typeToTypeID<FlT>()));
+	// Data
+	auto ballMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(ballMapMem, ball);
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block,
+	                               acl::generateVEConstant(FlT(nuNum.v())),
+	                               &asl::d3q15()));
+	lbgk->init();
+
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	// Initialization of lbgk
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+//	lbgkUtil->initF(acl::generateVEConstant(.1), acl::generateVEConstant(.0,.0,.0));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcVis;
+	
+	bc.push_back(asl::generateBCConstantPressure(lbgk, 1.2, {asl::X0}));
+	bc.push_back(asl::generateBCConstantPressure(lbgk, 0.8, {asl::XE}));
+	bc.push_back(generateBCNoSlip(lbgk, {asl::Y0, asl::YE, asl::Z0, asl::ZE}));
+	bc.push_back(generateBCNoSlip(lbgk, ballMap));
+	bcVis.push_back(generateBCNoSlipVel(lbgk, ballMap));
+
+	initAll(bc);
+	initAll(bcVis);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("flowRes");
+	writer.addScalars("map", *ballMapMem);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+
+
+
+	executeAll(bc);
+	executeAll(bcVis);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 1001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%5000))
+		{
+			cout<<i<<endl;
+			executeAll(bcVis);
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flow2.cc b/test/testPhysics/flow/flow2.cc
new file mode 100644
index 0000000..0532c8e
--- /dev/null
+++ b/test/testPhysics/flow/flow2.cc
@@ -0,0 +1,186 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flow2.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateMirror(double x, double y)
+{
+	double hCyl (10.);
+	double rCyl (1.5);
+	double a(10.);
+	double b(6.);
+	vector<AVec<>> rect({.5*makeAVec( .866*a,-b,-a*.5),.5*makeAVec(-.866*a,-b, a*.5),
+	                     .5*makeAVec(-.866*a, b, a*.5),.5*makeAVec( .866*a, b,-a*.5)});
+	vector<AVec<>> r1(rect.size());
+	vector<AVec<>> r2(rect.size());
+	auto r1C(makeAVec(x,y+rCyl*.5+b*.5,hCyl));
+	auto r2C(makeAVec(x,y-rCyl*.5-b*.5,hCyl));
+	for(unsigned int i(0); i<rect.size();++i)
+	{
+		r1[i]=r1C + rect[i];
+		r2[i]=r2C + rect[i];
+	}
+	
+	auto res(asl::generateDFConvexPolygonPrism(r1) | generateDFConvexPolygonPrism(r2));
+	res = (res & 
+		   generateDFPlane(makeAVec(.5,0.,.866), r1C + makeAVec(rCyl,0.,0.)) &
+		   generateDFPlane(makeAVec(-.5,0.,-.866), r1C - makeAVec(rCyl,0.,0.))) |
+		   generateDFCylinder(rCyl, makeAVec(0.,0.,hCyl), makeAVec(x,y,hCyl*.5));
+	return res;
+}
+
+asl::SPDistanceFunction generateMirrors()
+{
+	vector<double> xValues;
+	vector<double> yValues;
+
+	for(unsigned int i(0); i < 8; ++i)
+		for(unsigned int j(0); j < 10; ++j)
+		{
+			xValues.push_back(25.+ 20.*i);
+			yValues.push_back(25.+ 15.*j);
+		}
+
+	auto res(generateMirror(xValues[0], yValues[0]));
+	for(unsigned int i(1); i < xValues.size(); ++i)
+		res = res | generateMirror(xValues[i], yValues[i]);
+
+	return res;
+}
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param nu(.0125);
+
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	AVec<int> size(asl::makeAVec(200,200,25));
+
+	AVec<> gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+
+	auto mirrorsMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(mirrorsMapMem, generateMirrors());
+
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nuNum.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+//	lbgkUtil->initF(acl::generateVEConstant(.1), acl::generateVEConstant(.0,.0,.0));
+
+	auto bcNoSlip(generateBCNoSlip(lbgk,{asl::Y0, asl::YE, asl::Z0}));
+	auto bcNoSlipM(generateBCNoSlip(lbgk, mirrorsMapMem));
+	auto bcNoSlipV(generateBCNoSlipVel(lbgk, mirrorsMapMem));
+	auto bcP(asl::generateBCConstantPressure(lbgk, 1., {asl::X0, asl::XE}));
+	auto bcTop(asl::generateBCConstantVelocity(lbgk, asl::makeAVec(0.1,0.,0.), {asl::ZE}));
+
+	bcNoSlip->init();
+	bcNoSlipM->init();
+	bcNoSlipV->init();
+	bcP->init();
+	bcTop->init();
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("flow2Res");
+	writer.addScalars("map", *mirrorsMapMem);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+
+
+
+	bcP->execute();
+	bcTop->execute();
+	bcNoSlip->execute();
+	bcNoSlipM->execute();
+
+	bcNoSlipV->execute();
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(0); i < 1000  ; ++i)
+	{
+		lbgk->execute();
+		bcP->execute();
+		bcTop->execute();
+		bcNoSlip->execute();
+		bcNoSlipM->execute();
+		if(!(i%100))
+		{
+			cout<< i <<endl;
+			bcNoSlipV->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flow3.cc b/test/testPhysics/flow/flow3.cc
new file mode 100644
index 0000000..1d88ab8
--- /dev/null
+++ b/test/testPhysics/flow/flow3.cc
@@ -0,0 +1,164 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flow3.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateOrderedCylinders(asl::Block & block)
+{
+	double r(2.);
+	double spacing(4.);
+
+	asl::SPDistanceFunction cylinder;
+	asl::SPDistanceFunction resultGeometry;
+	asl::AVec<double> orientation(asl::makeAVec(0., 0., 1.));
+	for (int i = 0; i < block.getSize()[0] / (2 * r + spacing); ++i)
+	{
+		for (int j = 0; j < block.getSize()[1] / (2 * r + spacing); ++j)
+		{
+			cylinder = generateDFCylinderInf(r, orientation, asl::makeAVec(i * (2. * r + spacing) + r + spacing / 2., j * (2. * r + spacing) + r + spacing / 2., 0.));
+			resultGeometry = resultGeometry | cylinder;
+		}
+	}
+
+	return resultGeometry;
+}
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param nu(.00625);
+
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	AVec<int> size(asl::makeAVec(50, 50, 50));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+
+	auto cylindersMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(cylindersMapMem, generateOrderedCylinders(block));
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nuNum.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+
+	auto bcNoSlip(generateBCNoSlip(lbgk,{asl::Y0, asl::YE, asl::Z0, asl::ZE}));
+	auto bcNoSlipM(generateBCNoSlip(lbgk, cylindersMapMem));
+	auto bcNoSlipV(generateBCNoSlipVel(lbgk, cylindersMapMem));
+	asl::BCConstantPressure bcIn(lbgk, acl::generateVEConstant(1.2));
+	asl::BCConstantPressure bcOut(lbgk, acl::generateVEConstant(0.8));
+
+	addSliceX0(bcIn);
+	addSliceXE(bcOut);
+
+	bcNoSlip->init();
+	bcNoSlipM->init();
+	bcNoSlipV->init();
+	bcIn.init();
+	bcOut.init();
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("flow3Res");
+	writer.addScalars("map", *cylindersMapMem);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+
+
+
+	bcIn.execute();
+	bcOut.execute();
+	bcNoSlip->execute();
+	bcNoSlipM->execute();
+
+	bcNoSlipV->execute();
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(0); i < 1000; ++i)
+	{
+		lbgk->execute();
+		bcIn.execute();
+		bcOut.execute();
+		bcNoSlip->execute();
+		bcNoSlipM->execute();
+		if(!(i%100))
+		{
+			cout<<i<<endl;
+			bcNoSlipV->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flowAroundObject.cc b/test/testPhysics/flow/flowAroundObject.cc
new file mode 100644
index 0000000..23db45f
--- /dev/null
+++ b/test/testPhysics/flow/flowAroundObject.cc
@@ -0,0 +1,173 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flow.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslPositionFunction.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <readers/aslVTKFormatReaders.h>
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateTunel(asl::Block & bl)
+{
+
+	double l(bl.getBPosition()[0]-bl.position[0]+bl.dx);
+	double rTunel((bl.getBPosition()[2]-bl.position[2])/2.);
+
+	double dx(bl.dx);
+
+	asl::AVec<int> size(bl.getSize());
+
+	asl::AVec<> center(.5*(bl.getBPosition()+bl.position)); 
+	center[1]=bl.position[1]+.25*rTunel;
+	asl::AVec<> centerG(center); 
+	centerG[1]=bl.position[1];
+
+	auto tunel(-(generateDFCylinder(rTunel, makeAVec(l,0.,0.), center) &
+	             generateDFPlane(makeAVec(0.,-1.,0.), centerG)));
+
+	return normalize(tunel, dx);
+}
+
+
+int main()
+{
+	Param dx(0.5);
+	Param dt(1.);
+	Param nu(.01);
+
+	
+	AVec<int> size(makeAVec(150., 37., 53.2)*(1./dx.v()));
+	asl::Block bl(size,dx.v(),makeAVec(-10.,-1.63, -31.6));
+	
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	
+	std::cout<<"Flow: Data initialization...";
+
+
+	auto object(asl::readSurf("train1.stl", bl));
+	
+	asl::Block block(object->getInternalBlock());
+
+	auto tunelMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(tunelMap, generateTunel(block));
+
+	auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(forceField, makeAVec(0.,0.,0.));
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nuNum.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.1,.0,.0));
+
+	auto vfTunel(asl::generatePFConstant(makeAVec(0.1,0.,0.)));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+
+	bc.push_back(generateBCVelocity(lbgk, vfTunel, tunelMap));
+	bcV.push_back(generateBCVelocityVel(lbgk, vfTunel, tunelMap));
+//	bcV.push_back(generateBCNoSlipRho(lbgk, tunelMap));
+	bc.push_back(generateBCNoSlip(lbgk,  object));
+	bcV.push_back(generateBCNoSlipVel(lbgk, object));
+//	bcV.push_back(generateBCNoSlipRho(lbgk, object));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., makeAVec(0.1,0.,0.), {asl::X0, asl::XE}));
+
+	initAll(bc);
+	initAll(bcV);
+
+	auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+	computeForce->init();
+	
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("flowAroundObjRes");
+	writer.addScalars("map", *object);
+	writer.addScalars("tunel", *tunelMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+	writer.addVector("force", *forceField);
+
+	executeAll(bc);
+	executeAll(bcV);
+	computeForce->execute();
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 2001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%200))
+		{
+			cout<<i<<endl;
+			executeAll(bcV);
+			computeForce->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flowKDPGrowth.cc b/test/testPhysics/flow/flowKDPGrowth.cc
new file mode 100644
index 0000000..92eaf13
--- /dev/null
+++ b/test/testPhysics/flow/flowKDPGrowth.cc
@@ -0,0 +1,344 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flowKDPGrowth.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslPositionFunction.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include <num/aslBasicBC.h>
+#include <num/aslCrystalGrowthBC.h>
+#include <num/aslFDAdvectionDiffusion.h>
+#include "utilities/aslTimer.h"
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateBath(asl::Block & bl)
+{
+
+//	double hBath(2.);
+	double rBath(1.);
+
+	double dx(bl.dx);
+
+	asl::AVec<int> size(bl.getSize());
+
+	asl::AVec<>center(.5*dx*AVec<>(size));
+
+		
+
+	auto bath(-(generateDFCylinderInf(rBath, makeAVec(0.,0.,1.), dx*AVec<>(size)*.5) &
+	           generateDFPlane(makeAVec(0.,0.,1.), center*1.99) &
+	           generateDFPlane(makeAVec(0.,0.,-1.), center*0.)));
+
+	return normalize(bath, dx);
+}
+
+asl::SPDistanceFunction generatePlatform(asl::Block & bl)
+{
+	double rDisk(.9);
+	double hDisk(0.1);
+
+	double rAxis(0.05);
+	double hAxis(.5);
+
+	double wPillar(.2);
+	double dPillar(.1);
+
+	double dx(bl.dx);
+	asl::AVec<int> size(bl.getSize());
+	asl::AVec<>center(.5*dx*AVec<>(size));
+	
+	vector<asl::AVec<>> pillar1{makeAVec(wPillar*.5, dPillar*.5,0.),
+	                            makeAVec(-wPillar*.5, dPillar*.5,0.),
+	                            makeAVec(-wPillar*.5, -dPillar*.5,0.),
+	                            makeAVec(wPillar*.5, -dPillar*.5,0.)};
+
+	vector<asl::AVec<>> pillar2{makeAVec(dPillar*.5, wPillar*.5,0.),
+	                            makeAVec(-dPillar*.5, wPillar*.5,0.),
+	                            makeAVec(-dPillar*.5, -wPillar*.5,0.),
+	                            makeAVec(dPillar*.5, -wPillar*.5,0.)};
+	
+	vector<asl::AVec<>> pillarC{makeAVec(center[0]+rDisk-dPillar*.5, center[1], 0.),
+                                makeAVec(center[0]-rDisk+dPillar*.5, center[1], 0.),
+	                            makeAVec(center[0], center[1]+rDisk-dPillar*.5,0.),
+	                            makeAVec(center[0], center[1]-rDisk+dPillar*.5,0.)};
+	vector<vector<asl::AVec<>>> pillarsPoints(4);
+	for(unsigned int i(0); i<4; ++i)
+		pillarsPoints[i].resize(4);
+	
+	for(unsigned int i(0); i<4; ++i)
+	{
+		pillarsPoints[0][i] = pillar2[i] + pillarC[0];
+		pillarsPoints[1][i] = pillar2[i] + pillarC[1];
+		pillarsPoints[2][i] = pillar1[i] + pillarC[2];
+		pillarsPoints[3][i] = pillar1[i] + pillarC[3];
+	}
+
+	
+	auto diskBottom(generateDFCylinder(rDisk, 
+	                                   makeAVec(0., 0., hDisk),  
+	                                   makeAVec(center[0], center[1], .5*hDisk)));
+	auto diskTop(generateDFCylinder(rDisk, 
+	                                makeAVec(0., 0., hDisk),  
+	                                makeAVec(center[0], center[1], -.5*hDisk - hAxis + dx*size[2])));
+	auto axis(generateDFCylinder(rAxis, 
+	                                makeAVec(0., 0., hAxis+hDisk*.5),  
+	                                makeAVec(center[0], center[1], - .5*hAxis - hDisk*.25 + dx*size[2])));
+	auto dfPillar1(generateDFConvexPolygonPrism(pillarsPoints[0]));
+	auto dfPillar2(generateDFConvexPolygonPrism(pillarsPoints[1]));
+	auto dfPillar3(generateDFConvexPolygonPrism(pillarsPoints[2]));
+	auto dfPillar4(generateDFConvexPolygonPrism(pillarsPoints[3]));
+	auto dfPillars((dfPillar1 | dfPillar2 | dfPillar3 | dfPillar4) & 
+	               generateDFPlane(makeAVec(0.,0.,-1.), makeAVec(0.,0.,.5*hDisk)) &
+	               generateDFPlane(makeAVec(0.,0.,1.), makeAVec(0.,0.,-.5*hDisk - hAxis + dx*size[2])));
+
+	return normalize(diskBottom | diskTop | axis | dfPillars, dx);
+}
+
+asl::SPDistanceFunction generateCrystal(asl::Block & bl)
+{
+
+	double aCrystal(.5);
+	double hCrystalBase(.5);
+	double hCrystalPyramid(.5);
+
+	double hDisk(0.1);
+
+	double dx(bl.dx);
+	asl::AVec<int> size(bl.getSize());
+	asl::AVec<>center(.5*dx*AVec<>(size));
+	
+	auto crystalB(asl::generateDFConvexPolygonPrism({center+makeAVec( aCrystal,  aCrystal,0.),
+						  				             center+makeAVec(-aCrystal,  aCrystal,0.),
+										             center+makeAVec(-aCrystal, -aCrystal,0.),
+										             center+makeAVec( aCrystal, -aCrystal,0.)}) &
+	              generateDFPlane(makeAVec(0.,0.,-1.), makeAVec(0.,0., hDisk-.001)) &
+	              generateDFPlane(makeAVec(0.,0., 1.), makeAVec(0.,0., hDisk + hCrystalBase)));
+	auto cCrPyrBase(makeAVec(center[0],center[1],hDisk+hCrystalBase-.01));
+	auto crystalT(asl::generateDFConvexPolygonPyramid({cCrPyrBase+makeAVec( aCrystal,  aCrystal,0.),
+						  				               cCrPyrBase+makeAVec(-aCrystal,  aCrystal,0.),
+										               cCrPyrBase+makeAVec(-aCrystal, -aCrystal,0.),
+										               cCrPyrBase+makeAVec( aCrystal, -aCrystal,0.)},
+	                                                   cCrPyrBase+makeAVec(0.,0.,hCrystalPyramid)));
+	return normalize(crystalB | crystalT, dx);
+//	return crystalB | crystalT;
+}
+
+double getWRotation(double t)
+{
+	double tPeriod(128);
+	double wMax(6.*3.14*2./60.);
+	double tPlato(tPeriod * .25);
+	double tAcceleration(tPeriod * .1);
+	double tStop(tPeriod * .05);
+
+	double intPart;
+	double tRel(modf(t/tPeriod, &intPart));
+	double x(0);
+	if(tRel<=tAcceleration)
+		x = tRel / tAcceleration;
+	if(tRel>tAcceleration && tRel<=tAcceleration+tPlato)
+		x = 1.;
+	if(tRel>tAcceleration+tPlato && tRel<=2.*tAcceleration+tPlato)
+		x = (2.*tAcceleration + tPlato - tRel) / tAcceleration;
+	if(tRel>2.*tAcceleration+tPlato && tRel<=2.*tAcceleration+tPlato+tStop)
+		x = 0;
+	if(tRel>2.*tAcceleration+tPlato+tStop && tRel<=3.*tAcceleration+tPlato+tStop)
+		x = -(tRel-2.*tAcceleration-tPlato-tStop) / tAcceleration;
+	if(tRel>3.*tAcceleration+tPlato+tStop && tRel<=3.*tAcceleration+2.*tPlato+tStop)
+		x = -1.;
+	if(tRel>3.*tAcceleration+2.*tPlato+tStop && tRel<=4.*tAcceleration+2.*tPlato+tStop)
+		x = -(4.*tAcceleration+2.*tPlato+tStop-tRel)/tAcceleration;
+	if(tRel>4.*tAcceleration+2.*tPlato+tStop)
+		x = 0;
+	return wMax*x;
+	
+
+//	flux = -9.32e-5*(1.170 - c); c_0=0.326 ceq=0.267
+}
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+
+
+int main()
+{
+	Param dx(.02);
+	Param dt(0.8e-2);
+	Param nu(1e-2);
+	Param difC(1e-2/300.);
+//	Param w(48.*3.14*2./60.);
+	// Angular velocity
+	Param w(6.*3.14*2./60.);
+	
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	Param difCNum(difC.v()*dt.v()/dx.v()/dx.v());
+
+	// Angular velocity in one iteration
+	Param wNum(w.v()*dt.v());
+
+	Param c0(0.326);
+	
+	AVec<int> size(asl::makeAVec(105.,105.,100.));
+
+	AVec<> gSize(dx.v()*AVec<>(size));
+
+	std::cout<<"Flow: Data initialization...";
+
+    auto templ(&asl::d3q19());	
+	asl::Block block(size,dx.v());
+
+	auto bathMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(bathMap, generateBath(block));
+	auto platformCrysMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(platformCrysMap, generatePlatform(block) | generateCrystal(block));
+	auto bathPlatformMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(bathPlatformMap, generateBath(block) | generatePlatform(block));
+	auto bathPlatformCrystalMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(bathPlatformCrystalMap, generateBath(block) | generatePlatform(block) | generateCrystal(block));
+	auto crystalMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(crystalMap, generateCrystal(block));
+
+	auto cField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(cField, c0.v());
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nuNum.v())),  
+	        			       templ));
+	// Set angular velocity in lbgk
+	lbgk->setOmega(acl::generateVEConstant(makeAVec(0.,0.,wNum.v())));
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+
+	auto nmDif(asl::generateFDAdvectionDiffusion(cField, 
+	                                             difCNum.v(), 
+	                                             lbgk->getVelocity(), 
+	                                             templ,
+	                                             true));
+
+	nmDif->init();
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+	std::vector<asl::SPNumMethod> bcDif;
+
+	// Position Function Angular Velocity Field
+	auto vfBath(asl::generatePFRotationField(makeAVec(0.,0., wNum.v()/dx.v()), .5*gSize));
+	// Boundary condition
+	bc.push_back(generateBCVelocity(lbgk, vfBath, bathMap));
+	// Boundary condition for visualization
+	bcV.push_back(generateBCVelocityVel(lbgk, vfBath, bathMap));
+	bc.push_back(generateBCNoSlip(lbgk,  platformCrysMap));
+	bcV.push_back(generateBCNoSlipVel(lbgk, platformCrysMap));
+	bcDif.push_back(generateBCConstantGradient(cField, 
+	                                        0., 
+	                                        bathPlatformMap, 
+	                                        bathPlatformCrystalMap, 
+	                                        templ));
+	bcDif.push_back(generateBCLinearGrowth2(cField, 1.17, 
+	                                        -9.32e-6/difC.v()*dx.v(), 
+	                                        crystalMap, 
+	                                        bathPlatformCrystalMap, 
+	                                        templ));
+//	bcDif.push_back(generateBCConstantGradient2(cField, .1, crystalMap, bathPlatformCrystalMap, templ));
+	initAll(bc);
+	initAll(bcV);
+	initAll(bcDif);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+	asl::Timer timerBC;
+
+	asl::WriterVTKXML writer("flowKDPGrowthRes");
+	writer.addScalars("mapBath", *bathMap);
+	writer.addScalars("mapPlatformCrys", *platformCrysMap);
+	writer.addScalars("mapBathPlatformCrystal", *bathPlatformCrystalMap);
+	writer.addScalars("mapCrys", *crystalMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addScalars("c", *cField);
+	writer.addVector("v", *lbgk->getVelocity());
+
+	executeAll(bcV);
+	executeAll(bc);
+	executeAll(bcDif);
+
+	writer.write();
+
+	timer.start();
+	timerBC.reset();
+	for(unsigned int i(0); i <= 8001  ; ++i)
+	{
+		lbgk->execute();
+		timerBC.resume();
+		executeAll(bcV);
+		executeAll(bc);
+		timerBC.stop();
+		nmDif->execute();
+		timerBC.resume();
+		executeAll(bcDif);
+		timerBC.stop();
+		
+		if(!(i%2000))
+		{
+			cout<< i <<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%; timeBC = " 
+		<< timerBC.getTime() << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/flowRotatingCylinders.cc b/test/testPhysics/flow/flowRotatingCylinders.cc
new file mode 100644
index 0000000..a0ad87a
--- /dev/null
+++ b/test/testPhysics/flow/flowRotatingCylinders.cc
@@ -0,0 +1,162 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example flowRotatingCylinders.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslPositionFunction.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param nu(.01);
+	Param w(2e-3);
+
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	AVec<int> size(asl::makeAVec(100,100,150));
+
+	AVec<> gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+
+	auto exCylMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(exCylMap, 
+	              asl::normalize(-generateDFCylinderInf(.48*gSize[0],
+	                                                 makeAVec(0.,0.,1.),
+	                                                 .5*gSize), 
+	                             dx.v()));
+	auto inCylMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(inCylMap, 
+	              asl::normalize(generateDFCylinderInf(.24*gSize[0],
+	                                                makeAVec(0.,0.,1.),
+	                                                .5*gSize),
+	                             dx.v()));
+
+	auto computationalDomainMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(computationalDomainMap, 
+	              asl::normalize(-generateDFCylinderInf(.48*gSize[0],
+	                                                 makeAVec(0.,0.,1.),
+	                                                 .5*gSize) | 
+	                             generateDFCylinderInf(.24*gSize[0],
+	                                                 makeAVec(0.,0.,1.),
+	                                                 .5*gSize) |
+	                             asl::generateDFInBlock(block, 0), 
+	                             dx.v()));
+
+		
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nuNum.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0,.0,.0));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+
+	auto vfEx(asl::generatePFRotationField(makeAVec(0.,0., w.v()), .5*gSize));
+	auto vfIn(asl::generatePFRotationField(makeAVec(0.,0.,-2.*w.v()), .5*gSize));	
+	
+	bc.push_back(generateBCVelocity(lbgk, vfEx, exCylMap,computationalDomainMap));
+	bcV.push_back(generateBCNoSlipVel(lbgk, exCylMap));
+	bc.push_back(generateBCVelocity(lbgk, vfIn, inCylMap,computationalDomainMap));
+	bcV.push_back(generateBCNoSlipVel(lbgk, inCylMap));
+	bc.push_back(generateBCNoSlip(lbgk,{asl::Z0, asl::ZE}));
+
+	initAll(bc);
+	initAll(bcV);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("flowRotCylRes");
+//	writer.addScalars("mapEx", *exCylMap);
+//	writer.addScalars("mapIn", *inCylMap);
+	writer.addScalars("map", *computationalDomainMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+
+	executeAll(bc);
+
+	executeAll(bcV);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(0); i < 10001  ; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%1000))
+		{
+			cout<< i <<endl;
+			executeAll(bcV);
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/locomotive_in_tunnel.cc b/test/testPhysics/flow/locomotive_in_tunnel.cc
new file mode 100644
index 0000000..9fe5c9c
--- /dev/null
+++ b/test/testPhysics/flow/locomotive_in_tunnel.cc
@@ -0,0 +1,173 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example locomotive_in_tunnel.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslPositionFunction.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <readers/aslVTKFormatReaders.h>
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateTunnel(asl::Block & bl)
+{
+
+	double l(bl.getBPosition()[0] - bl.position[0] + bl.dx);
+	double rTunnel((bl.getBPosition()[2] - bl.position[2]) / 2.1);
+
+	double dx(bl.dx);
+
+	asl::AVec<int> size(bl.getSize());
+
+	asl::AVec<> center(.5 * (bl.getBPosition() + bl.position)); 
+	center[1] = bl.position[1] + .25 * rTunnel;
+	asl::AVec<> centerG(center); 
+	centerG[1] = bl.position[1];
+
+	auto tunnel(-(generateDFCylinder(rTunnel, makeAVec(l, 0., 0.), center) &
+	             generateDFPlane(makeAVec(0., -1., 0.), centerG)));
+
+	return normalize(tunnel, dx);
+}
+
+
+int main()
+{
+	Param dx(0.08);
+	Param dt(1.);
+	Param nu(.001);
+
+	
+	AVec<int> size(makeAVec(40., 10., 15.)*(1./dx.v()));
+	asl::Block bl(size,dx.v(),makeAVec(-30., 8.58, 1.53));
+	
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	
+	std::cout<<"Flow: Data initialization...";
+
+
+	auto object(asl::readSurf("locomotive.stl", bl));
+	
+	asl::Block block(object->getInternalBlock());
+
+	auto tunnelMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(tunnelMap, generateTunnel(block));
+
+	auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(forceField, makeAVec(0.,0.,0.));
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGKTurbulence(block, 
+	                                         acl::generateVEConstant(FlT(nu.v())),  
+	                                         &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.1,.0,.0));
+
+	auto vfTunnel(asl::generatePFConstant(makeAVec(0.1,0.,0.)));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+
+	bc.push_back(generateBCVelocity(lbgk, vfTunnel, tunnelMap));
+	bcV.push_back(generateBCVelocityVel(lbgk, vfTunnel, tunnelMap));
+//	bcV.push_back(generateBCNoSlipRho(lbgk, tunnelMap));
+	bc.push_back(generateBCNoSlip(lbgk,  object));
+	bcV.push_back(generateBCNoSlipVel(lbgk, object));
+//	bcV.push_back(generateBCNoSlipRho(lbgk, object));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., makeAVec(0.1,0.,0.), {asl::X0, asl::XE}));
+
+	initAll(bc);
+	initAll(bcV);
+
+	auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+	computeForce->init();
+	
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("locomotive_in_tunnel");
+	writer.addScalars("map", *object);
+	writer.addScalars("tunnel", *tunnelMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+	writer.addVector("force", *forceField);
+
+	executeAll(bc);
+	executeAll(bcV);
+	computeForce->execute();
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 20001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%1000))
+		{
+			cout<<i<<endl;
+			executeAll(bcV);
+			computeForce->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/locomotive_stability.cc b/test/testPhysics/flow/locomotive_stability.cc
new file mode 100644
index 0000000..6e8e2e0
--- /dev/null
+++ b/test/testPhysics/flow/locomotive_stability.cc
@@ -0,0 +1,170 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example locomotive_in_tunnel.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <math/aslPositionFunction.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <readers/aslVTKFormatReaders.h>
+
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+asl::SPDistanceFunction generateNozzels(asl::Block & bl)
+{
+
+	double y(10.33);
+	double z(3.08);
+	double h(1.);
+	double rNozzel(.3);
+	double n(4.);
+	double x0(-20.);
+	double xE(-6.);	
+
+	double dx(bl.dx);
+
+	asl::SPDistanceFunction res(generateDFCylinder(rNozzel, 
+	                                               makeAVec(0., 0., h), 
+	                                               makeAVec(x0,y,z+h*.5)));
+	for(unsigned int i(1); i < n; ++i)
+		res = res | generateDFCylinder(rNozzel, 
+	                                   makeAVec(0., 0., h), 
+	                                   makeAVec(x0+i*(xE-x0)/n,y,z+h*.5)); 
+	return normalize(res, dx);
+}
+
+
+int main()
+{
+	Param dx(0.25);
+	Param dt(1.);
+	Param nu(.01);
+	
+	Param nuNum(nu.v()*dt.v()/dx.v()/dx.v());
+	
+	std::cout<<"Flow: Data initialization...";
+
+
+	auto object(asl::readSurf("locomotive.stl", dx.v(), .5,1.,0.,1.,2.,4.));
+	
+	asl::Block block(object->getInternalBlock());
+
+	auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	asl::initData(forceField, makeAVec(0.,0.,0.));
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	asl::SPLBGK lbgk(new asl::LBGK(block, 
+				               acl::generateVEConstant(FlT(nu.v())),  
+	        			       &asl::d3q15()));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.1,.0,.05));
+
+	auto vfTunnel(asl::generatePFConstant(makeAVec(0.1,0.,0.)));
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+
+	auto nozzelsMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(nozzelsMap, generateNozzels(block));
+
+	
+	bc.push_back(generateBCNoSlip(lbgk,  object));
+	bcV.push_back(generateBCNoSlipVel(lbgk, object));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(0.1,0.,0.05), 
+	                                                {asl::X0, asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., makeAVec(0.,0.,-0.1),  nozzelsMap));
+	initAll(bc);
+	initAll(bcV);
+
+	auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+	computeForce->init();
+	
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing...";
+
+	asl::WriterVTKXML writer("locomotive_stability");
+	writer.addScalars("train", *object);
+	writer.addScalars("nozzels", *nozzelsMap);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *lbgk->getVelocity());
+	writer.addVector("force", *forceField);
+
+	executeAll(bc);
+	executeAll(bcV);
+	computeForce->execute();
+
+	writer.write();
+
+	asl::Timer timer, timer1, timer2;
+	timer.start();
+	for(unsigned int i(1); i < 40001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bc);
+		if(!(i%1000))
+		{
+			cout<<i<<endl;
+			executeAll(bcV);
+			computeForce->execute();
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/multicomponent_flow.cc b/test/testPhysics/flow/multicomponent_flow.cc
new file mode 100644
index 0000000..3bc45be
--- /dev/null
+++ b/test/testPhysics/flow/multicomponent_flow.cc
@@ -0,0 +1,268 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example multicomponent_flow.cc 	 
+ */
+
+#include <utilities/aslParametersManager.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <num/aslFDAdvectionDiffusion.h>
+#include <num/aslBasicBC.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+class Parameters
+{
+  private:
+		void init();
+
+  public:
+		asl::ParametersManager parametersManager;
+		string folder;
+
+		asl::Block::DV size;
+
+		asl::Parameter<double> dx;
+		asl::Parameter<double> dt;
+
+		asl::Parameter<double> tSimulation;
+		asl::Parameter<double> tOutput;
+
+		asl::Parameter<double> nu;
+		asl::UValue<double> nuNum;
+		
+		asl::Parameter<double> tubeL;
+		asl::Parameter<double> tubeD;
+		asl::Parameter<double> pumpL;
+		asl::Parameter<double> pumpD;
+
+		asl::Parameter<double> oilInVel;
+		asl::Parameter<double> waterInVel;
+		asl::Parameter<double> gasInVel;
+		
+		
+		void load(int argc, char * argv[],
+		          string programName,
+		          string programVersion);
+		Parameters();
+		void updateNumValues();
+};
+
+
+Parameters::Parameters():
+	size(3),
+	dx(0.0005, "dx", "space step"),
+	dt(1., "dt", "time step"),
+	tSimulation(2e-3, "simulation_time", "simulation time"),
+	tOutput(1e-4, "output_interval", "output interval"),
+	nu(4e-8/1.6, "nu", "viscosity"),
+	tubeL(0.25, "tubeL", "tube's length"),
+	tubeD(0.05, "tubeD", "tube's diameter"),
+	pumpL(0.025, "pumpL", "pump's length"),
+	pumpD(0.03, "pumpD", "pump's diameter"),
+	oilInVel(0.08, "oil_in_velocity", "flow velocity in the oil input"),
+	waterInVel(0.16, "water_in_velocity", "flow velocity in the water input"),
+	gasInVel(0.1, "gas_in_velocity", "flow velocity in the gas input")
+{
+}
+
+
+void Parameters::load(int argc, char * argv[],
+                      string programName,
+                      string programVersion)
+{
+	parametersManager.load(argc, argv, programName, programVersion);
+	folder = parametersManager.getFolderWithSlash();
+
+	init();
+}
+
+
+void Parameters::updateNumValues()
+{
+	nuNum = nu.v() * dt.v() / dx.v() / dx.v();
+	size[0] = tubeD.v() / dx.v() + 1;
+	size[1] = (tubeD.v() + 2 * pumpL.v()) / dx.v() + 1;
+	size[2] = tubeL.v() / dx.v() + 1;
+}
+
+
+void Parameters::init()
+{
+	if (tubeD.v() < pumpD.v())
+		asl::errorMessage("Tube's diameter is smaller than pump's diameter");
+
+	updateNumValues();
+}
+
+// generate geometry of the mixer
+asl::SPDistanceFunction generateMixer(asl::Block & block, Parameters &params)
+{
+	asl::SPDistanceFunction mixerGeometry;
+	asl::AVec<double> orientation(asl::makeAVec(0., 0., 1.));
+	asl::AVec<double> center(asl::AVec<double>(params.size)*.5*params.dx.v());
+
+	mixerGeometry = generateDFCylinderInf(params.tubeD.v() / 2., orientation, center);
+
+	orientation[1] = 1.0;
+	orientation[2] = 0.0;
+	center[2]=params.pumpD.v() * 1.5;
+	mixerGeometry = mixerGeometry | generateDFCylinderInf(params.pumpD.v() / 2., orientation, center);
+
+	return asl::normalize(-(mixerGeometry) | asl::generateDFInBlock(block, 0), params.dx.v());
+}
+
+int main(int argc, char *argv[])
+{
+	Parameters params;
+	params.load(argc, argv, "multicomponent_flow", "0.1");
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(params.size, params.dx.v());
+
+	auto mcfMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(mcfMapMem, generateMixer(block, params));
+
+	auto waterFrac(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(waterFrac, 0);
+	auto gasFrac(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(gasFrac, 0);
+	
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q15());	
+	
+	asl::SPLBGK lbgk(new asl::LBGK(block,
+	                               acl::generateVEConstant(FlT(params.nuNum.v())),
+	                               templ));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0, .0, .0));
+
+	auto flowVel(lbgk->getVelocity());
+	auto nmWater(asl::generateFDAdvectionDiffusion(waterFrac, 0.01, flowVel, templ, true));
+	nmWater->init();
+	auto nmGas(asl::generateFDAdvectionDiffusion(gasFrac, 0.01, flowVel, templ));
+	nmGas->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+	std::vector<asl::SPNumMethod> bcDif;
+	
+	bc.push_back(generateBCNoSlip(lbgk, mcfMapMem));
+	bc.push_back(generateBCConstantPressure(lbgk,1.,{asl::ZE}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(0.,0.,params.oilInVel.v()),
+	                                                {asl::Z0}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(0.,-params.waterInVel.v(),0.),
+	                                                {asl::YE}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk,1., 
+	                                                makeAVec(0.,params.gasInVel.v(),0.),
+	                                                {asl::Y0}));
+	
+	bcDif.push_back(generateBCNoSlipVel(lbgk, mcfMapMem));
+	bc.push_back(generateBCConstantGradient(waterFrac, 0., mcfMapMem, templ));
+	bc.push_back(generateBCConstantGradient(gasFrac, 0., mcfMapMem, templ));
+	bc.push_back(generateBCConstantValue(waterFrac, 1., {asl::YE}));
+	bc.push_back(generateBCConstantValue(gasFrac, 0., {asl::YE, asl::Z0, asl::ZE}));
+	bc.push_back(generateBCConstantValue(waterFrac, 0., {asl::Y0, asl::Z0, asl::ZE}));
+	bc.push_back(generateBCConstantValue(gasFrac, 1., {asl::Y0}));
+//	bc.push_back(generateBCConstantGradient(waterFrac, 0.,templ, {asl::ZE}));
+//	bc.push_back(generateBCConstantGradient(gasFrac, 0.,templ, {asl::ZE}));
+	
+	initAll(bc);
+	initAll(bcDif);
+	initAll(bcV);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<endl;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("multicomponent_flow");
+	writer.addScalars("map", *mcfMapMem);
+	writer.addScalars("water", *waterFrac);
+	writer.addScalars("gas", *gasFrac);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *flowVel);
+
+	executeAll(bc);
+	executeAll(bcDif);
+	executeAll(bcV);
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 10001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bcDif);
+		nmWater->execute();
+		nmGas->execute();
+		executeAll(bc);
+		
+		if(!(i%100))
+		{
+			timer.stop();
+			cout<<i<<"/10000; expected left time: "<< timer.getLeftTime(double(i)/10000.) <<endl;
+			executeAll(bcV);
+			writer.write();
+			timer.resume();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/multiphase_flow.cc b/test/testPhysics/flow/multiphase_flow.cc
new file mode 100644
index 0000000..5f041d2
--- /dev/null
+++ b/test/testPhysics/flow/multiphase_flow.cc
@@ -0,0 +1,254 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example multiphase_flow.cc
+	not finished yet!!!!!
+ */
+
+#include <utilities/aslParametersManager.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+#include <num/aslFDMultiPhase.h>
+#include <num/aslBasicBC.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+class Parameters
+{
+  private:
+		void init();
+
+  public:
+		asl::ParametersManager parametersManager;
+		string folder;
+
+		asl::Block::DV size;
+
+		asl::Parameter<double> dx;
+		asl::Parameter<double> dt;
+
+		asl::Parameter<double> tSimulation;
+		asl::Parameter<double> tOutput;
+
+		asl::Parameter<double> nu;
+		asl::UValue<double> nuNum;
+		
+		asl::Parameter<double> tubeL;
+		asl::Parameter<double> tubeD;
+		asl::Parameter<double> pumpL;
+		asl::Parameter<double> pumpD;
+
+		asl::Parameter<double> oilInVel;
+		asl::Parameter<double> waterInVel;
+		asl::Parameter<double> gasInVel;
+		
+		
+		void load(int argc, char * argv[],
+		          string programName,
+		          string programVersion);
+		Parameters();
+		void updateNumValues();
+};
+
+
+Parameters::Parameters():
+	size(3),
+	dx(0.002, "dx", "space step"),
+	dt(1., "dt", "time step"),
+	tSimulation(2e-3, "simulation_time", "simulation time"),
+	tOutput(1e-4, "output_interval", "output interval"),
+	nu(4e-8, "nu", "viscosity"),
+	tubeL(0.5, "tubeL", "tube's length"),
+	tubeD(0.05, "tubeD", "tube's diameter"),
+	pumpL(0.025, "pumpL", "pump's length"),
+	pumpD(0.03, "pumpD", "pump's diameter"),
+	oilInVel(0.02, "oil_in_velocity", "flow velocity in the oil input"),
+	waterInVel(0.04, "water_in_velocity", "flow velocity in the water input"),
+	gasInVel(0.03, "gas_in_velocity", "flow velocity in the gas input")
+{
+}
+
+
+void Parameters::load(int argc, char * argv[],
+                      string programName,
+                      string programVersion)
+{
+	parametersManager.load(argc, argv, programName, programVersion);
+	folder = parametersManager.getFolderWithSlash();
+
+	init();
+}
+
+
+void Parameters::updateNumValues()
+{
+	nuNum = nu.v() * dt.v() / dx.v() / dx.v();
+	size[0] = tubeD.v() / dx.v() + 1;
+	size[1] = (tubeD.v() + 2 * pumpL.v()) / dx.v() + 1;
+	size[2] = tubeL.v() / dx.v() + 1;
+}
+
+
+void Parameters::init()
+{
+	if (tubeD.v() < pumpD.v())
+		asl::errorMessage("Tube's diameter is smaller than pump's diameter");
+
+	updateNumValues();
+}
+
+// generate geometry of the mixer
+asl::SPDistanceFunction generateMixer(asl::Block & block, Parameters &params)
+{
+	asl::SPDistanceFunction mixerGeometry;
+	asl::AVec<double> orientation(asl::makeAVec(0., 0., 1.));
+	asl::AVec<double> center(asl::AVec<double>(params.size)*.5*params.dx.v());
+
+	mixerGeometry = generateDFCylinderInf(params.tubeD.v() / 2., orientation, center);
+
+	orientation[1] = 1.0;
+	orientation[2] = 0.0;
+	center[2]=params.pumpD.v() * 1.5;
+	mixerGeometry = mixerGeometry | generateDFCylinderInf(params.pumpD.v() / 2., orientation, center);
+
+	return asl::normalize(-(mixerGeometry) | asl::generateDFInBlock(block, 0), params.dx.v());
+}
+
+int main(int argc, char *argv[])
+{
+	Parameters params;
+	params.load(argc, argv, "multiphase_flow", "0.1");
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(params.size, params.dx.v());
+
+	auto mpfMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(mpfMapMem, generateMixer(block, params));
+
+	auto waterFrac(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(waterFrac, 0);
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q15());	
+	
+	asl::SPLBGK lbgk(new asl::LBGK(block,
+	                               acl::generateVEConstant(FlT(params.nuNum.v())),
+	                               templ));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(.0, .0, .0));
+
+	auto flowVel(lbgk->getVelocity());
+	auto nmWater(asl::generateFDMultiPhase(waterFrac, flowVel, templ, true));
+	nmWater->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+	std::vector<asl::SPNumMethod> bcDif;
+	
+	bc.push_back(generateBCNoSlip(lbgk, mpfMapMem));
+	bc.push_back(generateBCConstantPressure(lbgk,1.,{asl::ZE}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(0.,0.,params.oilInVel.v()),
+	                                                {asl::Z0}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(0.,-params.waterInVel.v(),0.),
+	                                                {asl::YE}));
+	
+	bcDif.push_back(generateBCNoSlipVel(lbgk, mpfMapMem));
+	bc.push_back(generateBCConstantGradient(waterFrac, 0., mpfMapMem, templ));
+	bc.push_back(generateBCConstantValue(waterFrac, 1., {asl::Y0, asl::YE}));
+	bc.push_back(generateBCConstantValue(waterFrac, 0., {asl::Z0, asl::ZE}));
+
+	initAll(bc);
+	initAll(bcDif);
+	initAll(bcV);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<endl;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("multiphase_flow");
+	writer.addScalars("map", *mpfMapMem);
+	writer.addScalars("water", *waterFrac);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *flowVel);
+
+	executeAll(bc);
+	executeAll(bcDif);
+	executeAll(bcV);
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 2001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bcDif);
+		nmWater->execute();
+		executeAll(bc);
+		
+		if(!(i%200))
+		{
+			timer.stop();
+			cout<<i<<"/2000; expected left time: "<< timer.getLeftTime(double(i)/2000.) <<endl;
+			executeAll(bcV);
+			writer.write();
+			timer.resume();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/flow/pitot_tube_ice.cc b/test/testPhysics/flow/pitot_tube_ice.cc
new file mode 100644
index 0000000..37f035e
--- /dev/null
+++ b/test/testPhysics/flow/pitot_tube_ice.cc
@@ -0,0 +1,254 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example pitot_tube_ice.cc
+    Icing process in the Pitot tube
+ */
+
+#include <utilities/aslParametersManager.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLBGK.h>
+#include <num/aslLBGKBC.h>
+#include "utilities/aslTimer.h"
+#include <num/aslFDAdvectionDiffusion.h>
+#include <num/aslBasicBC.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+class Parameters
+{
+  private:
+		void init();
+
+  public:
+		asl::ParametersManager parametersManager;
+		string folder;
+
+		asl::Block::DV size;
+
+		asl::Parameter<double> dx;
+		asl::Parameter<double> dt;
+
+		asl::Parameter<double> tSimulation;
+		asl::Parameter<double> tOutput;
+
+		asl::Parameter<double> nu;
+		asl::UValue<double> nuNum;
+		
+		asl::Parameter<double> rIn;
+		asl::Parameter<double> rEx;
+		asl::Parameter<double> lCyl;
+		asl::Parameter<double> lCone;
+
+		asl::Parameter<double> temperature;
+		asl::Parameter<double> humidity;
+		asl::Parameter<double> flowVel;
+		
+		void load(int argc, char * argv[],
+		          string programName,
+		          string programVersion);
+		Parameters();
+		void updateNumValues();
+};
+
+
+Parameters::Parameters():
+	size(3),
+	dx(0.000125, "dx", "space step"),
+	dt(1., "dt", "time step"),
+	tSimulation(2e-3, "simulation_time", "simulation time"),
+	tOutput(1e-4, "output_interval", "output interval"),
+	nu(6.25e-10/4., "nu", "viscosity"),
+	rIn(0.0015, "r_in", "Internal radius, m"),
+	rEx(0.005, "r_ex", "External radius, m"),
+	lCyl(0.002, "l_cyl", "Length of cylindric part, m"),
+	lCone(0.02, "l_cone", "Length of conic part, m"),
+	temperature(253, "temperature", "temperature, K"),
+	humidity(.5, "humidity", "relative humidity, K"),
+	flowVel(0.08, "flow_vel", "flow velocity")
+{
+}
+
+
+void Parameters::load(int argc, char * argv[],
+                      string programName,
+                      string programVersion)
+{
+	parametersManager.load(argc, argv, programName, programVersion);
+	folder = parametersManager.getFolderWithSlash();
+
+	init();
+}
+
+
+void Parameters::updateNumValues()
+{
+	nuNum = nu.v() * dt.v() / dx.v() / dx.v();
+	size[0] = 1.0*(lCyl.v() + lCone.v()) / dx.v() + 1;
+	size[1] = rEx.v() * 2.5 / dx.v() + 1;
+	size[2] = rEx.v() * 2.5 / dx.v() + 1;
+}
+
+
+void Parameters::init()
+{
+	if (rEx.v() < rIn.v())
+		asl::errorMessage("External tube's diameter is smaller than internal one");
+
+	updateNumValues();
+}
+
+// generate geometry
+asl::SPDistanceFunction generateGeometry(asl::Block & block, Parameters &params)
+{
+	asl::SPDistanceFunction tubeGeometry;
+	asl::AVec<double> orientation(asl::makeAVec(1., 0., 0.));
+	asl::AVec<double> center(asl::AVec<double>(params.size)*.5*params.dx.v());
+	auto centerCyl(center);
+	centerCyl[0] = params.lCyl.v()*.45;
+	auto centerHole(centerCyl+(params.lCone.v()*.6)*orientation);
+	auto lHole(params.lCyl.v()+params.lCone.v());
+		
+	auto apexCone(centerCyl+orientation*(params.lCyl.v()*.49+params.lCone.v()));
+
+	tubeGeometry = ((generateDFCylinder(params.rEx.v(), orientation*params.lCyl.v(), centerCyl) |
+	                generateDFCone(params.rEx.v()*.98, -orientation*params.lCone.v(), apexCone)) &
+		           -generateDFCylinder(params.rIn.v(), orientation*lHole, centerHole)) &
+					generateDFPlane(orientation, apexCone-orientation*params.lCone.v()*.5);
+
+	return asl::normalize(tubeGeometry, params.dx.v());
+}
+
+int main(int argc, char *argv[])
+{
+	Parameters params;
+	params.load(argc, argv, "pitot_tube_ice", "0.1");
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(params.size, params.dx.v());
+
+	auto mcfMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(mcfMapMem, generateGeometry(block, params));
+
+//	auto waterFrac(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+//	asl::initData(waterFrac, 0);
+	
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q15());	
+	
+	asl::SPLBGK lbgk(new asl::LBGK(block,
+	                               acl::generateVEConstant(FlT(params.nuNum.v())),
+	                               templ));
+	
+	lbgk->init();
+	asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
+	lbgkUtil->initF(acl::generateVEConstant(-0.9*params.flowVel.v(), params.flowVel.v()*.4, .0));
+
+	auto flowVel(lbgk->getVelocity());
+//	auto nmWater(asl::generateFDAdvectionDiffusion(waterFrac, 0.01, flowVel, templ, false));
+//	nmWater->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcV;
+	std::vector<asl::SPNumMethod> bcDif;
+	
+	bc.push_back(generateBCNoSlip(lbgk, mcfMapMem));
+	bc.push_back(generateBCConstantPressure(lbgk,1.,{asl::ZE}));
+	bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., 
+	                                                makeAVec(-params.flowVel.v()*.9,params.flowVel.v()*.3,0.),
+	                                                {asl::X0,asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	
+	bcDif.push_back(generateBCNoSlipVel(lbgk, mcfMapMem));
+	bcV.push_back(generateBCNoSlipRho(lbgk, mcfMapMem));
+//	bc.push_back(generateBCConstantGradient(waterFrac, 0., mcfMapMem, templ));
+//	bc.push_back(generateBCConstantValue(waterFrac, 1., {asl::YE}));
+//	bc.push_back(generateBCConstantValue(waterFrac, 0., {asl::Y0, asl::Z0, asl::ZE}));
+	
+	initAll(bc);
+	initAll(bcDif);
+	initAll(bcV);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<endl;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("pitot_tube");
+	writer.addScalars("map", *mcfMapMem);
+//	writer.addScalars("water", *waterFrac);
+	writer.addScalars("rho", *lbgk->getRho());
+	writer.addVector("v", *flowVel);
+
+	executeAll(bc);
+	executeAll(bcDif);
+	executeAll(bcV);
+
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 8001; ++i)
+	{
+		lbgk->execute();
+		executeAll(bcDif);
+//		nmWater->execute();
+		executeAll(bc);
+		
+		if(!(i%800))
+		{
+			timer.stop();
+			cout<<i<<"/8000; expected left time: "<< timer.getLeftTime(double(i)/8000.) <<endl;
+			executeAll(bcV);
+			writer.write();
+			timer.resume();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/heatTransfer/CMakeLists.txt b/test/testPhysics/heatTransfer/CMakeLists.txt
new file mode 100644
index 0000000..6f0e878
--- /dev/null
+++ b/test/testPhysics/heatTransfer/CMakeLists.txt
@@ -0,0 +1,7 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(surfaceFlux surfaceFlux.cc)
+target_link_libraries(surfaceFlux asl aslnum aslvtk)
+set_property(TARGET surfaceFlux PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/surfaceFlux)
+
diff --git a/test/testPhysics/heatTransfer/surfaceFlux.cc b/test/testPhysics/heatTransfer/surfaceFlux.cc
new file mode 100644
index 0000000..5eca620
--- /dev/null
+++ b/test/testPhysics/heatTransfer/surfaceFlux.cc
@@ -0,0 +1,132 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example surfaceFlux.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+//#include <data/aslDataWithGhostNodes.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDAdvectionDiffusion.h>
+#include <num/aslBasicBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclUtilities.h"
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param diffCoef(.15);
+	
+	Param diffCoefNum(diffCoef.v()*dt.v()/dx.v()/dx.v());
+	AVec<int> size(asl::makeAVec(50,50,50));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+
+	auto ball(normalize(//generateDFPlane(makeAVec(1.,3.,1.),.5*gSize+makeAVec(.2,.0,.6)) & 
+	                    generateDFSphere(10, .5*gSize+makeAVec(.2,.1,.3)),
+	                    dx.v()));
+	// Formula
+//	auto ballMap(asl::generateDataContainer_SP(block, ball, 1u, acl::typeToTypeID<FlT>()));
+	// Data
+	auto ballMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(ballMapMem, ball);
+
+	auto ballB(normalize(-generateDFSphere(24, .5*gSize),dx.v() ));
+	auto ballBMapMem(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(ballBMapMem, ballB);
+	
+	auto cField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(cField, 0.);
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q15());
+	auto nm(generateFDAdvectionDiffusion(cField,  diffCoefNum.v(), templ));
+	nm->init();
+
+	std::vector<asl::SPNumMethod> bc;
+	
+//	bc.push_back(generateBCConstantGradient(cField, 0.1, ballMapMem, templ));
+	bc.push_back(generateBCConstantGradient2(cField, 0.1, ballMapMem, templ));
+	bc.push_back(asl::generateBCConstantValue(cField, 0, ballBMapMem));
+	initAll(bc);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<flush;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("surfaceFlux");
+	writer.addScalars("map", *ballMapMem);
+	writer.addScalars("mapE", *ballBMapMem);
+	writer.addScalars("c", *cField);
+
+	executeAll(bc);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 201; ++i)
+	{
+		nm->execute();
+		executeAll(bc);
+		if(!(i%40))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/jumpingObjects/CMakeLists.txt b/test/testPhysics/jumpingObjects/CMakeLists.txt
new file mode 100644
index 0000000..cc8bd89
--- /dev/null
+++ b/test/testPhysics/jumpingObjects/CMakeLists.txt
@@ -0,0 +1,7 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(jumpingBox jumpingBox.cc)
+target_link_libraries(jumpingBox asl aslnum aslvtk)
+set_property(TARGET jumpingBox PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/jumpingBox)
+
diff --git a/test/testPhysics/jumpingObjects/jumpingBox.cc b/test/testPhysics/jumpingObjects/jumpingBox.cc
new file mode 100644
index 0000000..19b799a
--- /dev/null
+++ b/test/testPhysics/jumpingObjects/jumpingBox.cc
@@ -0,0 +1,133 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example jumpingBox.cc
+ */
+
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDElasticity.h>
+#include <num/aslFDElasticityBC.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+	asl::Parameter<asl::AVec<int> > size("size", "size 3D");
+	asl::Parameter<cl_float> dx("dx", "dx");
+	asl::Parameter<cl_float> dt("dt", "dt");
+	asl::Parameter<cl_float> bulkModulus("bulk_modulus", "bulk modulus");
+	asl::Parameter<cl_float> shearModulus("shear_modulus", "shear modulus");
+	asl::Parameter<cl_float> rho("rho", "density");
+	asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
+
+	asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
+	asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
+	
+	parametersManager.load(argc, argv, "jumpingBox");
+
+	Param bulkModulusNum(bulkModulus.v()/rho.v()/dx.v()/dx.v());
+	Param shearModulusNum(shearModulus.v()/rho.v()/dx.v()/dx.v());
+
+	asl::AVec<FlT> gNum(g.v()/dx.v());
+		
+	std::cout<<"Jumping Box: Data initialization...";
+
+	asl::Block block(size.v(), dx.v());
+	auto displacement(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+	acl::initData(displacement->getEContainer(), acl::generateVEConstantN(3,0));
+
+	asl::WriterVTKXML writer(parametersManager.getFolderWithSlash() + "displacement");
+	writer.addScalars("displacement", *displacement);
+	writer.addVector("displacement", *displacement);
+	writer.write();
+
+	std::cout << "Finished" << endl;
+	
+	std::cout << "Jumping Box: Numerics initialization...";
+
+	asl::SPFDElasticity2 elasticity(new asl::FDElasticity2(displacement,
+	                                                       acl::generateVEConstant(bulkModulusNum.v()),
+	                                                       acl::generateVEConstant(shearModulusNum.v()), 
+	                                                       acl::generateVEConstant(dt.v()),
+	                                                       &asl::d3q15()));
+	elasticity->setForce(acl::generateVEConstant(gNum));
+	elasticity->setDumpingFactor(acl::generateVEConstant(.90));
+	elasticity->init();
+
+	asl::BCFreeSurface2 bcFreeSurface(elasticity);
+	auto bcRigidWall(generateBCRigidWall(elasticity, {asl::X0}));
+
+	addSliceXE(bcFreeSurface);
+	addSliceY0(bcFreeSurface);
+	addSliceYE(bcFreeSurface);
+	addSliceZ0(bcFreeSurface);
+	addSliceZE(bcFreeSurface);
+
+	bcFreeSurface.init();
+	bcRigidWall->init();
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing...";
+	asl::Timer timer;
+
+	bcFreeSurface.execute();
+	bcRigidWall->execute();
+
+
+	timer.start();
+	for (unsigned int i(0); i < tsim.v(); ++i)
+	{
+		elasticity->execute();
+		bcFreeSurface.execute();
+		bcRigidWall->execute();
+		if(!(i % tout.v()))
+			writer.write();
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/levelSet/CMakeLists.txt b/test/testPhysics/levelSet/CMakeLists.txt
new file mode 100644
index 0000000..2b7a209
--- /dev/null
+++ b/test/testPhysics/levelSet/CMakeLists.txt
@@ -0,0 +1,15 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(levelSetBasic levelSetBasic.cc)
+target_link_libraries(levelSetBasic asl aslnum aslvtk)
+set_property(TARGET levelSetBasic PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/levelSetBasic)
+
+add_executable(levelSetNormalGrowth levelSetNormalGrowth.cc)
+target_link_libraries(levelSetNormalGrowth asl aslnum aslvtk)
+set_property(TARGET levelSetNormalGrowth PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/levelSetNormalGrowth)
+
+add_executable(levelSetFacetedGrowth levelSetFacetedGrowth.cc)
+target_link_libraries(levelSetFacetedGrowth asl aslnum aslvtk)
+set_property(TARGET levelSetFacetedGrowth PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/levelSetFacetedGrowth)
+
diff --git a/test/testPhysics/levelSet/levelSetBasic.cc b/test/testPhysics/levelSet/levelSetBasic.cc
new file mode 100644
index 0000000..b13ecda
--- /dev/null
+++ b/test/testPhysics/levelSet/levelSetBasic.cc
@@ -0,0 +1,112 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example levelSetBasic.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslInterfaceTrackingAlg1.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/aclUtilities.h>
+
+#include <aslGeomInc.h>
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+acl::TypeID type(acl::typeToTypeID<FlT>()); 
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+
+	asl::Parameter<asl::AVec<int>> size("size", "size");
+	asl::Parameter<FlT> dx("dx", "dx");
+	asl::Parameter<FlT> dt("dt", "dt");
+	asl::Parameter<asl::AVec<FlT>> v("v", "v");
+	asl::Parameter<FlT> radius("radius", "initial radius");
+	
+
+	asl::Parameter<cl_uint> nIterations("nIterations", "Number of iterations");
+	asl::Parameter<cl_uint> nItOut("nItOut", "Number of iterations for output");
+
+	parametersManager.load(argc, argv, "levelSetBasic");
+	
+	std::cout<<"Jumping Box: Data initialization...";
+
+	asl::Block block(size.v(), dx.v());
+	auto levelSet(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	auto sphere(generateDFSphere(radius.v(), asl::AVec<>(asl::AVec<FlT>(size.v())*FlT(.5))));
+	asl::initData(levelSet, -normalize(sphere,dx.v()));
+	
+	auto velocity(asl::generateDataContainerConst_SP(block, v.v(), 1u));
+
+	
+	asl::WriterVTKXML writer(parametersManager.getFolder()+"/"+"levelSet");
+	writer.addScalars("levelSet", *levelSet);
+	
+	std::cout << "Finished" << endl;
+	
+	std::cout << "LevelSetBasic: Numerics initialization..." << flush;
+
+	auto lsNum(std::make_shared<asl::InterfaceTrackingAlg1>(levelSet,velocity));
+	
+	lsNum->init();
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing...";
+	asl::Timer timer;
+
+	writer.write();
+	
+	timer.start();
+	for (unsigned int i(0); i < nIterations.v(); ++i)
+	{
+		lsNum->execute();
+		if(!(i % nItOut.v()))
+			writer.write();		
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/levelSet/levelSetFacetedGrowth.cc b/test/testPhysics/levelSet/levelSetFacetedGrowth.cc
new file mode 100644
index 0000000..7ab3f20
--- /dev/null
+++ b/test/testPhysics/levelSet/levelSetFacetedGrowth.cc
@@ -0,0 +1,124 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example levelSetFacetedGrowth.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLSFacetedGrowth.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/aclUtilities.h>
+
+#include <aslGeomInc.h>
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+acl::TypeID type(acl::typeToTypeID<FlT>()); 
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+
+	asl::Parameter<asl::AVec<int>> size("size", "size");
+	asl::Parameter<FlT> dx("dx", "dx");
+	asl::Parameter<FlT> dt("dt", "dt");
+	asl::Parameter<FlT> superS("superS", "super satuation");
+	asl::Parameter<FlT> radius("radius", "initial radius");
+	asl::Parameter<FlT> betaSt("beta_step", "Kinetic coefficient for step");
+	asl::Parameter<FlT> betaDisl("beta_dislocation", "Kinetic coefficient for dislocation");
+	asl::Parameter<FlT> betaRough("beta_rough", "Kinetic coefficient for rough region");
+
+	asl::Parameter<map<string, asl::AVec<FlT>>> cr_directions_p("cr_direction_*",
+	                                                            "crystallographic directions");
+	
+	asl::Parameter<cl_uint> nIterations("nIterations", "Number of iterations");
+	asl::Parameter<cl_uint> nItOut("nItOut", "Number of iterations for output");
+
+	parametersManager.load(argc, argv, "levelSetFacetedGrowth");
+
+	std::cout<<"LevelSet: Data initialization...";
+
+	asl::Block block(size.v(), dx.v());
+	auto levelSet(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	asl::AVec<> center(asl::AVec<FlT>(size.v())*FlT(.5));
+		
+	auto sphere1(generateDFSphere(radius.v(), center*.8));
+	auto sphere2(generateDFSphere(radius.v(), center*1.2));
+	asl::initData(levelSet, normalize(sphere1 | sphere2, dx.v()));
+	
+	auto superSaturation(asl::generateDataContainerConst_SP(block, superS.v(), 1u));
+
+	
+	asl::WriterVTKXML writer(parametersManager.getFolder()+"/"+"levelSetFG");
+	writer.addScalars("levelSet", *levelSet);
+	
+	std::cout << "Finished" << endl;
+	
+	std::cout << "LevelSetBasic: Numerics initialization..." << flush;
+
+	auto lsNum(std::make_shared<asl::LSFacetedGrowth>(levelSet, superSaturation));
+
+	lsNum->crystallography.betaRough = betaRough.v();
+	for (auto it(cr_directions_p.v().begin()); it != cr_directions_p.v().end(); ++it)
+		lsNum->crystallography.addFacet(asl::AVec<double>(it->second), betaSt.v(), betaDisl.v());
+	
+	lsNum->init();
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing...";
+	asl::Timer timer;
+
+	writer.write();
+	
+	timer.start();
+	for (unsigned int i(0); i < nIterations.v(); ++i)
+	{
+		lsNum->execute();
+		if(!(i % nItOut.v()))
+			writer.write();		
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/levelSet/levelSetNormalGrowth.cc b/test/testPhysics/levelSet/levelSetNormalGrowth.cc
new file mode 100644
index 0000000..e6e48a8
--- /dev/null
+++ b/test/testPhysics/levelSet/levelSetNormalGrowth.cc
@@ -0,0 +1,117 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example levelSetNormalGrowth.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <data/aslDataWithGhostNodes.h>
+#include <aslGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslLSNormalGrowth.h>
+#include <utilities/aslTimer.h>
+#include <utilities/aslParametersManager.h>
+#include <math/aslTemplates.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+#include <acl/aclUtilities.h>
+
+#include <aslGeomInc.h>
+//#include <math/aslIndex2Position.h>
+
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<FlT> Param;
+acl::TypeID type(acl::typeToTypeID<FlT>()); 
+
+
+int main(int argc, char* argv[])
+{
+	asl::ParametersManager parametersManager;
+
+	asl::Parameter<asl::AVec<int>> size("size", "size");
+	asl::Parameter<FlT> dx("dx", "dx");
+	asl::Parameter<FlT> dt("dt", "dt");
+	asl::Parameter<FlT> superS("superS", "super satuation");
+	asl::Parameter<FlT> radius("radius", "initial radius");
+	
+
+	asl::Parameter<cl_uint> nIterations("nIterations", "Number of iterations");
+	asl::Parameter<cl_uint> nItOut("nItOut", "Number of iterations for output");
+
+	parametersManager.load(argc, argv, "levelSetNormalGrowth");
+	
+	std::cout<<"LevelSet: Data initialization...";
+
+	asl::Block block(size.v(), dx.v());
+	auto levelSet(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+
+	asl::AVec<> center(asl::AVec<FlT>(size.v())*FlT(.5));
+		
+	auto sphere1(generateDFSphere(radius.v(), center*.8));
+	auto sphere2(generateDFSphere(radius.v(), center*1.2));
+	asl::initData(levelSet, normalize(sphere1 | sphere2, dx.v()));
+	
+	auto superSaturation(asl::generateDataContainerConst_SP(block, superS.v(), 1u));
+
+	
+	asl::WriterVTKXML writer(parametersManager.getFolder()+"/"+"levelSetNG");
+	writer.addScalars("levelSet", *levelSet);
+	
+	std::cout << "Finished" << endl;
+	
+	std::cout << "LevelSetBasic: Numerics initialization..." << flush;
+
+	auto lsNum(std::make_shared<asl::LSNormalGrowth>(levelSet, superSaturation));
+	
+	lsNum->init();
+
+	std::cout << "Finished" << endl;
+	std::cout << "Computing...";
+	asl::Timer timer;
+
+	writer.write();
+	
+	timer.start();
+	for (unsigned int i(0); i < nIterations.v(); ++i)
+	{
+		lsNum->execute();
+		if(!(i % nItOut.v()))
+			writer.write();		
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout << "Output...";
+	std::cout << "Finished" << endl;	
+	std::cout << "Ok" << endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/massTransferSM/CMakeLists.txt b/test/testPhysics/massTransferSM/CMakeLists.txt
new file mode 100644
index 0000000..a8b0955
--- /dev/null
+++ b/test/testPhysics/massTransferSM/CMakeLists.txt
@@ -0,0 +1,19 @@
+include_directories(${CMAKE_SOURCE_DIR}/src)
+
+
+add_executable(testSMDiff testSMDiff.cc)
+target_link_libraries(testSMDiff asl aslnum aslvtk)
+set_property(TARGET testSMDiff PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testSMDiff)
+
+add_executable(testSMDiff3C testSMDiff3C.cc)
+target_link_libraries(testSMDiff3C asl aslnum aslvtk)
+set_property(TARGET testSMDiff3C PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testSMDiff3C)
+
+add_executable(testSMPhi testSMPhi.cc)
+target_link_libraries(testSMPhi asl aslnum aslvtk)
+set_property(TARGET testSMPhi PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testSMPhi)
+
+add_executable(testSMPhiBV testSMPhiBV.cc)
+target_link_libraries(testSMPhiBV asl aslnum aslvtk)
+set_property(TARGET testSMPhiBV PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testSMPhiBV)
+
diff --git a/test/testPhysics/massTransferSM/testSMDiff.cc b/test/testPhysics/massTransferSM/testSMDiff.cc
new file mode 100644
index 0000000..cc53887
--- /dev/null
+++ b/test/testPhysics/massTransferSM/testSMDiff.cc
@@ -0,0 +1,125 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testSMDiff.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDStefanMaxwell.h>
+#include <num/aslBasicBC.h>
+#include "utilities/aslTimer.h"
+//#include "acl/aclUtilities.h"
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param diffCoef(.15);
+	
+	Param diffCoefNum(diffCoef.v()*dt.v()/dx.v()/dx.v());
+	
+	AVec<int> size(asl::makeAVec(10,20,20));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+	
+	auto c1Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c1Field, 0.5);
+	auto c2Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c2Field, 0.5);	
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q7());
+	auto nm(generateFDStefanMaxwell(c1Field, c2Field,  diffCoefNum.v(), templ));
+	nm->setDustDiffusionCoefficient(0,acl::generateVEConstant(diffCoefNum.v()*.5));
+	nm->setDustDiffusionCoefficient(1,acl::generateVEConstant(diffCoefNum.v()));
+	nm->init();
+
+	std::vector<asl::SPNumMethod> bc;
+
+	bc.push_back(asl::generateBCConstantGradient(c1Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 0, {asl::X0}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 1, {asl::XE}));
+	bc.push_back(asl::generateBCConstantGradient(c2Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 0, {asl::XE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 1, {asl::X0}));
+	initAll(bc);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<flush;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("surfaceFlux");
+	writer.addScalars("c1", *c1Field);
+	writer.addScalars("c2", *c2Field);
+
+	executeAll(bc);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 401; ++i)
+	{
+		nm->execute();
+		executeAll(bc);
+		if(!(i%40))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/massTransferSM/testSMDiff3C.cc b/test/testPhysics/massTransferSM/testSMDiff3C.cc
new file mode 100644
index 0000000..6db0893
--- /dev/null
+++ b/test/testPhysics/massTransferSM/testSMDiff3C.cc
@@ -0,0 +1,135 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testSMDiff3C.cc
+	ternary system
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDStefanMaxwell.h>
+#include <num/aslBasicBC.h>
+#include "utilities/aslTimer.h"
+#include "acl/aclMath/aclVectorOfElements.h"
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param diffCoef(.15);
+	
+	Param diffCoefNum(diffCoef.v()*dt.v()/dx.v()/dx.v());
+	
+	AVec<int> size(asl::makeAVec(10,20,20));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+	
+	auto c1Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c1Field, 0.33);
+	auto c2Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c2Field, 0.33);	
+	auto c3Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c3Field, 0.33);	
+
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q7());
+	auto nm(generateFDStefanMaxwell(c1Field, c2Field,  diffCoefNum.v(), templ));
+	nm->addComponent(c3Field,acl::generateVEConstant(asl::makeAVec(diffCoefNum.v()*.5,
+	                                                               diffCoefNum.v())));
+	nm->setDustDiffusionCoefficient(0,acl::generateVEConstant(diffCoefNum.v()*.5));
+	nm->setDustDiffusionCoefficient(1,acl::generateVEConstant(diffCoefNum.v()*.7));
+	nm->setDustDiffusionCoefficient(2,acl::generateVEConstant(diffCoefNum.v()));
+	nm->init();
+
+	std::vector<asl::SPNumMethod> bc;
+
+	bc.push_back(asl::generateBCConstantGradient(c1Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 0, {asl::X0}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 1, {asl::XE}));
+	bc.push_back(asl::generateBCConstantGradient(c2Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 0, {asl::XE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 1, {asl::X0}));
+	bc.push_back(asl::generateBCConstantGradient(c3Field, 0, templ, {asl::X0,asl::XE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c3Field, 0, {asl::YE}));
+	bc.push_back(asl::generateBCConstantValue(c3Field, 1, {asl::Y0}));
+	initAll(bc);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<flush;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("out");
+	writer.addScalars("c1", *c1Field);
+	writer.addScalars("c2", *c2Field);
+	writer.addScalars("c3", *c3Field);
+
+	executeAll(bc);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 401; ++i)
+	{
+		nm->execute();
+		executeAll(bc);
+		if(!(i%40))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/massTransferSM/testSMPhi.cc b/test/testPhysics/massTransferSM/testSMPhi.cc
new file mode 100644
index 0000000..2e75c51
--- /dev/null
+++ b/test/testPhysics/massTransferSM/testSMPhi.cc
@@ -0,0 +1,145 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testSMPhi.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDStefanMaxwell.h>
+#include <num/aslBasicBC.h>
+#include <utilities/aslTimer.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param diffCoef(.15);
+	
+	Param diffCoefNum(diffCoef.v()*dt.v()/dx.v()/dx.v());
+	
+	AVec<int> size(asl::makeAVec(10,20,20));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+	
+	auto c1Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c1Field, 0.5);
+	auto c2Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c2Field, 0.5);	
+	auto phiField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(phiField, 0.5);	
+
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q7());
+	auto nm(generateFDStefanMaxwell(c1Field, c2Field,  diffCoefNum.v(), templ));
+	nm->setDustDiffusionCoefficient(0,acl::generateVEConstant(diffCoefNum.v()*.5));
+	nm->setDustDiffusionCoefficient(1,acl::generateVEConstant(diffCoefNum.v()));
+	nm->setElectricField(asl::generateDataContainer_SP(phiField->getInternalBlock(),
+	                                                   phiField->getEContainer()*1e5/8.31/300,
+	                                                   1u));
+	nm->setCharge(0,acl::generateVEConstant(-2.));
+	nm->setCharge(1,acl::generateVEConstant(0.));
+	nm->init();
+
+	auto nmPhi(make_shared<asl::FDStefanMaxwellElectricField>(nm, phiField));
+	nmPhi->init();
+	
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcPhi;	
+
+	bc.push_back(asl::generateBCConstantGradient(c1Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, .1, {asl::X0}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 1, {asl::XE}));
+	bc.push_back(asl::generateBCConstantGradient(c2Field, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 0.1, {asl::XE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 1, {asl::X0}));
+	initAll(bc);
+	bcPhi.push_back(asl::generateBCConstantGradient(phiField, 0, templ, {asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bcPhi.push_back(asl::generateBCConstantValue(phiField, 1, {asl::XE}));
+	bcPhi.push_back(asl::generateBCConstantValue(phiField, 0, {asl::X0}));
+	initAll(bcPhi);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<flush;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("out");
+	writer.addScalars("c1", *c1Field);
+	writer.addScalars("c2", *c2Field);
+	writer.addScalars("phi", *phiField);
+
+	executeAll(bc);
+	executeAll(bcPhi);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 401; ++i)
+	{
+		for(unsigned int j(0); j<50; ++j)
+		{
+			nmPhi->execute();
+			executeAll(bcPhi);		
+		}
+		nm->execute();
+		executeAll(bc);
+		if(!(i%40))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}
diff --git a/test/testPhysics/massTransferSM/testSMPhiBV.cc b/test/testPhysics/massTransferSM/testSMPhiBV.cc
new file mode 100644
index 0000000..2e68fa1
--- /dev/null
+++ b/test/testPhysics/massTransferSM/testSMPhiBV.cc
@@ -0,0 +1,171 @@
+/*
+ * Advanced Simulation Library <http://asl.org.il>
+ * 
+ * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
+ *
+ *
+ * This file is part of Advanced Simulation Library (ASL).
+ *
+ * ASL is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3 of the License.
+ *
+ * ASL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with ASL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/**
+	\example testSMPhiBV.cc
+ */
+
+#include <utilities/aslUValue.h>
+#include <math/aslVectors.h>
+#include <math/aslTemplates.h>
+#include <aslGeomInc.h>
+#include <aslDataInc.h>
+#include <acl/aclGenerators.h>
+#include <writers/aslVTKFormatWriters.h>
+#include <num/aslFDStefanMaxwell.h>
+#include <num/aslFDAdvectionDiffusion.h>
+#include <num/aslFDElChemKinetics.h>
+#include <num/aslBasicBC.h>
+#include <utilities/aslTimer.h>
+#include <acl/aclMath/aclVectorOfElements.h>
+
+typedef float FlT;
+//typedef double FlT;
+typedef asl::UValue<double> Param;
+
+using asl::AVec;
+using asl::makeAVec;
+
+int main()
+{
+	Param dx(1.);
+	Param dt(1.);
+	Param diffCoef(.15);
+	
+	Param diffCoefNum(diffCoef.v()*dt.v()/dx.v()/dx.v());
+	
+	AVec<int> size(asl::makeAVec(10,20,20));
+
+	auto gSize(dx.v()*AVec<>(size));
+
+	std::cout<<"Flow: Data initialization...";
+
+	asl::Block block(size,dx.v());
+	
+	auto c1Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c1Field, 0.5);
+	auto c2Field(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c2Field, 0.5);	
+	auto c1aField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(c1aField, 0.5);	
+
+	auto phiField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(phiField, 0.5);	
+
+	auto phiSField(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+	asl::initData(phiSField, 0.);	
+	
+	std::cout<<"Finished"<<endl;
+	
+	std::cout<<"Flow: Numerics initialization...";
+
+	auto templ(&asl::d3q7());
+	auto nm(generateFDStefanMaxwell(c1Field, c2Field,  diffCoefNum.v(), templ));
+	nm->setDustDiffusionCoefficient(0,acl::generateVEConstant(diffCoefNum.v()*.5));
+	nm->setDustDiffusionCoefficient(1,acl::generateVEConstant(diffCoefNum.v()));
+	nm->setElectricField(asl::generateDataContainer_SP(block,
+	                                                   phiField->getEContainer()*1e5/8.31/300,
+	                                                   1u));
+	nm->setCharge(0,acl::generateVEConstant(-2.));
+	nm->setCharge(1,acl::generateVEConstant(0.));
+	nm->init();
+
+	auto nmA(generateFDAdvectionDiffusion(c1aField, diffCoefNum.v(), templ));
+	nmA->init();
+	
+	auto nmPhi(make_shared<asl::FDStefanMaxwellElectricField>(nm, phiField));
+	nmPhi->setPhiS(asl::generateDataContainer_SP(block,
+	                                             -phiSField->getEContainer()*.1,
+	                                             1u));
+	nmPhi->init();
+
+	auto nmBV(generateFDBVKinetics(c1aField, -1., c1Field, 1., phiSField, 
+	                               asl::generateDataContainer_SP(block,
+	                                                             phiField->getEContainer()+.2,
+	                                                             1u),
+	                               1., .5, 1.));
+	nmBV->addAI(c2Field, -1);
+	nmBV->init();
+	
+	std::vector<asl::SPNumMethod> bc;
+	std::vector<asl::SPNumMethod> bcPhi;	
+
+	bc.push_back(asl::generateBCConstantGradient(c1Field, 0, templ, {asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c1Field, 0., {asl::X0}));
+	bc.push_back(asl::generateBCConstantGradient(c2Field, 0, templ, {asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c2Field, 1, {asl::X0}));
+	bc.push_back(asl::generateBCConstantGradient(c1aField, 0, templ, {asl::X0,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bc.push_back(asl::generateBCConstantValue(c1aField, 1, {asl::XE}));
+	initAll(bc);
+	bcPhi.push_back(asl::generateBCConstantGradient(phiField, 0, templ, {asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
+	bcPhi.push_back(asl::generateBCConstantValue(phiField, 0, {asl::X0}));
+	initAll(bcPhi);
+
+	std::cout<<"Finished"<<endl;
+	std::cout<<"Computing..."<<flush;
+	asl::Timer timer;
+
+	asl::WriterVTKXML writer("out");
+	writer.addScalars("c1", *c1Field);
+	writer.addScalars("c2", *c2Field);
+	writer.addScalars("c1a", *c1aField);	
+	writer.addScalars("phi", *phiField);
+	writer.addScalars("phiS", *phiSField);
+
+	executeAll(bc);
+	executeAll(bcPhi);
+	writer.write();
+
+	timer.start();
+	for(unsigned int i(1); i < 401; ++i)
+	{
+		for(unsigned int j(0); j<50; ++j)
+		{
+			nmBV->executeJ();
+			nmPhi->execute();
+			executeAll(bcPhi);		
+		}
+		nm->execute();
+		nmA->execute();
+		nmBV->execute();
+		executeAll(bc);
+		if(!(i%40))
+		{
+			cout<<i<<endl;
+			writer.write();
+		}
+	}
+	timer.stop();
+	
+	std::cout<<"Finished"<<endl;	
+
+	cout << "time=" << timer.getTime() << "; clockTime="
+		<< timer.getClockTime()	<< "; load=" 
+		<< timer.getProcessorLoad() * 100 << "%" << endl;
+
+	std::cout<<"Output...";
+	std::cout<<"Finished"<<endl;	
+	std::cout<<"Ok"<<endl;
+
+	return 0;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git



More information about the debian-science-commits mailing list