19 |
|
!! @author J. Daniel Gezelter |
20 |
|
!! @author Charles F. Vardeman II |
21 |
|
!! @author Matthew Meineke |
22 |
< |
!! @version $Id: vector_class.F90,v 1.8 2003-03-14 19:51:11 chuckv Exp $, $Date: 2003-03-14 19:51:11 $, $Name: not supported by cvs2svn $, $Revision: 1.8 $ |
22 |
> |
!! @version $Id: vector_class.F90,v 1.9 2003-03-20 00:02:39 chuckv Exp $, $Date: 2003-03-20 00:02:39 $, $Name: not supported by cvs2svn $, $Revision: 1.9 $ |
23 |
|
|
24 |
|
module Vector_class |
25 |
|
|
130 |
|
integer :: i, j |
131 |
|
|
132 |
|
id = 0 |
133 |
< |
|
133 |
> |
|
134 |
|
do i = 1, this%propertyCount |
135 |
|
if (this%PropertyDescriptions(i) == MatchName) then |
136 |
|
do j = 1, this%elementCount |
352 |
|
type(Vector), pointer :: this |
353 |
|
integer, intent(in) :: MatchID |
354 |
|
integer, intent(in) :: MatchValue |
355 |
< |
integer, pointer :: MatchList(:) |
355 |
> |
integer, pointer :: MatchList(:) |
356 |
> |
integer, allocatable :: MatchListTemp(:) |
357 |
|
integer, intent(out) :: nMatches |
358 |
|
integer :: error, i |
359 |
|
|
360 |
< |
allocate(MatchList(this%elementCount), stat=error) |
361 |
< |
if(error .ne. 0) write(*,*) 'Could not allocate MatchList!' |
360 |
> |
if(associated(MatchList)) deallocate(MatchList) |
361 |
> |
MatchList => null() |
362 |
> |
|
363 |
> |
allocate(MatchListTemp(this%elementCount), stat=error) |
364 |
> |
if(error .ne. 0) write(*,*) 'Could not allocate MatchListTemp!' |
365 |
|
|
366 |
|
nMatches = 0 |
367 |
|
|
368 |
|
do i = 1, this%elementCount |
369 |
|
if (this%integerElementProperties(i, MatchID) == MatchValue) then |
370 |
|
nMatches = nMatches + 1 |
371 |
< |
MatchList(nMatches) = i |
371 |
> |
MatchListTemp(nMatches) = i |
372 |
|
endif |
373 |
|
enddo |
374 |
+ |
|
375 |
+ |
|
376 |
+ |
if (nMatches .ne. 0) then |
377 |
+ |
allocate(MatchList(nMatches), stat=error) |
378 |
+ |
if (error.ne.0) write(*, *) 'Could not allocate MatchList!' |
379 |
+ |
do i = 1, nMatches |
380 |
+ |
MatchList(i) = MatchListTemp(i) |
381 |
+ |
enddo |
382 |
+ |
endif |
383 |
+ |
|
384 |
+ |
deallocate(MatchListTemp) |
385 |
+ |
|
386 |
+ |
|
387 |
|
end subroutine getAllMatches1i |
388 |
|
|
389 |
|
subroutine getAllMatches2i(this, MatchID1, MatchValue1, & |
392 |
|
integer, intent(in) :: MatchID1, MatchID2 |
393 |
|
integer, intent(in) :: MatchValue1, MatchValue2 |
394 |
|
integer, pointer :: MatchList(:) |
395 |
+ |
integer, allocatable :: MatchListTemp(:) |
396 |
|
integer, intent(out) :: nMatches |
397 |
|
integer :: error, i |
398 |
|
|
399 |
< |
allocate(MatchList(this%elementCount), stat=error) |
400 |
< |
if(error .ne. 0) write(*,*) 'Could not allocate MatchList!' |
399 |
> |
if(associated(MatchList)) deallocate(MatchList) |
400 |
> |
MatchList => null() |
401 |
> |
|
402 |
> |
allocate(MatchListTemp(this%elementCount), stat=error) |
403 |
> |
if(error .ne. 0) write(*,*) 'Could not allocate MatchListTemp!' |
404 |
|
|
405 |
|
nMatches = 0 |
406 |
|
|
408 |
|
if ((this%integerElementProperties(i, MatchID1) == MatchValue1) .and. & |
409 |
|
(this%integerElementProperties(i, MatchID2) == MatchValue2)) then |
410 |
|
nMatches = nMatches + 1 |
411 |
< |
MatchList(nMatches) = i |
411 |
> |
MatchListTemp(nMatches) = i |
412 |
|
endif |
413 |
|
enddo |
414 |
+ |
|
415 |
+ |
if (nMatches .ne. 0) then |
416 |
+ |
allocate(MatchList(nMatches), stat=error) |
417 |
+ |
if (error.ne.0) write(*, *) 'Could not allocate MatchList!' |
418 |
+ |
do i = 1, nMatches |
419 |
+ |
MatchList(i) = MatchListTemp(i) |
420 |
+ |
enddo |
421 |
+ |
endif |
422 |
+ |
|
423 |
+ |
deallocate(MatchListTemp) |
424 |
+ |
|
425 |
|
end subroutine getAllMatches2i |
426 |
|
|
427 |
|
subroutine getAllMatches1l(this, MatchID, MatchValue, nMatches, MatchList) |
429 |
|
integer, intent(in) :: MatchID |
430 |
|
logical, intent(in) :: MatchValue |
431 |
|
integer, pointer :: MatchList(:) |
432 |
+ |
integer, allocatable :: MatchListTemp(:) |
433 |
|
integer, intent(out) :: nMatches |
434 |
|
integer :: error, i |
435 |
|
|
436 |
< |
allocate(MatchList(this%elementCount), stat=error) |
437 |
< |
if(error .ne. 0) write(*,*) 'Could not allocate MatchList!' |
436 |
> |
if(associated(MatchList)) deallocate(MatchList) |
437 |
> |
MatchList => null() |
438 |
> |
|
439 |
> |
allocate(MatchListTemp(this%elementCount), stat=error) |
440 |
> |
if(error .ne. 0) write(*,*) 'Could not allocate MatchListTemp!' |
441 |
|
|
442 |
|
nMatches = 0 |
443 |
|
|
444 |
|
do i = 1, this%elementCount |
445 |
|
if (this%logicalElementProperties(i, MatchID).eqv.MatchValue) then |
446 |
|
nMatches = nMatches + 1 |
447 |
< |
MatchList(nMatches) = i |
447 |
> |
MatchListTemp(nMatches) = i |
448 |
|
endif |
449 |
|
enddo |
450 |
+ |
|
451 |
+ |
if (nMatches .ne. 0) then |
452 |
+ |
allocate(MatchList(nMatches), stat=error) |
453 |
+ |
if (error.ne.0) write(*, *) 'Could not allocate MatchList!' |
454 |
+ |
do i = 1, nMatches |
455 |
+ |
MatchList(i) = MatchListTemp(i) |
456 |
+ |
enddo |
457 |
+ |
endif |
458 |
+ |
|
459 |
+ |
deallocate(MatchListTemp) |
460 |
+ |
|
461 |
|
end subroutine getAllMatches1l |
462 |
|
|
463 |
|
subroutine getAllMatches2l(this, MatchID1, MatchValue1, & |
466 |
|
integer, intent(in) :: MatchID1, MatchID2 |
467 |
|
logical, intent(in) :: MatchValue1, MatchValue2 |
468 |
|
integer, pointer :: MatchList(:) |
469 |
+ |
integer, allocatable :: MatchListTemp(:) |
470 |
|
integer, intent(out) :: nMatches |
471 |
|
integer :: error, i |
472 |
|
|
473 |
< |
allocate(MatchList(this%elementCount), stat=error) |
474 |
< |
if(error .ne. 0) write(*,*) 'Could not allocate MatchList!' |
473 |
> |
if(associated(MatchList)) deallocate(MatchList) |
474 |
> |
MatchList => null() |
475 |
> |
|
476 |
> |
allocate(MatchListTemp(this%elementCount), stat=error) |
477 |
> |
if(error .ne. 0) write(*,*) 'Could not allocate MatchListTemp!' |
478 |
|
|
479 |
|
nMatches = 0 |
480 |
|
|
482 |
|
if ((this%logicalElementProperties(i, MatchID1).eqv.MatchValue1) .and. & |
483 |
|
(this%logicalElementProperties(i, MatchID2).eqv.MatchValue2)) then |
484 |
|
nMatches = nMatches + 1 |
485 |
< |
MatchList(nMatches) = i |
485 |
> |
MatchListTemp(nMatches) = i |
486 |
|
endif |
487 |
|
enddo |
488 |
+ |
|
489 |
+ |
if (nMatches .ne. 0) then |
490 |
+ |
allocate(MatchList(nMatches), stat=error) |
491 |
+ |
if (error.ne.0) write(*, *) 'Could not allocate MatchList!' |
492 |
+ |
do i = 1, nMatches |
493 |
+ |
MatchList(i) = MatchListTemp(i) |
494 |
+ |
enddo |
495 |
+ |
endif |
496 |
+ |
|
497 |
+ |
deallocate(MatchListTemp) |
498 |
+ |
|
499 |
|
end subroutine getAllMatches2l |
500 |
|
|
501 |
|
|
666 |
|
type(Vector), pointer :: this |
667 |
|
integer :: id |
668 |
|
integer :: error |
669 |
< |
|
669 |
> |
|
670 |
|
if (.not. associated(this)) then |
671 |
|
call ensureCapacityHelper(this,1,0) |
672 |
|
else |
673 |
|
call ensureCapacityHelper(this, this%elementCount + 1, this%PropertyCount) |
674 |
|
end if |
675 |
< |
|
676 |
< |
this%elementCount = this%elementCount + 1 |
677 |
< |
this%elementData = this%elementCount |
678 |
< |
id = this%elementCount |
679 |
< |
|
680 |
< |
|
675 |
> |
|
676 |
> |
this%elementCount = this%elementCount + 1 |
677 |
> |
|
678 |
> |
!! We never use this and we set the entire array to the same value |
679 |
> |
this%elementData = this%elementCount |
680 |
> |
id = this%elementCount |
681 |
|
end function addElement |
682 |
|
|
683 |
|
recursive subroutine setElementPropertyReal(this, id, PropName, PropValue) |