This file is indexed.

/usr/include/ASL/math/aslTemplates.h is in libasl-dev 0.1.7-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
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